[Beignet] [PATCH 3/6] Debug Support: Pass debug infomation to GEN IR
Bai Yannan
yannan.bai at intel.com
Sun Nov 1 18:43:19 PST 2015
1. Add a structure DBGInfo in Instruction class, storing debug infomation.
2. Pass debug information from context to GEN IR, if OCL_PROFILING is true.
Signed-off-by: Yannan Bai <yannan.bai at intel.com>
Signed-off-by: Meng Lv <meng.lv at intel.com>
---
backend/src/ir/context.cpp | 1 +
backend/src/ir/instruction.hpp | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/backend/src/ir/context.cpp b/backend/src/ir/context.cpp
index 3f52b17..b9078f4 100644
--- a/backend/src/ir/context.cpp
+++ b/backend/src/ir/context.cpp
@@ -162,6 +162,7 @@ namespace ir {
// Append the instruction in the stream
Instruction *insnPtr = fn->newInstruction(insn);
bb->append(*insnPtr);
+ insnPtr->setDBGInfo(this->DBGInfo.line, this->DBGInfo.col);
#if GBE_DEBUG
std::string whyNot;
if(getUnit().getValid())
diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index 3f3c655..1bf725c 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -185,6 +185,7 @@ namespace ir {
void remove(void);
/* Insert the instruction after the previous one. */
void insert(Instruction *prev, Instruction ** new_ins = NULL);
+ void setDBGInfo(uint32_t line, uint32_t col) { DBGInfo.line = line; DBGInfo.col = col; }
/*! Indicates if the instruction belongs to instruction type T. Typically, T
* can be BinaryInstruction, UnaryInstruction, LoadInstruction and so on
*/
@@ -194,6 +195,10 @@ namespace ir {
/*! max_src for store instruction (vec16 + addr) */
static const uint32_t MAX_SRC_NUM = 32;
static const uint32_t MAX_DST_NUM = 32;
+ struct {
+ uint32_t line;
+ uint32_t col;
+ } DBGInfo;
protected:
BasicBlock *parent; //!< The basic block containing the instruction
GBE_CLASS(Instruction); //!< Use internal allocators
--
1.9.1
More information about the Beignet
mailing list