mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-08 09:03:18 +00:00
[CodeGen] Attach function attributes to Objective-C and OpenMP
functions. This commit fixes a bug in CGOpenMPRuntime.cpp and CGObjC.cpp where some of the function attributes are not attached to newly created functions. rdar://problem/20828324 Differential Revision: http://reviews.llvm.org/D13928 llvm-svn: 251476
This commit is contained in:
parent
c3ceb27690
commit
44a59f8976
@ -2944,7 +2944,9 @@ CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(
|
||||
llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
|
||||
"__assign_helper_atomic_property_",
|
||||
&CGM.getModule());
|
||||
|
||||
|
||||
CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
|
||||
|
||||
StartFunction(FD, C.VoidTy, Fn, FI, args);
|
||||
|
||||
DeclRefExpr DstExpr(&dstDecl, false, DestTy,
|
||||
@ -3023,6 +3025,8 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(
|
||||
llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
|
||||
"__copy_helper_atomic_property_", &CGM.getModule());
|
||||
|
||||
CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
|
||||
|
||||
StartFunction(FD, C.VoidTy, Fn, FI, args);
|
||||
|
||||
DeclRefExpr SrcExpr(&srcDecl, false, SrcTy,
|
||||
|
@ -1490,7 +1490,7 @@ static llvm::Value *emitCopyprivateCopyFunction(
|
||||
auto *Fn = llvm::Function::Create(
|
||||
CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
|
||||
".omp.copyprivate.copy_func", &CGM.getModule());
|
||||
CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, CGFI, Fn);
|
||||
CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);
|
||||
CodeGenFunction CGF(CGM);
|
||||
CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);
|
||||
// Dest = (void*[n])(LHSArg);
|
||||
@ -2048,7 +2048,7 @@ emitProxyTaskFunction(CodeGenModule &CGM, SourceLocation Loc,
|
||||
auto *TaskEntry =
|
||||
llvm::Function::Create(TaskEntryTy, llvm::GlobalValue::InternalLinkage,
|
||||
".omp_task_entry.", &CGM.getModule());
|
||||
CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskEntryFnInfo, TaskEntry);
|
||||
CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskEntry, TaskEntryFnInfo);
|
||||
CodeGenFunction CGF(CGM);
|
||||
CGF.disableDebugInfo();
|
||||
CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, Args);
|
||||
@ -2115,7 +2115,8 @@ static llvm::Value *emitDestructorsFunction(CodeGenModule &CGM,
|
||||
auto *DestructorFn =
|
||||
llvm::Function::Create(DestructorFnTy, llvm::GlobalValue::InternalLinkage,
|
||||
".omp_task_destructor.", &CGM.getModule());
|
||||
CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, DestructorFnInfo, DestructorFn);
|
||||
CGM.SetInternalFunctionAttributes(/*D=*/nullptr, DestructorFn,
|
||||
DestructorFnInfo);
|
||||
CodeGenFunction CGF(CGM);
|
||||
CGF.disableDebugInfo();
|
||||
CGF.StartFunction(GlobalDecl(), KmpInt32Ty, DestructorFn, DestructorFnInfo,
|
||||
@ -2191,8 +2192,8 @@ emitTaskPrivateMappingFunction(CodeGenModule &CGM, SourceLocation Loc,
|
||||
auto *TaskPrivatesMap = llvm::Function::Create(
|
||||
TaskPrivatesMapTy, llvm::GlobalValue::InternalLinkage,
|
||||
".omp_task_privates_map.", &CGM.getModule());
|
||||
CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskPrivatesMapFnInfo,
|
||||
TaskPrivatesMap);
|
||||
CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskPrivatesMap,
|
||||
TaskPrivatesMapFnInfo);
|
||||
TaskPrivatesMap->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||
CodeGenFunction CGF(CGM);
|
||||
CGF.disableDebugInfo();
|
||||
@ -2693,7 +2694,7 @@ static llvm::Value *emitReductionFunction(CodeGenModule &CGM,
|
||||
auto *Fn = llvm::Function::Create(
|
||||
CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
|
||||
".omp.reduction.reduction_func", &CGM.getModule());
|
||||
CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, CGFI, Fn);
|
||||
CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);
|
||||
CodeGenFunction CGF(CGM);
|
||||
CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct TCPPObject
|
||||
@synthesize MyProperty1 = _cppObject1;
|
||||
@end
|
||||
|
||||
// CHECK-LABEL: define internal void @__copy_helper_atomic_property_(
|
||||
// CHECK-LABEL: define internal void @__copy_helper_atomic_property_(%struct.TCPPObject*, %struct.TCPPObject*) #
|
||||
// CHECK: [[TWO:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR:%.*]], align 8
|
||||
// CHECK: [[THREE:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR1:%.*]], align 8
|
||||
// CHECK: [[CALL:%.*]] = call i32 @_Z7DEFAULTv()
|
||||
@ -43,7 +43,7 @@ struct TCPPObject
|
||||
// CHECK: call void @objc_copyCppObjectAtomic(i8* [[THREE]], i8* [[TWO]], i8* bitcast (void (%struct.TCPPObject*, %struct.TCPPObject*)* @__copy_helper_atomic_property_ to i8*))
|
||||
// CHECK: ret void
|
||||
|
||||
// CHECK-LABEL: define internal void @__assign_helper_atomic_property_(
|
||||
// CHECK-LABEL: define internal void @__assign_helper_atomic_property_(%struct.TCPPObject*, %struct.TCPPObject*) #
|
||||
// CHECK: [[TWO:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR:%.*]], align 8
|
||||
// CHECK: [[THREE:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR1:%.*]], align 8
|
||||
// CHECK: [[CALL:%.*]] = call dereferenceable({{[0-9]+}}) %struct.TCPPObject* @_ZN10TCPPObjectaSERKS_(%struct.TCPPObject* [[TWO]], %struct.TCPPObject* dereferenceable({{[0-9]+}}) [[THREE]])
|
||||
|
Loading…
Reference in New Issue
Block a user