Move the Attributes::Builder outside of the Attributes class and into its own class named AttrBuilder. No functionality change.

llvm-svn: 165961
This commit is contained in:
Bill Wendling 2012-10-15 20:36:26 +00:00
parent 50d27849f6
commit a514ebc1db
6 changed files with 14 additions and 14 deletions

View File

@ -924,8 +924,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
const Decl *TargetDecl, const Decl *TargetDecl,
AttributeListType &PAL, AttributeListType &PAL,
unsigned &CallingConv) { unsigned &CallingConv) {
llvm::Attributes::Builder FuncAttrs; llvm::AttrBuilder FuncAttrs;
llvm::Attributes::Builder RetAttrs; llvm::AttrBuilder RetAttrs;
CallingConv = FI.getEffectiveCallingConvention(); CallingConv = FI.getEffectiveCallingConvention();
@ -984,7 +984,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
break; break;
case ABIArgInfo::Indirect: { case ABIArgInfo::Indirect: {
llvm::Attributes::Builder SRETAttrs; llvm::AttrBuilder SRETAttrs;
SRETAttrs.addAttribute(llvm::Attributes::StructRet); SRETAttrs.addAttribute(llvm::Attributes::StructRet);
if (RetAI.getInReg()) if (RetAI.getInReg())
SRETAttrs.addAttribute(llvm::Attributes::InReg); SRETAttrs.addAttribute(llvm::Attributes::InReg);
@ -1014,7 +1014,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
ie = FI.arg_end(); it != ie; ++it) { ie = FI.arg_end(); it != ie; ++it) {
QualType ParamType = it->type; QualType ParamType = it->type;
const ABIArgInfo &AI = it->info; const ABIArgInfo &AI = it->info;
llvm::Attributes::Builder Attrs; llvm::AttrBuilder Attrs;
// 'restrict' -> 'noalias' is done in EmitFunctionProlog when we // 'restrict' -> 'noalias' is done in EmitFunctionProlog when we
// have the corresponding parameter variable. It doesn't make // have the corresponding parameter variable. It doesn't make
@ -1131,7 +1131,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// Name the struct return argument. // Name the struct return argument.
if (CGM.ReturnTypeUsesSRet(FI)) { if (CGM.ReturnTypeUsesSRet(FI)) {
AI->setName("agg.result"); AI->setName("agg.result");
llvm::Attributes::Builder B; llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoAlias); B.addAttribute(llvm::Attributes::NoAlias);
AI->addAttr(llvm::Attributes::get(getLLVMContext(), B)); AI->addAttr(llvm::Attributes::get(getLLVMContext(), B));
++AI; ++AI;
@ -1203,7 +1203,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
llvm::Value *V = AI; llvm::Value *V = AI;
if (Arg->getType().isRestrictQualified()) { if (Arg->getType().isRestrictQualified()) {
llvm::Attributes::Builder B; llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoAlias); B.addAttribute(llvm::Attributes::NoAlias);
AI->addAttr(llvm::Attributes::get(getLLVMContext(), B)); AI->addAttr(llvm::Attributes::get(getLLVMContext(), B));
} }

View File

@ -2081,7 +2081,7 @@ void CodeGenFunction::EmitCheck(llvm::Value *Checked, StringRef CheckName,
llvm::FunctionType *FnType = llvm::FunctionType *FnType =
llvm::FunctionType::get(CGM.VoidTy, ArgTypes, false); llvm::FunctionType::get(CGM.VoidTy, ArgTypes, false);
llvm::Attributes::Builder B; llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoReturn) B.addAttribute(llvm::Attributes::NoReturn)
.addAttribute(llvm::Attributes::NoUnwind) .addAttribute(llvm::Attributes::NoUnwind)
.addAttribute(llvm::Attributes::UWTable); .addAttribute(llvm::Attributes::UWTable);

View File

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

View File

@ -1632,7 +1632,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect, llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect,
/* IsAlignStack */ false, AsmDialect); /* IsAlignStack */ false, AsmDialect);
llvm::CallInst *Result = Builder.CreateCall(IA, Args); llvm::CallInst *Result = Builder.CreateCall(IA, Args);
llvm::Attributes::Builder B; llvm::AttrBuilder B;
B.addAttribute(llvm::Attributes::NoUnwind); B.addAttribute(llvm::Attributes::NoUnwind);
Result->addAttribute(llvm::AttrListPtr::FunctionIndex, Result->addAttribute(llvm::AttrListPtr::FunctionIndex,
llvm::Attributes::get(getLLVMContext(), B)); llvm::Attributes::get(getLLVMContext(), B));

View File

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

View File

@ -968,7 +968,7 @@ void X86_32TargetCodeGenInfo::SetTargetAttributes(const Decl *D,
llvm::Function *Fn = cast<llvm::Function>(GV); llvm::Function *Fn = cast<llvm::Function>(GV);
// Now add the 'alignstack' attribute with a value of 16. // Now add the 'alignstack' attribute with a value of 16.
llvm::Attributes::Builder B; llvm::AttrBuilder B;
B.addStackAlignmentAttr(16); B.addStackAlignmentAttr(16);
Fn->addAttribute(llvm::AttrListPtr::FunctionIndex, Fn->addAttribute(llvm::AttrListPtr::FunctionIndex,
llvm::Attributes::get(CGM.getLLVMContext(), B)); llvm::Attributes::get(CGM.getLLVMContext(), B));