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

Andrew Lenharth alenhar2 at cs.uiuc.edu
Sun Sep 24 12:45:24 PDT 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.97 -> 1.98
---
Log message:

Add support for other relocation bases to jump tables, as well as custom asm directives

---
Diffs of the changes:  (+8 -3)

 AsmPrinter.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.97 llvm/lib/CodeGen/AsmPrinter.cpp:1.98
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.97	Mon Sep 18 13:00:18 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Sun Sep 24 14:44:59 2006
@@ -187,7 +187,10 @@
   // JTEntryDirective is a string to print sizeof(ptr) for non-PIC jump tables,
   // and 32 bits for PIC since PIC jump table entries are differences, not
   // pointers to blocks.
-  const char *JTEntryDirective = TAI->getData32bitsDirective();
+  // Use the architecture specific relocation directive, if it is set
+  const char *JTEntryDirective = TAI->getJumpTableDirective();
+  if (!JTEntryDirective)
+    JTEntryDirective = TAI->getData32bitsDirective();
   
   // Pick the directive to use to print the jump table entries, and switch to 
   // the appropriate section.
@@ -227,8 +230,10 @@
           << '_' << i << "_set_" << JTBBs[ii]->getNumber();
       } else if (TM.getRelocationModel() == Reloc::PIC_) {
         printBasicBlockLabel(JTBBs[ii], false, false);
-        O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
-          << getFunctionNumber() << '_' << i;
+	//If the arch uses custom Jump Table directives, don't calc relative to JT
+	if (!TAI->getJumpTableDirective()) 
+	  O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
+	    << getFunctionNumber() << '_' << i;
       } else {
         printBasicBlockLabel(JTBBs[ii], false, false);
       }






More information about the llvm-commits mailing list