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

Misha Brukman brukman at cs.uiuc.edu
Wed Apr 28 10:31:05 PDT 2004


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.126 -> 1.127

---
Log message:

* Add ability to print out type as symbolic
* Add Module accessor to AssemblyWriter


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

Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.126 llvm/lib/VMCore/AsmWriter.cpp:1.127
--- llvm/lib/VMCore/AsmWriter.cpp:1.126	Thu Mar 11 23:53:14 2004
+++ llvm/lib/VMCore/AsmWriter.cpp	Wed Apr 28 10:31:21 2004
@@ -26,8 +26,9 @@
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/Module.h"
-#include "llvm/Analysis/SlotCalculator.h"
 #include "llvm/SymbolTable.h"
+#include "llvm/Analysis/SlotCalculator.h"
+#include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CFG.h"
 #include "Support/StringExtras.h"
 #include "Support/STLExtras.h"
@@ -474,6 +475,8 @@
 
   void writeOperand(const Value *Op, bool PrintType, bool PrintName = true);
 
+  const Module* getModule() { return TheModule; }
+
 private :
   void printModule(const Module *M);
   void printSymbolTable(const SymbolTable &ST);
@@ -1019,7 +1022,7 @@
   delete SC; delete AW;
   if (M) {
     SC = new SlotCalculator(M, false);
-    AW = new AssemblyWriter(Out, *SC, M, 0);
+    AW = new AssemblyWriter(*Out, *SC, M, 0);
   } else {
     SC = 0; AW = 0;
   }
@@ -1040,7 +1043,16 @@
   case Value::BasicBlockVal:     AW->write(cast<BasicBlock>(V)); break;
   case Value::FunctionVal:       AW->write(cast<Function>(V)); break;
   case Value::GlobalVariableVal: AW->write(cast<GlobalVariable>(V)); break;
-  default: Out << "<unknown value type: " << V->getValueType() << ">"; break;
+  default: *Out << "<unknown value type: " << V->getValueType() << ">"; break;
   }
   return *this;
+}
+
+CachedWriter& CachedWriter::operator<<(const Type *X) {
+  if (SymbolicTypes) {
+    const Module *M = AW->getModule();
+    if (M) WriteTypeSymbolic(*Out, X, M);
+    return *this;
+  } else
+    return *this << (const Value*)X;
 }





More information about the llvm-commits mailing list