From a6e0a6e729f44c155ee1f6c9c70adda132f3c527 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 26 Sep 2014 01:28:10 +0000 Subject: [PATCH 1/1] Move resetTargetOptions from taking a MachineFunction to a Function since we are accessing the TargetMachine that we're a member function of. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218489 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetMachine.h | 2 +- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 +- lib/Target/TargetMachine.cpp | 20 ++++++++----------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index fc82dfa869f..82260c0d7c5 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -114,7 +114,7 @@ public: } /// \brief Reset the target options based on the function's attributes. - void resetTargetOptions(const MachineFunction *MF) const; + void resetTargetOptions(const Function &F) const; /// getMCAsmInfo - Return target specific asm information. /// diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 32b327f7d6b..4ef3e6f94f5 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -421,7 +421,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) { LibInfo = &getAnalysis(); GFI = Fn.hasGC() ? &getAnalysis().getFunctionInfo(Fn) : nullptr; - TM.resetTargetOptions(MF); + TM.resetTargetOptions(Fn); // Reset OptLevel to None for optnone functions. CodeGenOpt::Level NewOptLevel = OptLevel; diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index dcb83384693..309e1bf2786 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -48,17 +48,13 @@ TargetMachine::~TargetMachine() { } /// \brief Reset the target options based on the function's attributes. -void TargetMachine::resetTargetOptions(const MachineFunction *MF) const { - const Function *F = MF->getFunction(); - TargetOptions &TO = MF->getTarget().Options; - -#define RESET_OPTION(X, Y) \ - do { \ - if (F->hasFnAttribute(Y)) \ - TO.X = \ - (F->getAttributes(). \ - getAttribute(AttributeSet::FunctionIndex, \ - Y).getValueAsString() == "true"); \ +void TargetMachine::resetTargetOptions(const Function &F) const { +#define RESET_OPTION(X, Y) \ + do { \ + if (F.hasFnAttribute(Y)) \ + Options.X = (F.getAttributes() \ + .getAttribute(AttributeSet::FunctionIndex, Y) \ + .getValueAsString() == "true"); \ } while (0) RESET_OPTION(NoFramePointerElim, "no-frame-pointer-elim"); @@ -69,7 +65,7 @@ void TargetMachine::resetTargetOptions(const MachineFunction *MF) const { RESET_OPTION(UseSoftFloat, "use-soft-float"); RESET_OPTION(DisableTailCalls, "disable-tail-calls"); - TO.MCOptions.SanitizeAddress = F->hasFnAttribute(Attribute::SanitizeAddress); + Options.MCOptions.SanitizeAddress = F.hasFnAttribute(Attribute::SanitizeAddress); } /// getRelocationModel - Returns the code generation relocation model. The -- 2.34.1