From: Bill Wendling Date: Wed, 10 Oct 2012 03:13:20 +0000 (+0000) Subject: Have 'addFnAttr' take the attribute enum value. Then have it build the attribute... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73e465e148e1fef84197388ca90e995edcdbedc5;p=platform%2Fupstream%2Fllvm.git Have 'addFnAttr' take the attribute enum value. Then have it build the attribute object and add it appropriately. No functionality change. llvm-svn: 165596 --- diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 84c43b8..6d36901 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -953,7 +953,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { // -fapple-kext must inline any call to this dtor into // the caller's body. if (getContext().getLangOpts().AppleKext) - CurFn->addFnAttr(llvm::Attribute::AlwaysInline); + CurFn->addFnAttr(llvm::Attributes::AlwaysInline); break; } diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 492b95a..77d91a3 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -229,7 +229,7 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM, Fn->setDoesNotThrow(); if (CGM.getLangOpts().AddressSanitizer) - Fn->addFnAttr(llvm::Attribute::AddressSafety); + Fn->addFnAttr(llvm::Attributes::AddressSafety); return Fn; } diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 2e4fa8a..cea9731 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -1705,7 +1705,7 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, f->setLinkage(llvm::Function::ExternalWeakLinkage); // set nonlazybind attribute for these APIs for performance. if (fnName == "objc_retain" || fnName == "objc_release") - f->addFnAttr(llvm::Attribute::NonLazyBind); + f->addFnAttr(llvm::Attributes::NonLazyBind); } return fn; diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 906a80c..8562d79 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -348,7 +348,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, for (FunctionDecl::redecl_iterator RI = FD->redecls_begin(), RE = FD->redecls_end(); RI != RE; ++RI) if (RI->isInlineSpecified()) { - Fn->addFnAttr(llvm::Attribute::InlineHint); + Fn->addFnAttr(llvm::Attributes::InlineHint); break; } @@ -485,7 +485,7 @@ static void TryMarkNoThrow(llvm::Function *F) { } else if (isa(&*BI)) { return; } - F->setDoesNotThrow(true); + F->setDoesNotThrow(); } void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8c57f4c..e64c756 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -565,25 +565,25 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, F->setHasUWTable(); if (!hasUnwindExceptions(LangOpts)) - F->addFnAttr(llvm::Attribute::NoUnwind); + F->addFnAttr(llvm::Attributes::NoUnwind); if (D->hasAttr()) { // Naked implies noinline: we should not be inlining such functions. - F->addFnAttr(llvm::Attribute::Naked); - F->addFnAttr(llvm::Attribute::NoInline); + F->addFnAttr(llvm::Attributes::Naked); + F->addFnAttr(llvm::Attributes::NoInline); } if (D->hasAttr()) - F->addFnAttr(llvm::Attribute::NoInline); + F->addFnAttr(llvm::Attributes::NoInline); // (noinline wins over always_inline, and we can't specify both in IR) if ((D->hasAttr() || D->hasAttr()) && !F->getFnAttributes().hasAttribute(llvm::Attributes::NoInline)) - F->addFnAttr(llvm::Attribute::AlwaysInline); + F->addFnAttr(llvm::Attributes::AlwaysInline); // FIXME: Communicate hot and cold attributes to LLVM more directly. if (D->hasAttr()) - F->addFnAttr(llvm::Attribute::OptimizeForSize); + F->addFnAttr(llvm::Attributes::OptimizeForSize); if (isa(D) || isa(D)) F->setUnnamedAddr(true); @@ -593,15 +593,15 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, F->setUnnamedAddr(true); if (LangOpts.getStackProtector() == LangOptions::SSPOn) - F->addFnAttr(llvm::Attribute::StackProtect); + F->addFnAttr(llvm::Attributes::StackProtect); else if (LangOpts.getStackProtector() == LangOptions::SSPReq) - F->addFnAttr(llvm::Attribute::StackProtectReq); + F->addFnAttr(llvm::Attributes::StackProtectReq); if (LangOpts.AddressSanitizer) { // When AddressSanitizer is enabled, set AddressSafety attribute // unless __attribute__((no_address_safety_analysis)) is used. if (!D->hasAttr()) - F->addFnAttr(llvm::Attribute::AddressSafety); + F->addFnAttr(llvm::Attributes::AddressSafety); } unsigned alignment = D->getMaxAlignment() / Context.getCharWidth(); @@ -1094,8 +1094,8 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, assert(F->getName() == MangledName && "name was uniqued!"); if (D.getDecl()) SetFunctionAttributes(D, F, IsIncompleteFunction); - if (ExtraAttrs != llvm::Attribute::None) - F->addFnAttr(ExtraAttrs); + if (ExtraAttrs.hasAttributes()) + F->addAttribute(~0, ExtraAttrs); // This is the first use or definition of a mangled name. If there is a // deferred decl with this name, remember that we need to emit it at the end diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 6fe0de3..8aa8b90 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -968,7 +968,8 @@ void X86_32TargetCodeGenInfo::SetTargetAttributes(const Decl *D, llvm::Function *Fn = cast(GV); // Now add the 'alignstack' attribute with a value of 16. - Fn->addFnAttr(llvm::Attributes::constructStackAlignmentFromInt(16)); + Fn->addAttribute(~0U, + llvm::Attributes::constructStackAlignmentFromInt(16)); } } } @@ -3252,7 +3253,7 @@ SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV, // OpenCL __kernel functions get a kernel calling convention F->setCallingConv(llvm::CallingConv::PTX_Kernel); // And kernel functions are not subject to inlining - F->addFnAttr(llvm::Attribute::NoInline); + F->addFnAttr(llvm::Attributes::NoInline); } } @@ -3368,7 +3369,7 @@ void MBlazeTargetCodeGenInfo::SetTargetAttributes(const Decl *D, F->setCallingConv(CC); // Step 2: Add attributes goodness. - F->addFnAttr(llvm::Attribute::NoInline); + F->addFnAttr(llvm::Attributes::NoInline); } // Step 3: Emit _interrupt_handler alias. @@ -3406,7 +3407,7 @@ void MSP430TargetCodeGenInfo::SetTargetAttributes(const Decl *D, F->setCallingConv(llvm::CallingConv::MSP430_INTR); // Step 2: Add attributes goodness. - F->addFnAttr(llvm::Attribute::NoInline); + F->addFnAttr(llvm::Attributes::NoInline); // Step 3: Emit ISR vector alias. unsigned Num = attr->getNumber() + 0xffe0; @@ -3763,7 +3764,7 @@ void TCETargetCodeGenInfo::SetTargetAttributes(const Decl *D, if (M.getLangOpts().OpenCL) { if (FD->hasAttr()) { // OpenCL C Kernel functions are not subject to inlining - F->addFnAttr(llvm::Attribute::NoInline); + F->addFnAttr(llvm::Attributes::NoInline); if (FD->hasAttr()) {