Code cleanups, per review
authorNate Begeman <natebegeman@mac.com>
Thu, 27 Jul 2006 16:46:58 +0000 (16:46 +0000)
committerNate Begeman <natebegeman@mac.com>
Thu, 27 Jul 2006 16:46:58 +0000 (16:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29347 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index a0f377c63fc6ceef09759bde5404ceac97a8dd05..489d3414de0eb6a65e0914048cbaf25f7e4b81c9 100644 (file)
@@ -210,7 +210,11 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) {
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   if (JT.empty()) return;
   const TargetData *TD = TM.getTargetData();
-  const char *PtrDataDirective = Data32bitsDirective;
+  
+  // 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 = Data32bitsDirective;
   
   // Pick the directive to use to print the jump table entries, and switch to 
   // the appropriate section.
@@ -219,7 +223,7 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) {
   } else {
     SwitchToDataSection(JumpTableDataSection, 0);
     if (TD->getPointerSize() == 8)
-      PtrDataDirective = Data64bitsDirective;
+      JTEntryDirective = Data64bitsDirective;
   }
   EmitAlignment(Log2_32(TD->getPointerAlignment()));
   
@@ -228,7 +232,7 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) {
       << ":\n";
     const std::vector<MachineBasicBlock*> &JTBBs = JT[i].MBBs;
     for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
-      O << PtrDataDirective << ' ';
+      O << JTEntryDirective << ' ';
       printBasicBlockLabel(JTBBs[ii], false, false);
       if (TM.getRelocationModel() == Reloc::PIC_) {
         O << '-' << PrivateGlobalPrefix << "JTI" << getFunctionNumber() 
index 76510f36c4b3b323c59f141b1274731e632951e5..f3c9802ba06438a89c6bd03e307b9e47cdbd0d63 100644 (file)
@@ -914,8 +914,6 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) {
     double Density = (double)Cases.size() / (double)((Last - First) + 1ULL);
     
     if (Density >= 0.3125) {
-      Reloc::Model Relocs = TLI.getTargetMachine().getRelocationModel();
-      
       // Create a new basic block to hold the code for loading the address
       // of the jump table, and jumping to it.  Update successor information;
       // we will either branch to the default case for the switch, or the jump