From 62ca32540f950d500227f1863b95cd08ad28099e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 23 Aug 2008 22:53:13 +0000 Subject: get MachineConstantPool off std::ostream, onto raw_ostream. It would be really nice if someone converted MachineFunction::print to raw_ostream. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55268 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp') diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index ea86c0d591..34a3101513 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -23,10 +23,10 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/GraphWriter.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Config/config.h" #include -#include using namespace llvm; namespace llvm { @@ -138,18 +138,24 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, Op += " " + itostr(JTDN->getIndex()); } else if (const ConstantPoolSDNode *CP = dyn_cast(Node)){ if (CP->isMachineConstantPoolEntry()) { - std::ostringstream SS; - CP->getMachineCPVal()->print(SS); - Op += "<" + SS.str() + ">"; + Op += '<'; + { + raw_string_ostream OSS(Op); + OSS << *CP->getMachineCPVal(); + } + Op += '>'; } else { if (ConstantFP *CFP = dyn_cast(CP->getConstVal())) Op += "<" + ftostr(CFP->getValueAPF()) + ">"; else if (ConstantInt *CI = dyn_cast(CP->getConstVal())) Op += "<" + utostr(CI->getZExtValue()) + ">"; else { - std::ostringstream SS; - WriteAsOperand(SS, CP->getConstVal(), false); - Op += "<" + SS.str() + ">"; + Op += '<'; + { + raw_string_ostream OSS(Op); + WriteAsOperand(OSS, CP->getConstVal(), false); + } + Op += '>'; } } } else if (const BasicBlockSDNode *BBDN = dyn_cast(Node)) { @@ -188,9 +194,10 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, Op += "(unknown)"; } else if (isa(V)) { // PseudoSourceValues don't have names, so use their print method. - std::ostringstream SS; - M->MO.getValue()->print(SS); - Op += SS.str(); + { + raw_string_ostream OSS(Op); + OSS << *M->MO.getValue(); + } } else { Op += V->getName(); } -- cgit v1.2.3