X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSelectionDAG%2FSelectionDAGPrinter.cpp;h=db119a649549c0e42dd947410101b3ebfa451ad9;hb=edfba7e707a4f2f2e800843a7ef980c27d7f4eff;hp=73902b870b995a45df7c0ec682caf3e8c93a82af;hpb=713a98dee8ab07a3066d1707a07648d27dd0c19c;p=oota-llvm.git diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index 73902b870b9..db119a64954 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -18,7 +18,8 @@ #include "llvm/CodeGen/ScheduleDAG.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/Target/MRegisterInfo.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/GraphWriter.h" #include "llvm/ADT/StringExtras.h" @@ -48,7 +49,7 @@ namespace llvm { template static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { SDOperand Op = EI.getNode()->getOperand(EI.getOperand()); - MVT::ValueType VT = Op.getValueType(); + MVT VT = Op.getValueType(); if (VT == MVT::Flag) return "color=red,style=bold"; else if (VT == MVT::Other) @@ -90,7 +91,7 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, if (Node->getValueType(i) == MVT::Other) Op += ":ch"; else - Op = Op + ":" + MVT::getValueTypeString(Node->getValueType(i)); + Op = Op + ":" + Node->getValueType(i).getMVTString(); if (const ConstantSDNode *CSDN = dyn_cast(Node)) { Op += ": " + utostr(CSDN->getValue()); @@ -132,23 +133,36 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, //Op += " " + (const void*)BBDN->getBasicBlock(); } else if (const RegisterSDNode *R = dyn_cast(Node)) { if (G && R->getReg() != 0 && - MRegisterInfo::isPhysicalRegister(R->getReg())) { - Op = Op + " " + G->getTarget().getRegisterInfo()->getName(R->getReg()); + TargetRegisterInfo::isPhysicalRegister(R->getReg())) { + Op = Op + " " + + G->getTarget().getRegisterInfo()->getName(R->getReg()); } else { Op += " #" + utostr(R->getReg()); } + } else if (const DbgStopPointSDNode *D = dyn_cast(Node)) { + Op += ": " + D->getCompileUnit()->getFileName(); + Op += ":" + utostr(D->getLine()); + if (D->getColumn() != 0) + Op += ":" + utostr(D->getColumn()); + } else if (const LabelSDNode *L = dyn_cast(Node)) { + Op += ": LabelID=" + utostr(L->getLabelID()); } else if (const ExternalSymbolSDNode *ES = dyn_cast(Node)) { Op += "'" + std::string(ES->getSymbol()) + "'"; } else if (const SrcValueSDNode *M = dyn_cast(Node)) { if (M->getValue()) - Op += "<" + M->getValue()->getName() + ":" + itostr(M->getOffset()) + ">"; + Op += "<" + M->getValue()->getName() + ">"; else - Op += "getOffset()) + ">"; + Op += ""; + } else if (const MemOperandSDNode *M = dyn_cast(Node)) { + if (M->MO.getValue()) + Op += "<" + M->MO.getValue()->getName() + ":" + itostr(M->MO.getOffset()) + ">"; + else + Op += "MO.getOffset()) + ">"; + } else if (const ARG_FLAGSSDNode *N = dyn_cast(Node)) { + Op = Op + " AF=" + N->getArgFlags().getArgFlagsString(); } else if (const VTSDNode *N = dyn_cast(Node)) { - Op = Op + " VT=" + MVT::getValueTypeString(N->getVT()); - } else if (const StringSDNode *N = dyn_cast(Node)) { - Op = Op + "\"" + N->getValue() + "\""; + Op = Op + " VT=" + N->getVT().getMVTString(); } else if (const LoadSDNode *LD = dyn_cast(Node)) { bool doExt = true; switch (LD->getExtensionType()) { @@ -164,14 +178,25 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, break; } if (doExt) - Op = Op + MVT::getValueTypeString(LD->getLoadedVT()) + ">"; - + Op += LD->getMemoryVT().getMVTString() + ">"; + if (LD->isVolatile()) + Op += ""; Op += LD->getIndexedModeName(LD->getAddressingMode()); + if (LD->getAlignment() > 1) + Op += " A=" + utostr(LD->getAlignment()); } else if (const StoreSDNode *ST = dyn_cast(Node)) { if (ST->isTruncatingStore()) - Op = Op + "getStoredVT()) + ">"; + Op += "getMemoryVT().getMVTString() + ">"; + if (ST->isVolatile()) + Op += ""; Op += ST->getIndexedModeName(ST->getAddressingMode()); + if (ST->getAlignment() > 1) + Op += " A=" + utostr(ST->getAlignment()); } + +#if 0 + Op += " Id=" + itostr(Node->getNodeId()); +#endif return Op; } @@ -264,6 +289,8 @@ namespace llvm { /// edge, override this method. template static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { + if (EI.isSpecialDep()) + return "color=cyan,style=dashed"; if (EI.isCtrlDep()) return "color=blue,style=dashed"; return ""; @@ -280,8 +307,9 @@ namespace llvm { static void addCustomGraphFeatures(ScheduleDAG *G, GraphWriter &GW) { GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); - if (G->DAG.getRoot().Val) - GW.emitEdge(0, -1, G->SUnitMap[G->DAG.getRoot().Val], -1, ""); + const SDNode *N = G->DAG.getRoot().Val; + if (N && N->getNodeId() != -1) + GW.emitEdge(0, -1, &G->SUnits[N->getNodeId()], -1, ""); } }; } @@ -295,7 +323,10 @@ std::string DOTGraphTraits::getNodeLabel(const SUnit *SU, &G->DAG) + "\n"; } - Op += DOTGraphTraits::getNodeLabel(SU->Node, &G->DAG); + if (SU->Node) + Op += DOTGraphTraits::getNodeLabel(SU->Node, &G->DAG); + else + Op += ""; return Op; }