From c610e62e46e9c6e0c9714fc9d58f40d14900ebd2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 5 Mar 2006 09:38:03 +0000 Subject: [PATCH] print arbitrary constant pool entries llvm-svn: 26545 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index 61e4e0212420..0638807af7a4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -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 +#include using namespace llvm; namespace llvm { @@ -81,6 +83,13 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, } else if (const ConstantPoolSDNode *CP = dyn_cast(Node)){ if (ConstantFP *CFP = dyn_cast(CP->get())) Op += "<" + ftostr(CFP->getValue()) + ">"; + else if (ConstantInt *CI = dyn_cast(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(Node)) { Op = "BB: "; const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();