summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/clang/lib/CodeGen
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-09 15:51:07 +0000
committerpatrick <patrick@openbsd.org>2020-08-09 15:51:07 +0000
commit389bb291c0c8961ca40ac7a2636e1ca69ca7653c (patch)
treee027d0b3ed5ed27fe08d1bcaa20e3c191232a53b /gnu/llvm/clang/lib/CodeGen
parentImport LLVM 10.0.1 including clang, lld and lldb. (diff)
downloadwireguard-openbsd-389bb291c0c8961ca40ac7a2636e1ca69ca7653c.tar.xz
wireguard-openbsd-389bb291c0c8961ca40ac7a2636e1ca69ca7653c.zip
Import LLVM 10.0.1 including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/clang/lib/CodeGen')
-rw-r--r--gnu/llvm/clang/lib/CodeGen/CGVTables.cpp5
-rw-r--r--gnu/llvm/clang/lib/CodeGen/CMakeLists.txt3
-rw-r--r--gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp11
-rw-r--r--gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp3
4 files changed, 15 insertions, 7 deletions
diff --git a/gnu/llvm/clang/lib/CodeGen/CGVTables.cpp b/gnu/llvm/clang/lib/CodeGen/CGVTables.cpp
index 59631e80237..e97f7e41499 100644
--- a/gnu/llvm/clang/lib/CodeGen/CGVTables.cpp
+++ b/gnu/llvm/clang/lib/CodeGen/CGVTables.cpp
@@ -437,7 +437,8 @@ void CodeGenFunction::EmitMustTailThunk(GlobalDecl GD,
// Finish the function to maintain CodeGenFunction invariants.
// FIXME: Don't emit unreachable code.
EmitBlock(createBasicBlock());
- FinishFunction();
+
+ FinishThunk();
}
void CodeGenFunction::generateThunk(llvm::Function *Fn,
@@ -564,7 +565,7 @@ llvm::Constant *CodeGenVTables::maybeEmitThunk(GlobalDecl GD,
CGM.SetLLVMFunctionAttributesForDefinition(GD.getDecl(), ThunkFn);
// Thunks for variadic methods are special because in general variadic
- // arguments cannot be perferctly forwarded. In the general case, clang
+ // arguments cannot be perfectly forwarded. In the general case, clang
// implements such thunks by cloning the original function body. However, for
// thunks with no return adjustment on targets that support musttail, we can
// use musttail to perfectly forward the variadic arguments.
diff --git a/gnu/llvm/clang/lib/CodeGen/CMakeLists.txt b/gnu/llvm/clang/lib/CodeGen/CMakeLists.txt
index d8b3c234a1e..c300c1b021f 100644
--- a/gnu/llvm/clang/lib/CodeGen/CMakeLists.txt
+++ b/gnu/llvm/clang/lib/CodeGen/CMakeLists.txt
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
Core
Coroutines
Coverage
+ Extensions
FrontendOpenMP
IPO
IRReader
@@ -96,8 +97,6 @@ add_clang_library(clangCodeGen
TargetInfo.cpp
VarBypassDetector.cpp
- ENABLE_PLUGINS
-
DEPENDS
${codegen_deps}
diff --git a/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp b/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
index f8866ac4f7f..a735bdd814e 100644
--- a/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1847,9 +1847,16 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
else if (const auto *SA = FD->getAttr<SectionAttr>())
F->setSection(SA->getName());
+ // If we plan on emitting this inline builtin, we can't treat it as a builtin.
if (FD->isInlineBuiltinDeclaration()) {
- F->addAttribute(llvm::AttributeList::FunctionIndex,
- llvm::Attribute::NoBuiltin);
+ const FunctionDecl *FDBody;
+ bool HasBody = FD->hasBody(FDBody);
+ (void)HasBody;
+ assert(HasBody && "Inline builtin declarations should always have an "
+ "available body!");
+ if (shouldEmitFunction(FDBody))
+ F->addAttribute(llvm::AttributeList::FunctionIndex,
+ llvm::Attribute::NoBuiltin);
}
if (FD->isReplaceableGlobalAllocationFunction()) {
diff --git a/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp b/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp
index 46fe5871cb9..51d6ad0cae5 100644
--- a/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp
+++ b/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp
@@ -9677,7 +9677,8 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
uint64_t Size = getContext().getTypeSize(Ty);
// Pass floating point values via FPRs if possible.
- if (IsFixed && Ty->isFloatingType() && FLen >= Size && ArgFPRsLeft) {
+ if (IsFixed && Ty->isFloatingType() && !Ty->isComplexType() &&
+ FLen >= Size && ArgFPRsLeft) {
ArgFPRsLeft--;
return ABIArgInfo::getDirect();
}