- std::string Op = Node->getOperationName(G);
-
- for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
- if (Node->getValueType(i) == MVT::Other)
- Op += ":ch";
- else
- Op = Op + ":" + MVT::getValueTypeString(Node->getValueType(i));
-
- if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(Node)) {
- Op += ": " + utostr(CSDN->getValue());
- } else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(Node)) {
- Op += ": " + ftostr(CSDN->getValue());
- } else if (const GlobalAddressSDNode *GADN =
- dyn_cast<GlobalAddressSDNode>(Node)) {
- int offset = GADN->getOffset();
- Op += ": " + GADN->getGlobal()->getName();
- if (offset > 0)
- Op += "+" + itostr(offset);
- else
- Op += itostr(offset);
- } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(Node)) {
- Op += " " + itostr(FIDN->getIndex());
- } else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(Node)) {
- Op += " " + itostr(JTDN->getIndex());
- } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){
- if (CP->isMachineConstantPoolEntry()) {
- std::ostringstream SS;
- CP->getMachineCPVal()->print(SS);
- Op += "<" + SS.str() + ">";
- } else {
- if (ConstantFP *CFP = dyn_cast<ConstantFP>(CP->getConstVal()))
- Op += "<" + ftostr(CFP->getValue()) + ">";
- else if (ConstantInt *CI = dyn_cast<ConstantInt>(CP->getConstVal()))
- Op += "<" + utostr(CI->getZExtValue()) + ">";
- else {
- std::ostringstream SS;
- WriteAsOperand(SS, CP->getConstVal(), false);
- Op += "<" + SS.str() + ">";
- }
- }
- } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(Node)) {
- Op = "BB: ";
- const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
- if (LBB)
- Op += LBB->getName();
- //Op += " " + (const void*)BBDN->getBasicBlock();
- } else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(Node)) {
- if (G && R->getReg() != 0 &&
- 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()) + "'";
- } else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(Node)) {
- if (M->getValue())
- Op += "<" + M->getValue()->getName() + ":" + itostr(M->getOffset()) + ">";
- else
- Op += "<null:" + itostr(M->getOffset()) + ">";
- } else if (const VTSDNode *N = dyn_cast<VTSDNode>(Node)) {
- Op = Op + " VT=" + MVT::getValueTypeString(N->getVT());
- } else if (const StringSDNode *N = dyn_cast<StringSDNode>(Node)) {
- Op = Op + "\"" + N->getValue() + "\"";
- } else if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(Node)) {
- bool doExt = true;
- switch (LD->getExtensionType()) {
- default: doExt = false; break;
- case ISD::EXTLOAD:
- Op = Op + "<anyext ";
- break;
- case ISD::SEXTLOAD:
- Op = Op + " <sext ";
- break;
- case ISD::ZEXTLOAD:
- Op = Op + " <zext ";
- break;
- }
- if (doExt)
- Op = Op + MVT::getValueTypeString(LD->getLoadedVT()) + ">";
-
- Op += LD->getIndexedModeName(LD->getAddressingMode());
- } else if (const StoreSDNode *ST = dyn_cast<StoreSDNode>(Node)) {
- if (ST->isTruncatingStore())
- Op = Op + "<trunc " + MVT::getValueTypeString(ST->getStoredVT()) + ">";
- Op += ST->getIndexedModeName(ST->getAddressingMode());
- }
-
- return Op;