[llvm-commits] [llvm] r46571 - in /llvm/trunk/lib: CodeGen/SelectionDAG/ScheduleDAG.cpp Target/X86/X86RegisterInfo.cpp

Evan Cheng evan.cheng at apple.com
Wed Jan 30 12:08:35 PST 2008


Author: evancheng
Date: Wed Jan 30 14:08:35 2008
New Revision: 46571

URL: http://llvm.org/viewvc/llvm-project?rev=46571&view=rev
Log:
Treat the label for the first @llvm.dbg.stoppoint the same way as the dbg_func_start label. Make sure nothing else is inserted before them.
Note this solution might be somewhat fragile since ISD::LABEL may be used for other
purposes. If that ends up to be an issue, we may need to introduce a different node
for debug labels.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
    llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=46571&r1=46570&r2=46571&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Jan 30 14:08:35 2008
@@ -716,16 +716,16 @@
       // If we are inserting a LABEL and this happens to be the first label in
       // the entry block, it is the "function start" label. Make sure there are
       // no other instructions before it.
-      bool SeenLabel = false;
+      unsigned NumLabels = 0;
       MachineBasicBlock::iterator MBBI = BB->begin();
       while (MBBI != BB->end()) {
         if (MBBI->getOpcode() == TargetInstrInfo::LABEL) {
-          SeenLabel = true;
-          break;
+          if (++NumLabels > 1)
+            break;
         }
         ++MBBI;
       }
-      if (!SeenLabel)
+      if (NumLabels <= 1)
         BB->insert(BB->begin(), MI);
       else
         BB->push_back(MI);

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46571&r1=46570&r2=46571&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Jan 30 14:08:35 2008
@@ -525,11 +525,15 @@
           X86FI->getCalleeSavedFrameSize() +(-TailCallReturnAddrDelta));
   uint64_t NumBytes = StackSize - X86FI->getCalleeSavedFrameSize();
 
-  // Skip over the label which mark the beginning of the function.
-  if (MMI && MMI->needsFrameInfo() &&
-      MBBI != MBB.end() &&
-      MBBI->getOpcode() == X86::LABEL)
+  // Skip over the labels which mark the beginning of the function.
+  if (MMI && MMI->needsFrameInfo()) {
+    unsigned NumLabels = 0;
+    while (NumLabels <= 1 &&
+           MBBI != MBB.end() && MBBI->getOpcode() == X86::LABEL) {
+      ++NumLabels;
       ++MBBI;
+    }
+  }
 
   // Insert stack pointer adjustment for later moving of return addr.  Only
   // applies to tail call optimized functions where the callee argument stack





More information about the llvm-commits mailing list