[06/21,V3] Backend: Insert store_profiling before lowed return.

Submitted by junyan.he@inbox.com on Nov. 16, 2015, 11:40 p.m.

Details

Message ID 1447717223-28153-7-git-send-email-junyan.he@inbox.com
State New
Headers show
Series "Add Profiling support in beignet." ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com Nov. 16, 2015, 11:40 p.m.
From: Junyan He <junyan.he@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@linux.intel.com>
---
 backend/src/ir/lowering.cpp |    7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/backend/src/ir/lowering.cpp b/backend/src/ir/lowering.cpp
index 66ced8c..535f7e6 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