[Beignet] [PATCH 6/7] Backend: Output line and column number for insn selection.

junyan.he at inbox.com junyan.he at inbox.com
Thu Dec 17 01:35:57 PST 2015


From: Junyan He <junyan.he at linux.intel.com>

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 backend/src/backend/gen_insn_selection.cpp        | 9 ++-------
 backend/src/backend/gen_insn_selection_output.cpp | 3 +++
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index de50e57..def2a5f 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -169,6 +169,7 @@ namespace gbe
     parent(NULL), opcode(op), dstNum(dst), srcNum(src)
   {
     extra.function = 0;
+    DBGInfo.line = DBGInfo.col = 0;
   }
 
   void SelectionInstruction::prepend(SelectionInstruction &other) {
@@ -2088,11 +2089,6 @@ namespace gbe
     return insnNum;
   }
 
-extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp
-#define SET_SEL_DBGINFO(I)  \
-	if(OCL_DEBUGINFO)	 \
-	  this->setDBGInfo_SEL(I.DBGInfo)
-
   void Selection::Opaque::matchBasicBlock(const ir::BasicBlock &bb, uint32_t insnNum)
   {
     // Bottom up code generation
@@ -2112,7 +2108,6 @@ extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp
     for (int32_t insnID = insnNum-1; insnID >= 0; --insnID) {
       // Process all possible patterns for this instruction
       SelectionDAG &dag = *insnDAG[insnID];
-      SET_SEL_DBGINFO(dag.insn);
       if (dag.isRoot) {
         const ir::Instruction &insn = dag.insn;
         const ir::Opcode opcode = insn.getOpcode();
@@ -2132,6 +2127,7 @@ extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp
 
         // Try all the patterns from best to worst
         do {
+          this->setDBGInfo_SEL(dag.insn.DBGInfo);
           if ((*it)->emit(*this, dag))
             break;
           ++it;
@@ -2164,7 +2160,6 @@ extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp
       }
     }
   }
-#undef SET_SEL_DBGINFO
 
   void Selection::Opaque::select(void)
   {
diff --git a/backend/src/backend/gen_insn_selection_output.cpp b/backend/src/backend/gen_insn_selection_output.cpp
index 1861637..56e8a69 100644
--- a/backend/src/backend/gen_insn_selection_output.cpp
+++ b/backend/src/backend/gen_insn_selection_output.cpp
@@ -101,6 +101,9 @@ namespace gbe
     cout << "WARNING: not completed yet, welcome for the FIX!" << endl;
     for (SelectionBlock &block : *sel->blockList) {
       for (SelectionInstruction &insn : block.insnList) {
+        if (insn.opcode != SEL_OP_LABEL) {
+          cout << "[" << insn.DBGInfo.line << ", " << insn.DBGInfo.col << "] ";
+        }
         char opname[512];
         if (insn.isLabel()) {
             cout << "  L" << insn.index << ":" << endl;
-- 
1.9.1





More information about the Beignet mailing list