Move resetTargetOptions from taking a MachineFunction to a Function
authorEric Christopher <echristo@gmail.com>
Fri, 26 Sep 2014 01:28:10 +0000 (01:28 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 26 Sep 2014 01:28:10 +0000 (01:28 +0000)
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
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Target/TargetMachine.cpp

index fc82dfa869f7e6529046c5e25202c76b37a5ddc3..82260c0d7c5fa736c50fd4c7ca53408f794722e3 100644 (file)
@@ -114,7 +114,7 @@ public:
   }
 
   /// \brief Reset the target options based on the function's attributes.
   }
 
   /// \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.
   ///
 
   /// getMCAsmInfo - Return target specific asm information.
   ///
index 32b327f7d6b73d6cd6857296ad0d1fd99ca85ed2..4ef3e6f94f593cefdff8a828fafea73712d3217a 100644 (file)
@@ -421,7 +421,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
   LibInfo = &getAnalysis<TargetLibraryInfo>();
   GFI = Fn.hasGC() ? &getAnalysis<GCModuleInfo>().getFunctionInfo(Fn) : nullptr;
 
   LibInfo = &getAnalysis<TargetLibraryInfo>();
   GFI = Fn.hasGC() ? &getAnalysis<GCModuleInfo>().getFunctionInfo(Fn) : nullptr;
 
-  TM.resetTargetOptions(MF);
+  TM.resetTargetOptions(Fn);
 
   // Reset OptLevel to None for optnone functions.
   CodeGenOpt::Level NewOptLevel = OptLevel;
 
   // Reset OptLevel to None for optnone functions.
   CodeGenOpt::Level NewOptLevel = OptLevel;
index dcb833846939f6e1db79aaa26eacf5fb69dea9c8..309e1bf2786db8796bbbf360f30d8683a9aad9b1 100644 (file)
@@ -48,17 +48,13 @@ TargetMachine::~TargetMachine() {
 }
 
 /// \brief Reset the target options based on the function's attributes.
 }
 
 /// \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");
   } 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");
 
   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
 }
 
 /// getRelocationModel - Returns the code generation relocation model. The