[llvm-commits] CVS: llvm/lib/Target/X86/Printer.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Thu Jun 26 13:03:01 PDT 2003


Changes in directory llvm/lib/Target/X86:

Printer.cpp updated: 1.39 -> 1.40

---
Log message:

Number constants from constant pool as CPIf_i where f is the function index
and i is the constant pool index.


---
Diffs of the changes:

Index: llvm/lib/Target/X86/Printer.cpp
diff -u llvm/lib/Target/X86/Printer.cpp:1.39 llvm/lib/Target/X86/Printer.cpp:1.40
--- llvm/lib/Target/X86/Printer.cpp:1.39	Wed Jun 25 17:00:39 2003
+++ llvm/lib/Target/X86/Printer.cpp	Thu Jun 26 13:02:30 2003
@@ -24,16 +24,12 @@
 #include "llvm/Module.h"
 
 namespace {
-
-
+  unsigned fnIndex;
   std::set<const Value*> MangledGlobals;
   struct Printer : public MachineFunctionPass {
-
     std::ostream &O;
-    unsigned ConstIdx;
-    Printer(std::ostream &o) : O(o), ConstIdx(0) {}
+    Printer(std::ostream &o) : O(o) {}
     const TargetData *TD;
-
     virtual const char *getPassName() const {
       return "X86 Assembly Printer";
     }
@@ -393,11 +389,11 @@
 
   for (unsigned i = 0, e = CP.size(); i != e; ++i) {
     O << "\t.section .rodata\n";
-    O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType()) << "\n";
-    O << ".CPI" << i+ConstIdx << ":\t\t\t\t\t#" << *CP[i] << "\n";
+    O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType())
+      << "\n";
+    O << ".CPI" << fnIndex << "_" << i << ":\t\t\t\t\t#" << *CP[i] << "\n";
     printConstantValueOnly (CP[i]);
   }
-  ConstIdx += CP.size();  // Don't recycle constant pool index numbers
 }
 
 /// runOnMachineFunction - This uses the X86InstructionInfo::print method
@@ -438,6 +434,7 @@
     }
   }
 
+  fnIndex++;
   // We didn't modify anything.
   return false;
 }
@@ -515,7 +512,8 @@
     O << "]";
     return;
   } else if (MI->getOperand(Op).isConstantPoolIndex()) {
-    O << "[.CPI" << MI->getOperand(Op).getConstantPoolIndex();
+    O << "[.CPI" << fnIndex << "_"
+      << MI->getOperand(Op).getConstantPoolIndex();
     if (MI->getOperand(Op+3).getImmedValue())
       O << " + " << MI->getOperand(Op+3).getImmedValue();
     O << "]";
@@ -822,6 +820,9 @@
   // Tell gas we are outputting Intel syntax (not AT&T syntax) assembly,
   // with no % decorations on register names.
   O << "\t.intel_syntax noprefix\n";
+
+  // Start function index at 0
+  fnIndex = 0;
 
   // Ripped from CWriter:
   // Calculate which global values have names that will collide when we throw





More information about the llvm-commits mailing list