[llvm-commits] [llvm] r103990 - in /llvm/trunk/lib: CodeGen/SelectionDAG/SelectionDAGISel.cpp Target/TargetMachine.cpp

Bill Wendling isanbard at gmail.com
Mon May 17 16:09:50 PDT 2010


Author: void
Date: Mon May 17 18:09:50 2010
New Revision: 103990

URL: http://llvm.org/viewvc/llvm-project?rev=103990&view=rev
Log:
- Set the "HasCalls" flag after instruction selection is finished.

- Change the logic DisableFramePointerElim() to check for the
  -disable-non-leaf-fp-elim before -disable-fp-elim.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    llvm/trunk/lib/Target/TargetMachine.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=103990&r1=103989&r2=103990&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon May 17 18:09:50 2010
@@ -233,6 +233,24 @@
     }
   }
 
+  // Determine if there are any calls in this machine function.
+  MachineFrameInfo *MFI = MF->getFrameInfo();
+  if (!MFI->hasCalls()) {
+    for (MachineFunction::const_iterator
+           I = MF->begin(), E = MF->end(); I != E; ++I) {
+      const MachineBasicBlock *MBB = I;
+      for (MachineBasicBlock::const_iterator
+             II = MBB->begin(), IE = MBB->end(); II != IE; ++II) {
+        const TargetInstrDesc &TID = TM.getInstrInfo()->get(II->getOpcode());
+        if (II->isInlineAsm() || (TID.isCall() && !TID.isReturn())) {
+          MFI->setHasCalls(true);
+          goto done;
+        }
+      }
+    }
+  done:;
+  }
+
   // Release function-specific state. SDB and CurDAG are already cleared
   // at this point.
   FuncInfo->clear();
@@ -606,19 +624,6 @@
     delete Scheduler;
   }
 
-  // Determine if there are any calls in this machine function.
-  MachineFrameInfo *MFI = MF->getFrameInfo();
-  if (!MFI->hasCalls()) {
-    for (MachineBasicBlock::iterator
-           I = BB->begin(), E = BB->end(); I != E; ++I) {
-      const TargetInstrDesc &TID = TM.getInstrInfo()->get(I->getOpcode());
-      if (I->isInlineAsm() || (TID.isCall() && !TID.isReturn())) {
-        MFI->setHasCalls(true);
-        break;
-      }
-    }
-  }
-
   // Free the SelectionDAG state, now that we're finished with it.
   CurDAG->clear();
 
@@ -676,6 +681,7 @@
     
     CurDAG->setRoot(Dummy.getValue());
   }    
+
   DEBUG(errs() << "===== Instruction selection ends:\n");
 
   PostprocessISelDAG();

Modified: llvm/trunk/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=103990&r1=103989&r2=103990&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachine.cpp Mon May 17 18:09:50 2010
@@ -273,13 +273,14 @@
   /// DisableFramePointerElim - This returns true if frame pointer elimination
   /// optimization should be disabled for the given machine function.
   bool DisableFramePointerElim(const MachineFunction &MF) {
-    if (NoFramePointerElim)
-      return true;
+    // Check to see if we should eliminate non-leaf frame pointers and then
+    // check to see if we should eliminate all frame pointers.
     if (NoFramePointerElimNonLeaf) {
       const MachineFrameInfo *MFI = MF.getFrameInfo();
       return MFI->hasCalls();
     }
-    return false;
+
+    return NoFramePointerElim;
   }
 
   /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option





More information about the llvm-commits mailing list