Print physreg register nodes with target names (e.g. F1) instead of numbers

llvm-svn: 22934
This commit is contained in:
Chris Lattner 2005-08-19 21:21:16 +00:00
parent 78b200eb74
commit 4990335eb8
2 changed files with 12 additions and 2 deletions

View File

@ -2070,7 +2070,11 @@ void SDNode::dump(const SelectionDAG *G) const {
std::cerr << LBB->getName() << " ";
std::cerr << (const void*)BBDN->getBasicBlock() << ">";
} else if (const RegisterSDNode *C2V = dyn_cast<RegisterSDNode>(this)) {
std::cerr << " #" << C2V->getReg();
if (G && MRegisterInfo::isPhysicalRegister(R->getReg())) {
std::cerr << " " <<G->getTarget().getRegisterInfo()->getName(R->getReg());
} else {
std::cerr << " #" << R->getReg();
}
} else if (const ExternalSymbolSDNode *ES =
dyn_cast<ExternalSymbolSDNode>(this)) {
std::cerr << "'" << ES->getSymbol() << "'";

View File

@ -13,6 +13,8 @@
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Function.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/ADT/StringExtras.h"
@ -73,7 +75,11 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
Op += LBB->getName();
//Op += " " + (const void*)BBDN->getBasicBlock();
} else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(Node)) {
Op += " #" + utostr(R->getReg());
if (G && MRegisterInfo::isPhysicalRegister(R->getReg())) {
Op = Op + " " + G->getTarget().getRegisterInfo()->getName(R->getReg());
} else {
Op += " #" + utostr(R->getReg());
}
} else if (const ExternalSymbolSDNode *ES =
dyn_cast<ExternalSymbolSDNode>(Node)) {
Op += "'" + std::string(ES->getSymbol()) + "'";