Skip to content

Commit 8f324bb

Browse files
committedJan 26, 2018
[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
1 parent b207dd6 commit 8f324bb

12 files changed

+5
-44
lines changed
 

‎llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -985,13 +985,16 @@ void SelectionDAGISel::DoInstructionSelection() {
985985
if (Node->isStrictFPOpcode())
986986
Node = CurDAG->mutateStrictFPToFP(Node);
987987

988+
DEBUG(dbgs() << "\nISEL: Starting selection on root node: ";
989+
Node->dump(CurDAG));
990+
988991
Select(Node);
989992
}
990993

991994
CurDAG->setRoot(Dummy.getValue());
992995
}
993996

994-
DEBUG(dbgs() << "===== Instruction selection ends:\n");
997+
DEBUG(dbgs() << "\n===== Instruction selection ends:\n");
995998

996999
PostprocessISelDAG();
9971000
}
@@ -2988,9 +2991,7 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
29882991
// update the chain results when the pattern is complete.
29892992
SmallVector<SDNode*, 3> ChainNodesMatched;
29902993

2991-
DEBUG(dbgs() << "ISEL: Starting pattern match on root node: ";
2992-
NodeToMatch->dump(CurDAG);
2993-
dbgs() << '\n');
2994+
DEBUG(dbgs() << "ISEL: Starting pattern match\n");
29942995

29952996
// Determine where to start the interpreter. Normally we start at opcode #0,
29962997
// but if the state machine starts with an OPC_SwitchOpcode, then we
@@ -3665,8 +3666,6 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
36653666
<< (IsMorphNodeTo ? "Morphed" : "Created")
36663667
<< " node: ";
36673668
Res->dump(CurDAG);
3668-
3669-
dbgs() << '\n';
36703669
);
36713670

36723671
// If this was a MorphNodeTo then we're completely done!

‎llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -2653,11 +2653,6 @@ bool AArch64DAGToDAGISel::SelectCMP_SWAP(SDNode *N) {
26532653
}
26542654

26552655
void AArch64DAGToDAGISel::Select(SDNode *Node) {
2656-
// Dump information about the Node being selected
2657-
DEBUG(errs() << "Selecting: ");
2658-
DEBUG(Node->dump(CurDAG));
2659-
DEBUG(errs() << "\n");
2660-
26612656
// If we have a custom node, we already have selected!
26622657
if (Node->isMachineOpcode()) {
26632658
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,6 @@ bool AVRDAGToDAGISel::selectMultiplication(llvm::SDNode *N) {
519519
}
520520

521521
void AVRDAGToDAGISel::Select(SDNode *N) {
522-
// Dump information about the Node being selected
523-
DEBUG(errs() << "Selecting: "; N->dump(CurDAG); errs() << "\n");
524-
525522
// If we have a custom node, we already have selected!
526523
if (N->isMachineOpcode()) {
527524
DEBUG(errs() << "== "; N->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/BPF/BPFISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ bool BPFDAGToDAGISel::SelectInlineAsmMemoryOperand(
176176
void BPFDAGToDAGISel::Select(SDNode *Node) {
177177
unsigned Opcode = Node->getOpcode();
178178

179-
// Dump information about the Node being selected
180-
DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << '\n');
181-
182179
// If we have a custom node, we already have selected!
183180
if (Node->isMachineOpcode()) {
184181
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n');

‎llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,6 @@ bool LanaiDAGToDAGISel::SelectInlineAsmMemoryOperand(
273273
void LanaiDAGToDAGISel::Select(SDNode *Node) {
274274
unsigned Opcode = Node->getOpcode();
275275

276-
// Dump information about the Node being selected
277-
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
278-
279276
// If we have a custom node, we already have selected!
280277
if (Node->isMachineOpcode()) {
281278
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,6 @@ bool MSP430DAGToDAGISel::tryIndexedBinOp(SDNode *Op, SDValue N1, SDValue N2,
381381
void MSP430DAGToDAGISel::Select(SDNode *Node) {
382382
SDLoc dl(Node);
383383

384-
// Dump information about the Node being selected
385-
DEBUG(errs() << "Selecting: ");
386-
DEBUG(Node->dump(CurDAG));
387-
DEBUG(errs() << "\n");
388-
389384
// If we have a custom node, we already have selected!
390385
if (Node->isMachineOpcode()) {
391386
DEBUG(errs() << "== ";

‎llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,6 @@ bool MipsDAGToDAGISel::selectVSplatMaskR(SDValue N, SDValue &Imm) const {
215215
void MipsDAGToDAGISel::Select(SDNode *Node) {
216216
unsigned Opcode = Node->getOpcode();
217217

218-
// Dump information about the Node being selected
219-
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
220-
221218
// If we have a custom node, we already have selected!
222219
if (Node->isMachineOpcode()) {
223220
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/Nios2/Nios2ISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class Nios2DAGToDAGISel : public SelectionDAGISel {
5959
// expanded, promoted and normal instructions
6060
void Nios2DAGToDAGISel::Select(SDNode *Node) {
6161

62-
// Dump information about the Node being selected
63-
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
64-
6562
// If we have a custom node, we already have selected!
6663
if (Node->isMachineOpcode()) {
6764
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
5858
unsigned Opcode = Node->getOpcode();
5959
MVT XLenVT = Subtarget->getXLenVT();
6060

61-
// Dump information about the Node being selected.
62-
DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << "\n");
63-
6461
// If we have a custom node, we have already selected
6562
if (Node->isMachineOpcode()) {
6663
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << "\n");

‎llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1249,9 +1249,6 @@ bool SystemZDAGToDAGISel::storeLoadCanUseBlockBinary(SDNode *N,
12491249
}
12501250

12511251
void SystemZDAGToDAGISel::Select(SDNode *Node) {
1252-
// Dump information about the Node being selected
1253-
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
1254-
12551252
// If we have a custom node, we already have selected!
12561253
if (Node->isMachineOpcode()) {
12571254
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ class WebAssemblyDAGToDAGISel final : public SelectionDAGISel {
6868
} // end anonymous namespace
6969

7070
void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
71-
// Dump information about the Node being selected.
72-
DEBUG(errs() << "Selecting: ");
73-
DEBUG(Node->dump(CurDAG));
74-
DEBUG(errs() << "\n");
75-
7671
// If we have a custom node, we already have selected!
7772
if (Node->isMachineOpcode()) {
7873
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");

‎llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -2519,8 +2519,6 @@ void X86DAGToDAGISel::Select(SDNode *Node) {
25192519
unsigned Opcode = Node->getOpcode();
25202520
SDLoc dl(Node);
25212521

2522-
DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << '\n');
2523-
25242522
if (Node->isMachineOpcode()) {
25252523
DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << '\n');
25262524
Node->setNodeId(-1);

0 commit comments

Comments
 (0)
Please sign in to comment.