diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2015-05-23 01:14:08 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2015-05-23 01:14:08 +0000 |
commit | ddf76aa36fdd48e4c8bad9cb069cc5588e0ed149 (patch) | |
tree | d9a432cf75b8f65bc27c3c6b8d3f11330a6a2f47 /llvm/tools/opt/opt.cpp | |
parent | bd881834c5eeb75f1e5cd8a0d56c25dfe122daa5 (diff) | |
download | bcm5719-llvm-ddf76aa36fdd48e4c8bad9cb069cc5588e0ed149.tar.gz bcm5719-llvm-ddf76aa36fdd48e4c8bad9cb069cc5588e0ed149.zip |
Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.
This is part of the work to remove TargetMachine::resetTargetOptions.
In this patch, instead of updating global variable NoFramePointerElim in
resetTargetOptions, its use in DisableFramePointerElim is replaced with a call
to TargetFrameLowering::noFramePointerElim. This function determines on a
per-function basis if frame pointer elimination should be disabled.
There is no change in functionality except that cl:opt option "disable-fp-elim"
can now override function attribute "no-frame-pointer-elim".
llvm-svn: 238080
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r-- | llvm/tools/opt/opt.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 15b24cf5072..6f3d8ca4156 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -265,7 +265,8 @@ static CodeGenOpt::Level GetCodeGenOptLevel() { // Returns the TargetMachine instance or zero if no triple is provided. static TargetMachine* GetTargetMachine(Triple TheTriple, StringRef CPUStr, - StringRef FeaturesStr) { + StringRef FeaturesStr, + const TargetOptions &Options) { std::string Error; const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple, Error); @@ -275,8 +276,7 @@ static TargetMachine* GetTargetMachine(Triple TheTriple, StringRef CPUStr, } return TheTarget->createTargetMachine(TheTriple.getTriple(), - CPUStr, FeaturesStr, - InitTargetOptionsFromCodeGenFlags(), + CPUStr, FeaturesStr, Options, RelocModel, CMModel, GetCodeGenOptLevel()); } @@ -386,17 +386,21 @@ int main(int argc, char **argv) { Triple ModuleTriple(M->getTargetTriple()); std::string CPUStr, FeaturesStr; TargetMachine *Machine = nullptr; + const TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); if (ModuleTriple.getArch()) { CPUStr = getCPUStr(); FeaturesStr = getFeaturesStr(); - Machine = GetTargetMachine(ModuleTriple, CPUStr, FeaturesStr); + Machine = GetTargetMachine(ModuleTriple, CPUStr, FeaturesStr, Options); } std::unique_ptr<TargetMachine> TM(Machine); - // Override function attributes based on CPUStr and FeaturesStr. - setFunctionAttributes(CPUStr, FeaturesStr, *M); + // Override function attributes based on CPUStr, FeaturesStr, and Options. + // Pass AlwaysRecordAttrs=false as we want to override an attribute only when + // the corresponding cl::opt has been provided on opt's command line. + setFunctionAttributes(CPUStr, FeaturesStr, Options, *M, + /* AlwaysRecordAttrs */ false); // If the output is set to be emitted to standard out, and standard out is a // console, print out a warning message and refuse to do it. We don't |