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

Submitted by junyan.he@inbox.com on Dec. 24, 2015, 11:01 a.m.

Details

Message ID 1450954930-6914-4-git-send-email-junyan.he@inbox.com
State New
Headers show
Series "Enable profiling by line number." ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com Dec. 24, 2015, 11:01 a.m.
From: Junyan He <junyan.he@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@linux.intel.com>
---
 backend/src/ir/instruction.cpp        | 3 +++
 backend/src/llvm/llvm_gen_backend.cpp | 6 ++----
 2 files changed, 5 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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);
     }
   }