[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Wed Jan 17 17:13:14 PST 2007



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.136 -> 1.137
---
Log message:

add new JumpTableSpecialLabelPrefix hook to asmprinter for jumptable emission.


---
Diffs of the changes:  (+9 -1)

 AsmPrinter.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.136 llvm/lib/CodeGen/AsmPrinter.cpp:1.137
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.136	Mon Jan 15 21:42:04 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Wed Jan 17 19:12:56 2007
@@ -244,6 +244,13 @@
         if (EmittedSets.insert(JTBBs[ii]).second)
           printSetLabel(i, JTBBs[ii]);
     
+    // On some targets (e.g. darwin) we want to emit two consequtive labels
+    // before each jump table.  The first label is never referenced, but tells
+    // the assembler and linker the extents of the jump table object.  The
+    // second label is actually referenced by the code.
+    if (const char *JTLabelPrefix = TAI->getJumpTableSpecialLabelPrefix())
+      O << JTLabelPrefix << "JTI" << getFunctionNumber() << '_' << i << ":\n";
+    
     O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() 
       << '_' << i << ":\n";
     
@@ -259,7 +266,8 @@
           << '_' << i << "_set_" << JTBBs[ii]->getNumber();
       } else if (IsPic) {
         printBasicBlockLabel(JTBBs[ii], false, false);
-        //If the arch uses custom Jump Table directives, don't calc relative to JT
+        // If the arch uses custom Jump Table directives, don't calc relative to
+        // JT
         if (!HadJTEntryDirective) 
           O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
             << getFunctionNumber() << '_' << i;






More information about the llvm-commits mailing list