[SelectionDAGISel] Add a debug print before call to Select. Adjust where blank lines are printed during isel process to make things more sensibly grouped.

Previously some targets printed their own message at the start of Select to indicate what they were selecting. For the targets that didn't, it means there was no print of the root node before any custom handling in the target executed. So if the target did something custom and never called SelectNodeCommon, no print would be made. For the targets that did print a message in Select, if they didn't custom handle a node SelectNodeCommon would reprint the root node before walking the isel table.

It seems better to just print the message before the call to Select so all targets behave the same. And then remove the root node printing from SelectNodeCommon and just leave a message that says we're starting the table search.

There were also some oddities in blank line behavior. Usually due to a \n after a call to SelectionDAGNode::dump which already inserted a new line.

llvm-svn: 323551
This commit is contained in:
Craig Topper 2018-01-26 19:34:20 +00:00
parent b207dd6870
commit 8f324bb1a4
12 changed files with 5 additions and 44 deletions

View File

@ -985,13 +985,16 @@ void SelectionDAGISel::DoInstructionSelection() {
if (Node->isStrictFPOpcode()) if (Node->isStrictFPOpcode())
Node = CurDAG->mutateStrictFPToFP(Node); Node = CurDAG->mutateStrictFPToFP(Node);
DEBUG(dbgs() << "\nISEL: Starting selection on root node: ";
Node->dump(CurDAG));
Select(Node); Select(Node);
} }
CurDAG->setRoot(Dummy.getValue()); CurDAG->setRoot(Dummy.getValue());
} }
DEBUG(dbgs() << "===== Instruction selection ends:\n"); DEBUG(dbgs() << "\n===== Instruction selection ends:\n");
PostprocessISelDAG(); PostprocessISelDAG();
} }
@ -2988,9 +2991,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
// update the chain results when the pattern is complete. // update the chain results when the pattern is complete.
SmallVector<SDNode*, 3> ChainNodesMatched; SmallVector<SDNode*, 3> ChainNodesMatched;
DEBUG(dbgs() << "ISEL: Starting pattern match on root node: "; DEBUG(dbgs() << "ISEL: Starting pattern match\n");
NodeToMatch->dump(CurDAG);
dbgs() << '\n');
// Determine where to start the interpreter. Normally we start at opcode #0, // Determine where to start the interpreter. Normally we start at opcode #0,
// but if the state machine starts with an OPC_SwitchOpcode, then we // but if the state machine starts with an OPC_SwitchOpcode, then we
@ -3665,8 +3666,6 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
<< (IsMorphNodeTo ? "Morphed" : "Created") << (IsMorphNodeTo ? "Morphed" : "Created")
<< " node: "; << " node: ";
Res->dump(CurDAG); Res->dump(CurDAG);
dbgs() << '\n';
); );
// If this was a MorphNodeTo then we're completely done! // If this was a MorphNodeTo then we're completely done!

View File

@ -2653,11 +2653,6 @@ bool AArch64DAGToDAGISel::SelectCMP_SWAP(SDNode *N) {
} }
void AArch64DAGToDAGISel::Select(SDNode *Node) { void AArch64DAGToDAGISel::Select(SDNode *Node) {
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: ");
DEBUG(Node->dump(CurDAG));
DEBUG(errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

View File

@ -519,9 +519,6 @@ bool AVRDAGToDAGISel::selectMultiplication(llvm::SDNode *N) {
} }
void AVRDAGToDAGISel::Select(SDNode *N) { void AVRDAGToDAGISel::Select(SDNode *N) {
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: "; N->dump(CurDAG); errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (N->isMachineOpcode()) { if (N->isMachineOpcode()) {
DEBUG(errs() << "== "; N->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; N->dump(CurDAG); errs() << "\n");

View File

@ -176,9 +176,6 @@ bool BPFDAGToDAGISel::SelectInlineAsmMemoryOperand(
void BPFDAGToDAGISel::Select(SDNode *Node) { void BPFDAGToDAGISel::Select(SDNode *Node) {
unsigned Opcode = Node->getOpcode(); unsigned Opcode = Node->getOpcode();
// Dump information about the Node being selected
DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << '\n');
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n'); DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n');

View File

@ -273,9 +273,6 @@ bool LanaiDAGToDAGISel::SelectInlineAsmMemoryOperand(
void LanaiDAGToDAGISel::Select(SDNode *Node) { void LanaiDAGToDAGISel::Select(SDNode *Node) {
unsigned Opcode = Node->getOpcode(); unsigned Opcode = Node->getOpcode();
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

View File

@ -381,11 +381,6 @@ bool MSP430DAGToDAGISel::tryIndexedBinOp(SDNode *Op, SDValue N1, SDValue N2,
void MSP430DAGToDAGISel::Select(SDNode *Node) { void MSP430DAGToDAGISel::Select(SDNode *Node) {
SDLoc dl(Node); SDLoc dl(Node);
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: ");
DEBUG(Node->dump(CurDAG));
DEBUG(errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; DEBUG(errs() << "== ";

View File

@ -215,9 +215,6 @@ bool MipsDAGToDAGISel::selectVSplatMaskR(SDValue N, SDValue &Imm) const {
void MipsDAGToDAGISel::Select(SDNode *Node) { void MipsDAGToDAGISel::Select(SDNode *Node) {
unsigned Opcode = Node->getOpcode(); unsigned Opcode = Node->getOpcode();
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

View File

@ -59,9 +59,6 @@ public:
// expanded, promoted and normal instructions // expanded, promoted and normal instructions
void Nios2DAGToDAGISel::Select(SDNode *Node) { void Nios2DAGToDAGISel::Select(SDNode *Node) {
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

View File

@ -58,9 +58,6 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
unsigned Opcode = Node->getOpcode(); unsigned Opcode = Node->getOpcode();
MVT XLenVT = Subtarget->getXLenVT(); MVT XLenVT = Subtarget->getXLenVT();
// Dump information about the Node being selected.
DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << "\n");
// If we have a custom node, we have already selected // If we have a custom node, we have already selected
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << "\n"); DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << "\n");

View File

@ -1249,9 +1249,6 @@ bool SystemZDAGToDAGISel::storeLoadCanUseBlockBinary(SDNode *N,
} }
void SystemZDAGToDAGISel::Select(SDNode *Node) { void SystemZDAGToDAGISel::Select(SDNode *Node) {
// Dump information about the Node being selected
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

View File

@ -68,11 +68,6 @@ private:
} // end anonymous namespace } // end anonymous namespace
void WebAssemblyDAGToDAGISel::Select(SDNode *Node) { void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
// Dump information about the Node being selected.
DEBUG(errs() << "Selecting: ");
DEBUG(Node->dump(CurDAG));
DEBUG(errs() << "\n");
// If we have a custom node, we already have selected! // If we have a custom node, we already have selected!
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

View File

@ -2519,8 +2519,6 @@ void X86DAGToDAGISel::Select(SDNode *Node) {
unsigned Opcode = Node->getOpcode(); unsigned Opcode = Node->getOpcode();
SDLoc dl(Node); SDLoc dl(Node);
DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << '\n');
if (Node->isMachineOpcode()) { if (Node->isMachineOpcode()) {
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n'); DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n');
Node->setNodeId(-1); Node->setNodeId(-1);