diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-02-23 13:47:36 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-02-23 13:47:36 +0000 |
commit | d43f40df1c5cd844cfc1eb7d9924498fdb0321ab (patch) | |
tree | 73afc078d2a30c345c659c6bc489566876b3a63b /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 89c35fc44daf4b0a3608da50caaf8ec972565189 (diff) | |
download | bcm5719-llvm-d43f40df1c5cd844cfc1eb7d9924498fdb0321ab.tar.gz bcm5719-llvm-d43f40df1c5cd844cfc1eb7d9924498fdb0321ab.zip |
Support for the mno-stack-arg-probe flag
Adds support for this flag. There is also another piece for llvm
(separate review). More info:
https://bugs.llvm.org/show_bug.cgi?id=36221
By Ruslan Nikolaev!
Differential Revision: https://reviews.llvm.org/D43108
llvm-svn: 325901
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 4ca421bb863..aadbd3016bf 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -2351,16 +2351,15 @@ public: } }; -static void addStackProbeSizeTargetAttribute(const Decl *D, - llvm::GlobalValue *GV, - CodeGen::CodeGenModule &CGM) { - if (D && isa<FunctionDecl>(D)) { - if (CGM.getCodeGenOpts().StackProbeSize != 4096) { - llvm::Function *Fn = cast<llvm::Function>(GV); +static void addStackProbeTargetAttributes(const Decl *D, llvm::GlobalValue *GV, + CodeGen::CodeGenModule &CGM) { + if (llvm::Function *Fn = dyn_cast_or_null<llvm::Function>(GV)) { + if (CGM.getCodeGenOpts().StackProbeSize != 4096) Fn->addFnAttr("stack-probe-size", llvm::utostr(CGM.getCodeGenOpts().StackProbeSize)); - } + if (CGM.getCodeGenOpts().NoStackArgProbe) + Fn->addFnAttr("no-stack-arg-probe"); } } @@ -2369,7 +2368,7 @@ void WinX86_32TargetCodeGenInfo::setTargetAttributes( X86_32TargetCodeGenInfo::setTargetAttributes(D, GV, CGM); if (GV->isDeclaration()) return; - addStackProbeSizeTargetAttribute(D, GV, CGM); + addStackProbeTargetAttributes(D, GV, CGM); } class WinX86_64TargetCodeGenInfo : public TargetCodeGenInfo { @@ -2429,7 +2428,7 @@ void WinX86_64TargetCodeGenInfo::setTargetAttributes( } } - addStackProbeSizeTargetAttribute(D, GV, CGM); + addStackProbeTargetAttributes(D, GV, CGM); } } @@ -5622,7 +5621,7 @@ void WindowsARMTargetCodeGenInfo::setTargetAttributes( ARMTargetCodeGenInfo::setTargetAttributes(D, GV, CGM); if (GV->isDeclaration()) return; - addStackProbeSizeTargetAttribute(D, GV, CGM); + addStackProbeTargetAttributes(D, GV, CGM); } } |