[Beignet] [PATCH 07/19] Backend: Insert store_profiling before lowed return.
junyan.he at inbox.com
junyan.he at inbox.com
Tue Sep 8 17:00:58 PDT 2015
From: Junyan He <junyan.he at linux.intel.com>
After the lowering return pass, a new block which just
has one RET instruction will be generated, and all RET
INSTs in the middle will be replaced by BRA INST.
We want our store_profiling instruction to be inserted
just before that return instruction and out of any
condition blocks. So we postpone the STORE_PROFILING
here.
Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
backend/src/ir/lowering.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp
index 9fcdf74..b312131 100644
--- a/backend/src/ir/lowering.cpp
+++ b/backend/src/ir/lowering.cpp
@@ -52,6 +52,13 @@ namespace ir {
const LabelIndex index = this->label();
this->LABEL(index);
const BasicBlock *lastBlock = this->bb;
+
+ /* Append the STORE_PROFILING just before return. */
+ if (unit.getInProfilingMode() == true) {
+ this->STORE_PROFILING(this->getUnit().getProfilingInfo()->getBTI(),
+ this->getUnit().getProfilingInfo()->getProfilingType());
+ }
+
this->RET();
// Now traverse all instructions and replace all returns by GOTO index
--
1.7.9.5
More information about the Beignet
mailing list