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". 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka
2015-05-23 01:14:08 +00:00
parent c17da7166d
commit 01461204b3
15 changed files with 112 additions and 38 deletions

View File

@@ -179,9 +179,16 @@ LLVMBool LLVMCreateMCJITCompilerForModule(
TargetOptions targetOptions;
targetOptions.NoFramePointerElim = options.NoFramePointerElim;
targetOptions.EnableFastISel = options.EnableFastISel;
std::unique_ptr<Module> Mod(unwrap(M));
if (Mod)
// Set function attribute "no-frame-pointer-elim" based on
// NoFramePointerElim.
setFunctionAttributes(/* CPU */ "", /* Features */ "", targetOptions, *Mod,
/* AlwaysRecordAttrs */ true);
std::string Error;
EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
EngineBuilder builder(std::move(Mod));
builder.setEngineKind(EngineKind::JIT)
.setErrorStr(&Error)
.setOptLevel((CodeGenOpt::Level)options.OptLevel)