sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-29 00:35:41 +00:00
parent 5d45cd7ee8
commit 155eb8555e
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
5506 changed files with 1786257 additions and 1416034 deletions

View file

@ -1,26 +1,7 @@
/*
* Copyright 2014 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* SPDX-License-Identifier: MIT
*/
#include <llvm-c/Core.h>
@ -38,9 +19,7 @@
#include <llvm/Transforms/IPO/AlwaysInliner.h>
#include <llvm/Transforms/InstCombine/InstCombine.h>
#include <llvm/Transforms/IPO/SCCP.h>
#if LLVM_VERSION_MAJOR >= 15
#include "llvm/CodeGen/SelectionDAGNodes.h"
#endif
#include <cstring>
@ -57,7 +36,6 @@
using namespace llvm;
#if LLVM_VERSION_MAJOR >= 15
class RunAtExitForStaticDestructors : public SDNode
{
public:
@ -66,11 +44,9 @@ public:
{
}
};
#endif
void ac_llvm_run_atexit_for_destructors(void)
{
#if LLVM_VERSION_MAJOR >= 15
/* LLVM >= 16 registers static variable destructors on the first compile, which gcc
* implements by calling atexit there. Before that, u_queue registers its atexit
* handler to kill all threads. Since exit() runs atexit handlers in the reverse order,
@ -85,7 +61,6 @@ void ac_llvm_run_atexit_for_destructors(void)
* This just executes the code that declares static variables.
*/
RunAtExitForStaticDestructors();
#endif
}
bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *processor)
@ -94,7 +69,7 @@ bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *process
return TM->getMCSubtargetInfo()->isCPUStringValid(processor);
}
void ac_reset_llvm_all_options_occurences()
void ac_reset_llvm_all_options_occurrences()
{
cl::ResetAllOptionOccurrences();
}
@ -275,7 +250,11 @@ struct ac_compiler_passes *ac_create_llvm_passes(LLVMTargetMachineRef tm)
TargetMachine *TM = reinterpret_cast<TargetMachine *>(tm);
if (TM->addPassesToEmitFile(p->passmgr, p->ostream, nullptr,
#if LLVM_VERSION_MAJOR >= 18
CodeGenFileType::ObjectFile)) {
#else
CGFT_ObjectFile)) {
#endif
fprintf(stderr, "amd: TargetMachine can't emit a file of this type!\n");
delete p;
return NULL;
@ -387,9 +366,7 @@ LLVMValueRef ac_build_atomic_rmw(struct ac_llvm_context *ctx, LLVMAtomicRMWBinOp
unsigned SSID = unwrap(ctx->context)->getOrInsertSyncScopeID(sync_scope);
return wrap(unwrap(ctx->builder)
->CreateAtomicRMW(binop, unwrap(ptr), unwrap(val),
#if LLVM_VERSION_MAJOR >= 13
MaybeAlign(0),
#endif
AtomicOrdering::SequentiallyConsistent, SSID));
}
@ -400,9 +377,7 @@ LLVMValueRef ac_build_atomic_cmp_xchg(struct ac_llvm_context *ctx, LLVMValueRef
return wrap(unwrap(ctx->builder)
->CreateAtomicCmpXchg(unwrap(ptr), unwrap(cmp),
unwrap(val),
#if LLVM_VERSION_MAJOR >= 13
MaybeAlign(0),
#endif
AtomicOrdering::SequentiallyConsistent,
AtomicOrdering::SequentiallyConsistent, SSID));
}