Added a hook to print out names of target specific DAG nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2005-12-20 06:22:03 +00:00
parent dae87b6536
commit 7226158d7e
5 changed files with 36 additions and 5 deletions

View File

@ -375,6 +375,10 @@ public:
/// implement this. The default implementation of this aborts.
virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
// getTargetNodeName() - This method returns the name of a target specific
// DAG node.
virtual const char *getTargetNodeName(unsigned Opcode) const;
//===--------------------------------------------------------------------===//
// Scheduler hooks
//

View File

@ -1835,15 +1835,18 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
if (getOpcode() < ISD::BUILTIN_OP_END)
return "<<Unknown DAG Node>>";
else {
if (G)
if (G) {
if (const TargetInstrInfo *TII = G->getTarget().getInstrInfo())
if (getOpcode()-ISD::BUILTIN_OP_END < TII->getNumOpcodes())
return TII->getName(getOpcode()-ISD::BUILTIN_OP_END);
std::string Name
= "<<Unknown Target Node:"
+ itostr((int)getOpcode()-ISD::BUILTIN_OP_END) + ">>";
return Name.c_str();
TargetLowering &TLI = G->getTargetLoweringInfo();
const char *Name =
TLI.getTargetNodeName(getOpcode());
if (Name) return Name;
}
return "<<Unknown Target Node>>";
}
case ISD::PCMARKER: return "PCMarker";

View File

@ -122,3 +122,6 @@ void TargetLowering::computeRegisterProperties() {
TransformToType[MVT::f64] = MVT::f64;
}
const char *TargetLowering::getTargetNodeName(unsigned Opcode) const {
return NULL;
}

View File

@ -970,3 +970,20 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
}
}
}
const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const {
switch (Opcode) {
default: return NULL;
case X86ISD::FILD64m: return "X86ISD::FILD64m";
case X86ISD::FP_TO_INT16_IN_MEM: return "X86ISD::FP_TO_INT16_IN_MEM";
case X86ISD::FP_TO_INT32_IN_MEM: return "X86ISD::FP_TO_INT32_IN_MEM";
case X86ISD::FP_TO_INT64_IN_MEM: return "X86ISD::FP_TO_INT64_IN_MEM";
case X86ISD::CALL: return "X86ISD::CALL";
case X86ISD::TAILCALL: return "X86ISD::TAILCALL";
case X86ISD::RDTSC_DAG: return "X86ISD::RDTSC_DAG";
case X86ISD::CMP: return "X86ISD::CMP";
case X86ISD::TEST: return "X86ISD::TEST";
case X86ISD::CMOV: return "X86ISD::CMOV";
case X86ISD::BRCOND: return "X86ISD::BRCOND";
}
}

View File

@ -123,6 +123,10 @@ namespace llvm {
LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth,
SelectionDAG &DAG);
/// getTargetNodeName - This method returns the name of a target specific
/// DAG node.
virtual const char *getTargetNodeName(unsigned Opcode) const;
SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
private: