summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBai Yannan <yannan.bai@intel.com>2015-11-18 16:28:37 +0800
committerYang Rong <rong.r.yang@intel.com>2015-12-02 15:29:19 +0800
commit25f6218eac3b834956b415c5963848c1291afbad (patch)
tree82860bcd5ab14926f03faee163bc8393723a8099
parent9b66e591a9f6efac6842e9542f44e11dd3c5e40d (diff)
GBE/DebugInfo: Pass debug info : GEN IR => SEL IR
1. Add a DebugInfo type structure DBGInfo in Opaqueue class, storing debug infomation in selection for subsequentlt passing to selection IR. 2. Add a DebugInfo type structure DBGInfo in SelectionInstruction class, storing debug infomation. 3. Pass debug information from GEN IR firstly to selection queue, then pass to selection IR when emitting, if OCL_DEBUGINFO is true. Signed-off-by: Yannan Bai <yannan.bai@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
-rw-r--r--backend/src/backend/gen_insn_selection.cpp11
-rw-r--r--backend/src/backend/gen_insn_selection.hpp3
2 files changed, 14 insertions, 0 deletions
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 884f89d7..32d05d3a 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -458,6 +458,8 @@ namespace gbe
bool hasQWord(const ir::Instruction &insn);
/*! A root instruction needs to be generated */
bool isRoot(const ir::Instruction &insn) const;
+ /*! Set debug infomation to Selection */
+ void setDBGInfo_SEL(DebugInfo in) { DBGInfo = in; }
/*! To handle selection block allocation */
DECL_POOL(SelectionBlock, blockPool);
@@ -495,6 +497,7 @@ namespace gbe
uint32_t vectorNum;
/*! If true, generate code backward */
bool bwdCodeGeneration;
+ DebugInfo DBGInfo;
/*! To make function prototypes more readable */
typedef const GenRegister &Reg;
@@ -867,6 +870,7 @@ namespace gbe
GBE_ASSERT(dstNum <= SelectionInstruction::MAX_DST_NUM && srcNum <= SelectionInstruction::MAX_SRC_NUM);
GBE_ASSERT(this->block != NULL);
SelectionInstruction *insn = this->create(opcode, dstNum, srcNum);
+ insn->setDBGInfo(DBGInfo);
if (this->bwdCodeGeneration)
this->bwdList.push_back(insn);
else
@@ -2062,6 +2066,11 @@ namespace gbe
return insnNum;
}
+extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp
+#define SET_SEL_DBGINFO(I) \
+ if(OCL_DEBUGINFO) \
+ sel.setDBGInfo_SEL(I.DBGInfo)
+
void Selection::Opaque::matchBasicBlock(const ir::BasicBlock &bb, uint32_t insnNum)
{
// Bottom up code generation
@@ -2081,6 +2090,7 @@ namespace gbe
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 +2142,7 @@ namespace gbe
}
}
}
+#undef SET_SEL_DBGINFO
void Selection::Opaque::select(void)
{
diff --git a/backend/src/backend/gen_insn_selection.hpp b/backend/src/backend/gen_insn_selection.hpp
index 0070ac20..f292566e 100644
--- a/backend/src/backend/gen_insn_selection.hpp
+++ b/backend/src/backend/gen_insn_selection.hpp
@@ -90,6 +90,8 @@ namespace gbe
const GenRegister &dst(uint32_t dstID) const { return regs[dstID]; }
/*! Damn C++ */
const GenRegister &src(uint32_t srcID) const { return regs[dstNum+srcID]; }
+ /*! Set debug infomation to selection */
+ void setDBGInfo(DebugInfo in) { DBGInfo = in; }
/*! No more than 40 sources (40 sources are used by vme for payload passing and setting) */
enum { MAX_SRC_NUM = 40 };
/*! No more than 16 destinations (15 used by I64DIV/I64REM) */
@@ -160,6 +162,7 @@ namespace gbe
uint32_t index1;
/*! instruction ID used for vector allocation. */
uint32_t ID;
+ DebugInfo DBGInfo;
/*! Variable sized. Destinations and sources go here */
GenRegister regs[0];
INLINE uint32_t getbti() const {