[Beignet] [PATCH 03/18] Backend: Store the debug info for gen instruction.

junyan.he at inbox.com junyan.he at inbox.com
Thu Dec 24 03:01:55 PST 2015


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

We will output the line and column every time before
the instruction to ease debug.

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 backend/src/ir/instruction.cpp        | 3 +++
 backend/src/llvm/llvm_gen_backend.cpp | 6 ++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index bb5aac5..7ba26e4 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -2372,6 +2372,9 @@ DECL_MEM_FN(MemInstruction, void,     setBtiReg(Register reg), setBtiReg(reg))
   std::ostream &operator<< (std::ostream &out, const Instruction &insn) {
     const Function &fn = insn.getFunction();
     const BasicBlock *bb = insn.getParent();
+    if (insn.getOpcode() != OP_LABEL)
+      out << "[" << insn.DBGInfo.line << ", " << insn.DBGInfo.col << "]	";
+
     switch (insn.getOpcode()) {
 #define DECL_INSN(OPCODE, CLASS) \
       case OP_##OPCODE: \
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index f2d3704..79ae1fd 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1844,10 +1844,8 @@ namespace gbe
     GBE_ASSERT(labelMap.find(BB) != labelMap.end());
     ctx.LABEL(labelMap[BB]);
     for (auto II = BB->begin(), E = BB->end(); II != E; ++II) {
-      if(OCL_DEBUGINFO) {
-        llvm::Instruction * It = dyn_cast<llvm::Instruction>(II);
-        setDebugInfo_CTX(It);
-      }
+      llvm::Instruction * It = dyn_cast<llvm::Instruction>(II);
+      setDebugInfo_CTX(It);
       visit(*II);
     }
   }
-- 
1.9.1





More information about the Beignet mailing list