[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jan 18 15:04:02 PST 2004


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.114 -> 1.115

---
Log message:

Eliminate special case handling for CPR's
Fix some problem cases where I was building the slot calculator in bytecode
writer mode instead of asmwriter mode.


---
Diffs of the changes:  (+6 -17)

Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.114 llvm/lib/VMCore/AsmWriter.cpp:1.115
--- llvm/lib/VMCore/AsmWriter.cpp:1.114	Tue Jan 13 20:49:34 2004
+++ llvm/lib/VMCore/AsmWriter.cpp	Sun Jan 18 15:03:06 2004
@@ -368,18 +368,7 @@
     Out << "null";
 
   } else if (const ConstantPointerRef *PR = dyn_cast<ConstantPointerRef>(CV)) {
-    const GlobalValue *V = PR->getValue();
-    if (V->hasName()) {
-      Out << getLLVMName(V->getName());
-    } else if (Table) {
-      int Slot = Table->getSlot(V);
-      if (Slot >= 0)
-        Out << "%" << Slot;
-      else
-        Out << "<pointer reference badref>";
-    } else {
-      Out << "<pointer reference without context info>";
-    }
+    WriteAsOperandInternal(Out, PR->getValue(), true, TypeTable, Table);
 
   } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
     Out << CE->getOpcodeName() << " (";
@@ -969,26 +958,26 @@
 //===----------------------------------------------------------------------===//
 
 void Module::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
-  SlotCalculator SlotTable(this, true);
+  SlotCalculator SlotTable(this, false);
   AssemblyWriter W(o, SlotTable, this, AAW);
   W.write(this);
 }
 
 void GlobalVariable::print(std::ostream &o) const {
-  SlotCalculator SlotTable(getParent(), true);
+  SlotCalculator SlotTable(getParent(), false);
   AssemblyWriter W(o, SlotTable, getParent(), 0);
   W.write(this);
 }
 
 void Function::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
-  SlotCalculator SlotTable(getParent(), true);
+  SlotCalculator SlotTable(getParent(), false);
   AssemblyWriter W(o, SlotTable, getParent(), AAW);
 
   W.write(this);
 }
 
 void BasicBlock::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
-  SlotCalculator SlotTable(getParent(), true);
+  SlotCalculator SlotTable(getParent(), false);
   AssemblyWriter W(o, SlotTable, 
                    getParent() ? getParent()->getParent() : 0, AAW);
   W.write(this);
@@ -996,7 +985,7 @@
 
 void Instruction::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
   const Function *F = getParent() ? getParent()->getParent() : 0;
-  SlotCalculator SlotTable(F, true);
+  SlotCalculator SlotTable(F, false);
   AssemblyWriter W(o, SlotTable, F ? F->getParent() : 0, AAW);
 
   W.write(this);





More information about the llvm-commits mailing list