Use the Attributes::get method which takes an AttrVal value directly to simplify the code a bit. No functionality change.

llvm-svn: 166010
This commit is contained in:
Bill Wendling 2012-10-16 05:23:44 +00:00
parent c6a15cf519
commit 507c351a9a
4 changed files with 12 additions and 26 deletions

View File

@ -1131,9 +1131,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// Name the struct return argument.
if (CGM.ReturnTypeUsesSRet(FI)) {
AI->setName("agg.result");
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoAlias);
AI->addAttr(llvm::Attributes::get(getLLVMContext(), B));
AI->addAttr(llvm::Attributes::get(getLLVMContext(),
llvm::Attributes::NoAlias));
++AI;
}
@ -1202,11 +1201,9 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
assert(AI != Fn->arg_end() && "Argument mismatch!");
llvm::Value *V = AI;
if (Arg->getType().isRestrictQualified()) {
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoAlias);
AI->addAttr(llvm::Attributes::get(getLLVMContext(), B));
}
if (Arg->getType().isRestrictQualified())
AI->addAttr(llvm::Attributes::get(getLLVMContext(),
llvm::Attributes::NoAlias));
// Ensure the argument is the correct type.
if (V->getType() != ArgI.getCoerceToType())

View File

@ -63,13 +63,11 @@ private:
// Add the non-lazy-bind attribute, since objc_msgSend is likely to
// be called a lot.
llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NonLazyBind);
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSend",
llvm::Attributes::get(CGM.getLLVMContext(),
B));
llvm::Attributes::NonLazyBind));
}
/// void objc_msgSend_stret (id, SEL, ...)
@ -583,13 +581,11 @@ public:
llvm::Constant *getSetJmpFn() {
// This is specifically the prototype for x86.
llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() };
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NonLazyBind);
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty,
params, false),
"_setjmp",
llvm::Attributes::get(CGM.getLLVMContext(),
B));
llvm::Attributes::NonLazyBind));
}
public:

View File

@ -1632,10 +1632,9 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect,
/* IsAlignStack */ false, AsmDialect);
llvm::CallInst *Result = Builder.CreateCall(IA, Args);
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoUnwind);
Result->addAttribute(llvm::AttrListPtr::FunctionIndex,
llvm::Attributes::get(getLLVMContext(), B));
llvm::Attributes::get(getLLVMContext(),
llvm::Attributes::NoUnwind));
// Slap the source location of the inline asm into a !srcloc metadata on the
// call. FIXME: Handle metadata for MS-style inline asms.

View File

@ -950,11 +950,9 @@ static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM,
llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.getTypes().ConvertType(CGM.getContext().IntTy),
GuardPtrTy, /*isVarArg=*/false);
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoUnwind);
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_acquire",
llvm::Attributes::get(CGM.getLLVMContext(),
B));
llvm::Attributes::NoUnwind));
}
static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
@ -962,11 +960,9 @@ static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
// void __cxa_guard_release(__guard *guard_object);
llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false);
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoUnwind);
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_release",
llvm::Attributes::get(CGM.getLLVMContext(),
B));
llvm::Attributes::NoUnwind));
}
static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
@ -974,11 +970,9 @@ static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
// void __cxa_guard_abort(__guard *guard_object);
llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false);
llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoUnwind);
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort",
llvm::Attributes::get(CGM.getLLVMContext(),
B));
llvm::Attributes::NoUnwind));
}
namespace {