OSDN Git Service

Allow the FP stackifier to completely ignore functions that do not use FP at
authorChris Lattner <sabre@nondot.org>
Sun, 23 Jan 2005 23:13:59 +0000 (23:13 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 23 Jan 2005 23:13:59 +0000 (23:13 +0000)
all.  This should speed up the X86 backend fairly significantly on integer
codes.  Now if only we didn't have to compute livevar still... ;-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19796 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86FloatingPoint.cpp

index 30763f0..899f7cd 100644 (file)
@@ -157,6 +157,21 @@ FunctionPass *llvm::createX86FloatingPointStackifierPass() { return new FPS(); }
 /// register references into FP stack references.
 ///
 bool FPS::runOnMachineFunction(MachineFunction &MF) {
+  // We only need to run this pass if there are any FP registers used in this
+  // function.  If it is all integer, there is nothing for us to do!
+  const bool *PhysRegsUsed = MF.getUsedPhysregs();
+  bool FPIsUsed = false;
+
+  assert(X86::FP6 == X86::FP0+6 && "Register enums aren't sorted right!");
+  for (unsigned i = 0; i <= 6; ++i)
+    if (PhysRegsUsed[X86::FP0+i]) {
+      FPIsUsed = true;
+      break;
+    }
+
+  // Early exit.
+  if (!FPIsUsed) return false;
+
   LV = &getAnalysis<LiveVariables>();
   StackTop = 0;