Remove NoFramePointerElim and NoFramePointerElimOverride from TargetOptions and

remove ExecutionEngine's dependence on CodeGen. NFC.

This is a follow-up to r238080.

Differential Revision: http://reviews.llvm.org/D9830


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka
2015-05-26 20:17:20 +00:00
parent 2cc3e0a5ec
commit 6f49135066
7 changed files with 42 additions and 62 deletions

View File

@@ -229,8 +229,6 @@ JTableType("jump-table-type",
static inline TargetOptions InitTargetOptionsFromCodeGenFlags() {
TargetOptions Options;
Options.LessPreciseFPMADOption = EnableFPMAD;
Options.NoFramePointerElim = DisableFPElim;
Options.NoFramePointerElimOverride = DisableFPElim.getNumOccurrences() > 0;
Options.AllowFPOpFusion = FuseFPOps;
Options.UnsafeFPMath = EnableUnsafeFPMath;
Options.NoInfsFPMath = EnableNoInfsFPMath;
@@ -288,4 +286,31 @@ static inline std::string getFeaturesStr() {
return Features.getString();
}
/// \brief Set function attributes of functions in Module M based on CPU,
/// Features, and command line flags.
static inline void setFunctionAttributes(StringRef CPU, StringRef Features,
Module &M) {
for (auto &F : M) {
auto &Ctx = F.getContext();
AttributeSet Attrs = F.getAttributes(), NewAttrs;
if (!CPU.empty())
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
"target-cpu", CPU);
if (!Features.empty())
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
"target-features", Features);
if (DisableFPElim.getNumOccurrences() > 0)
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
"no-frame-pointer-elim",
DisableFPElim ? "true" : "false");
// Let NewAttrs override Attrs.
NewAttrs = Attrs.addAttributes(Ctx, AttributeSet::FunctionIndex, NewAttrs);
F.setAttributes(NewAttrs);
}
}
#endif

View File

@@ -60,8 +60,7 @@ namespace llvm {
class TargetOptions {
public:
TargetOptions()
: PrintMachineCode(false), NoFramePointerElim(false),
NoFramePointerElimOverride(false),
: PrintMachineCode(false),
LessPreciseFPMADOption(false), UnsafeFPMath(false),
NoInfsFPMath(false), NoNaNsFPMath(false),
HonorSignDependentRoundingFPMathOption(false),
@@ -81,14 +80,6 @@ namespace llvm {
/// output from the code generator.
unsigned PrintMachineCode : 1;
/// NoFramePointerElim - This flag is enabled when the -disable-fp-elim is
/// specified on the command line. If the target supports the frame pointer
/// elimination optimization, this option should disable it.
unsigned NoFramePointerElim : 1;
/// This flag is true when "disable-fp-elim" appeared on the command line.
unsigned NoFramePointerElimOverride : 1;
/// DisableFramePointerElim - This returns true if frame pointer elimination
/// optimization should be disabled for the given machine function.
bool DisableFramePointerElim(const MachineFunction &MF) const;
@@ -227,15 +218,6 @@ namespace llvm {
MCTargetOptions MCOptions;
};
/// \brief Set function attributes of functions in Module M based on CPU,
/// Features, and Options.
/// If AlwaysRecordAttrs is true, it will always record the function attributes
/// in Options regardless of whether those attributes were specified on the
/// tool's command line.
void setFunctionAttributes(StringRef CPU, StringRef Features,
const TargetOptions &Options, Module &M,
bool AlwaysRecordAttrs);
// Comparison operators: