diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 12:58:58 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 12:58:58 +0000 |
| commit | 64717bbc14f1a0a1a3a0b6fdbfb5676a2e9a2cf2 (patch) | |
| tree | e2a6c92a1b374eaa30315008bd7cad99dc086fe2 /llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp | |
| parent | e10f69a8a768b07dfd491b206e9d55b191eed178 (diff) | |
| download | bcm5719-llvm-64717bbc14f1a0a1a3a0b6fdbfb5676a2e9a2cf2.tar.gz bcm5719-llvm-64717bbc14f1a0a1a3a0b6fdbfb5676a2e9a2cf2.zip | |
Clearify the usage and add some debug stuff
llvm-svn: 70700
Diffstat (limited to 'llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp')
| -rw-r--r-- | llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp index 922e42e3d08..0ad8752e88f 100644 --- a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp +++ b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp @@ -57,6 +57,10 @@ namespace { private: SDNode *Select(SDValue Op); + + #ifndef NDEBUG + unsigned Indent; + #endif }; } // end anonymous namespace @@ -79,5 +83,49 @@ void MSP430DAGToDAGISel::InstructionSelect() { } SDNode *MSP430DAGToDAGISel::Select(SDValue Op) { - return SelectCode(Op); + SDNode *Node = Op.getNode(); + + // Dump information about the Node being selected + #ifndef NDEBUG + DOUT << std::string(Indent, ' ') << "Selecting: "; + DEBUG(Node->dump(CurDAG)); + DOUT << "\n"; + Indent += 2; + #endif + + // If we have a custom node, we already have selected! + if (Node->isMachineOpcode()) { + #ifndef NDEBUG + DOUT << std::string(Indent-2, ' ') << "== "; + DEBUG(Node->dump(CurDAG)); + DOUT << "\n"; + Indent -= 2; + #endif + return NULL; + } + + // Instruction Selection not handled by the auto-generated tablegen selection + // should be handled here. + // Something like this: + // unsigned Opcode = Node->getOpcode(); + // switch (Opcode) { + // default: break; + // case ISD::Foo: + // return SelectFoo(Node) + // } + + // Select the default instruction + SDNode *ResNode = SelectCode(Op); + + #ifndef NDEBUG + DOUT << std::string(Indent-2, ' ') << "=> "; + if (ResNode == NULL || ResNode == Op.getNode()) + DEBUG(Op.getNode()->dump(CurDAG)); + else + DEBUG(ResNode->dump(CurDAG)); + DOUT << "\n"; + Indent -= 2; + #endif + + return ResNode; } |

