[llvm-commits] [llvm] r94517 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Mon Jan 25 21:10:15 PST 2010


Author: lattner
Date: Mon Jan 25 23:10:10 2010
New Revision: 94517

URL: http://llvm.org/viewvc/llvm-project?rev=94517&view=rev
Log:
rename printPICJumpTableEntry -> EmitJumpTableEntry,
make it private and non-virtual.  It handles the non-pic
case too, so just use it, simplifying EmitJumpTableInfo.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=94517&r1=94516&r2=94517&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Jan 25 23:10:10 2010
@@ -352,9 +352,6 @@
     /// specified MachineBasicBlock for a jumptable entry.
     virtual void printPICJumpTableSetLabel(unsigned uid,
                                            const MachineBasicBlock *MBB) const;
-    virtual void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
-                                        const MachineBasicBlock *MBB,
-                                        unsigned uid) const;
     
     /// printVisibility - This prints visibility information about symbol, if
     /// this is suported by the target.
@@ -364,6 +361,9 @@
     void printOffset(int64_t Offset) const;
  
   private:
+    void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
+                            const MachineBasicBlock *MBB,
+                            unsigned uid) const;
     void EmitLLVMUsedList(Constant *List);
     void EmitXXStructorList(Constant *List);
     GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=94517&r1=94516&r2=94517&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jan 25 23:10:10 2010
@@ -503,7 +503,6 @@
     JTInDiffSection = true;
   }
 
-  unsigned EntrySize = MJTI->getEntrySize(*TM.getTargetData());
   EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
   
   for (unsigned i = 0, e = JT.size(); i != e; ++i) {
@@ -530,28 +529,20 @@
 
     OutStreamer.EmitLabel(GetJTISymbol(i));
 
-    if (!IsPic) {
-      // In non-pic mode, the entries in the jump table are direct references
-      // to the basic blocks.
-      for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
-        MCSymbol *MBBSym = JTBBs[ii]->getSymbol(OutContext);
-        OutStreamer.EmitValue(MCSymbolRefExpr::Create(MBBSym, OutContext),
-                              EntrySize, /*addrspace*/0);
-      }      
-    } else {
-      for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
-        printPICJumpTableEntry(MJTI, JTBBs[ii], i);
-    }
+    for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
+      EmitJumpTableEntry(MJTI, JTBBs[ii], i);
   }
 }
 
-void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
-                                        const MachineBasicBlock *MBB,
-                                        unsigned uid) const {
+/// EmitJumpTableEntry - Emit a jump table entry for the specified MBB to the
+/// current stream.
+void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
+                                    const MachineBasicBlock *MBB,
+                                    unsigned UID) const {
   const MCExpr *Value = 0;
   switch (MJTI->getEntryKind()) {
   case MachineJumpTableInfo::EK_Custom32:
-    Value = TM.getTargetLowering()->LowerCustomJumpTableEntry(MJTI, MBB, uid,
+    Value = TM.getTargetLowering()->LowerCustomJumpTableEntry(MJTI, MBB, UID,
                                                               OutContext);
     break;
   case MachineJumpTableInfo::EK_BlockAddress:
@@ -582,13 +573,13 @@
     // emit the table entries as differences between two text section labels.
     if (MAI->getSetDirective()) {
       // If we used .set, reference the .set's symbol.
-      Value = MCSymbolRefExpr::Create(GetJTSetSymbol(uid, MBB->getNumber()),
+      Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
                                       OutContext);
       break;
     }
     // Otherwise, use the difference as the jump table entry.
     Value = MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext);
-    const MCExpr *JTI = MCSymbolRefExpr::Create(GetJTISymbol(uid), OutContext);
+    const MCExpr *JTI = MCSymbolRefExpr::Create(GetJTISymbol(UID), OutContext);
     Value = MCBinaryExpr::CreateSub(Value, JTI, OutContext);
     break;
   }





More information about the llvm-commits mailing list