Implement the 'optnone' attribute, which suppresses most optimizations
on a function. llvm-svn: 205255
This commit is contained in:
@@ -660,6 +660,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
||||
// Naked implies noinline: we should not be inlining such functions.
|
||||
B.addAttribute(llvm::Attribute::Naked);
|
||||
B.addAttribute(llvm::Attribute::NoInline);
|
||||
} else if (D->hasAttr<OptimizeNoneAttr>()) {
|
||||
// OptimizeNone implies noinline; we should not be inlining such functions.
|
||||
B.addAttribute(llvm::Attribute::OptimizeNone);
|
||||
B.addAttribute(llvm::Attribute::NoInline);
|
||||
} else if (D->hasAttr<NoDuplicateAttr>()) {
|
||||
B.addAttribute(llvm::Attribute::NoDuplicate);
|
||||
} else if (D->hasAttr<NoInlineAttr>()) {
|
||||
@@ -679,6 +683,12 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
||||
if (D->hasAttr<MinSizeAttr>())
|
||||
B.addAttribute(llvm::Attribute::MinSize);
|
||||
|
||||
if (D->hasAttr<OptimizeNoneAttr>()) {
|
||||
// OptimizeNone wins over OptimizeForSize and MinSize.
|
||||
B.removeAttribute(llvm::Attribute::OptimizeForSize);
|
||||
B.removeAttribute(llvm::Attribute::MinSize);
|
||||
}
|
||||
|
||||
if (LangOpts.getStackProtector() == LangOptions::SSPOn)
|
||||
B.addAttribute(llvm::Attribute::StackProtect);
|
||||
else if (LangOpts.getStackProtector() == LangOptions::SSPStrong)
|
||||
|
||||
Reference in New Issue
Block a user