Enable thumb1 register scavenging by default.
authorJim Grosbach <grosbach@apple.com>
Wed, 7 Oct 2009 22:26:31 +0000 (22:26 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 7 Oct 2009 22:26:31 +0000 (22:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83496 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetRegisterInfo.h
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/PrologEpilogInserter.h

index e2a02fd2cb3c8049182c1f69bcbc635e92823993..390b95fbe2f479b911e677780c52e6915f0b0101 100644 (file)
@@ -561,6 +561,12 @@ public:
     return false;
   }
 
+  /// requiresFrameIndexScavenging - returns true if the target requires post
+  /// PEI scavenging of registers for materializing frame index constants.
+  virtual bool requiresFrameIndexScavenging(const MachineFunction &MF) const {
+    return false;
+  }
+
   /// hasFP - Return true if the specified function should have a dedicated
   /// frame pointer register. For most targets this is true only if the function
   /// has variable sized allocas or if frame pointer elimination is disabled.
index 55298a4ddedcf439bb1c0bf5a035154ef2d8fb27..896689cc1ecf0a2a84729d9bb3f6dfe02fdaff6e 100644 (file)
@@ -44,16 +44,6 @@ char PEI::ID = 0;
 static RegisterPass<PEI>
 X("prologepilog", "Prologue/Epilogue Insertion");
 
-// FIXME: For now, the frame index scavenging is off by default and only
-// used by the Thumb1 target. When it's the default and replaces the current
-// on-the-fly PEI scavenging for all targets, requiresRegisterScavenging()
-// will replace this.
-cl::opt<bool>
-FrameIndexVirtualScavenging("enable-frame-index-scavenging",
-                            cl::Hidden,
-                            cl::desc("Enable frame index elimination with"
-                                     "virtual register scavenging"));
-
 /// createPrologEpilogCodeInserter - This function returns a pass that inserts
 /// prolog and epilog code, and eliminates abstract frame references.
 ///
@@ -66,6 +56,7 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
   const Function* F = Fn.getFunction();
   const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo();
   RS = TRI->requiresRegisterScavenging(Fn) ? new RegScavenger() : NULL;
+  FrameIndexVirtualScavenging = TRI->requiresFrameIndexScavenging(Fn);
 
   // Get MachineModuleInfo so that we can track the construction of the
   // frame.
index ee759e8622cf0dd5f1b0e2df3e9488772b8b0025..030922a0265477a33a9549d4dc04148c8684e052 100644 (file)
@@ -95,6 +95,11 @@ namespace llvm {
     // functions.
     bool ShrinkWrapThisFunction;
 
+    // Flag to control whether to use the register scavenger to resolve
+    // frame index materialization registers. Set according to
+    // TRI->requiresFrameIndexScavenging() for the curren function.
+    bool FrameIndexVirtualScavenging;
+
     // When using the scavenger post-pass to resolve frame reference
     // materialization registers, maintain a map of the registers to
     // the constant value and SP adjustment associated with it.