Changes in directory llvm/lib/Target/X86:

X86ISelDAGToDAG.cpp updated: 1.46 -> 1.47
---
Log message:

Added X86 isel debugging stuff.


---
Diffs of the changes:  (+63 -0)

 X86ISelDAGToDAG.cpp |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+)


Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.46 
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.47
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.46        Thu Feb  9 16:12:53 2006
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp     Fri Feb 10 16:24:32 2006
@@ -12,6 +12,7 @@
 //
 
//===----------------------------------------------------------------------===//
 
+#define DEBUG_TYPE "isel"
 #include "X86.h"
 #include "X86InstrBuilder.h"
 #include "X86RegisterInfo.h"
@@ -143,6 +144,8 @@
     inline SDOperand getI32Imm(unsigned Imm) {
       return CurDAG->getTargetConstant(Imm, MVT::i32);
     }
+
+    std::string Indent;
   };
 }
 
@@ -153,7 +156,14 @@
   MachineFunction::iterator FirstMBB = BB;
 
   // Codegen the basic block.
+#ifndef NDEBUG
+  DEBUG(std::cerr << "===== Instruction selection begins:\n");
+  Indent = "";
+#endif
   DAG.setRoot(SelectRoot(DAG.getRoot()));
+#ifndef NDEBUG
+  DEBUG(std::cerr << "===== Instruction selection ends:\n");
+#endif
   CodeGenMap.clear();
   DAG.RemoveDeadNodes();
 
@@ -451,14 +461,37 @@
   unsigned Opc, MOpc;
   unsigned Opcode = Node->getOpcode();
 
+#ifndef NDEBUG
+  std::string IndentSave = Indent;
+  DEBUG(std::cerr << Indent);
+  DEBUG(std::cerr << "Selecting: ");
+  DEBUG(Node->dump(CurDAG));
+  DEBUG(std::cerr << "\n");
+  Indent += "  ";
+#endif
+
   if (Opcode >= ISD::BUILTIN_OP_END && Opcode < X86ISD::FIRST_NUMBER) {
     Result = N;
+#ifndef NDEBUG
+    DEBUG(std::cerr << Indent);
+    DEBUG(std::cerr << "== ");
+    DEBUG(Node->dump(CurDAG));
+    DEBUG(std::cerr << "\n");
+    Indent = IndentSave;
+#endif
     return;   // Already selected.
   }
 
   std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);
   if (CGMI != CodeGenMap.end()) {
     Result = CGMI->second;
+#ifndef NDEBUG
+    DEBUG(std::cerr << Indent);
+    DEBUG(std::cerr << "== ");
+    DEBUG(Result.Val->dump(CurDAG));
+    DEBUG(std::cerr << "\n");
+    Indent = IndentSave;
+#endif
     return;
   }
   
@@ -539,6 +572,13 @@
         AddHandleReplacement(N1.Val, 1, Result.Val, 1);
       }
 
+#ifndef NDEBUG
+      DEBUG(std::cerr << Indent);
+      DEBUG(std::cerr << "== ");
+      DEBUG(Result.Val->dump(CurDAG));
+      DEBUG(std::cerr << "\n");
+      Indent = IndentSave;
+#endif
       return;
     }
 
@@ -639,6 +679,14 @@
         CodeGenMap[N1.getValue(1)] = Result.getValue(1);
         AddHandleReplacement(N1.Val, 1, Result.Val, 1);
       }
+
+#ifndef NDEBUG
+      DEBUG(std::cerr << Indent);
+      DEBUG(std::cerr << "== ");
+      DEBUG(Result.Val->dump(CurDAG));
+      DEBUG(std::cerr << "\n");
+      Indent = IndentSave;
+#endif
       return;
     }
 
@@ -670,11 +718,26 @@
       else
         Result = CodeGenMap[N] =
           SDOperand(CurDAG->getTargetNode(Opc, VT, Result), 0);
+
+#ifndef NDEBUG
+      DEBUG(std::cerr << Indent);
+      DEBUG(std::cerr << "== ");
+      DEBUG(Result.Val->dump(CurDAG));
+      DEBUG(std::cerr << "\n");
+      Indent = IndentSave;
+#endif
       return;
     }
   }
 
   SelectCode(Result, N);
+#ifndef NDEBUG
+  DEBUG(std::cerr << Indent);
+  DEBUG(std::cerr << "=> ");
+  DEBUG(Result.Val->dump(CurDAG));
+  DEBUG(std::cerr << "\n");
+  Indent = IndentSave;
+#endif
 }
 
 /// createX86ISelDag - This pass converts a legalized DAG into a 



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to