[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Mar 5 01:38:17 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGPrinter.cpp updated: 1.30 -> 1.31
---
Log message:

print arbitrary constant pool entries


---
Diffs of the changes:  (+9 -0)

 SelectionDAGPrinter.cpp |    9 +++++++++
 1 files changed, 9 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.30 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.31
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.30	Tue Nov 29 20:04:11 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp	Sun Mar  5 03:38:03 2006
@@ -13,6 +13,7 @@
 
 #include "llvm/Constants.h"
 #include "llvm/Function.h"
+#include "llvm/Assembly/Writer.h"
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/Target/MRegisterInfo.h"
@@ -22,6 +23,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Config/config.h"
 #include <fstream>
+#include <sstream>
 using namespace llvm;
 
 namespace llvm {
@@ -81,6 +83,13 @@
   } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){
     if (ConstantFP *CFP = dyn_cast<ConstantFP>(CP->get()))
       Op += "<" + ftostr(CFP->getValue()) + ">";
+    else if (ConstantInt *CI = dyn_cast<ConstantInt>(CP->get()))
+      Op += "<" + utostr(CI->getZExtValue()) + ">";
+    else {
+      std::ostringstream SS;
+      WriteAsOperand(SS, CP->get(), false);
+      Op += "<" + SS.str() + ">";
+    }
   } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(Node)) {
     Op = "BB: ";
     const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();






More information about the llvm-commits mailing list