<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-12-14 15:00 GMT+08:00 Xiuli Pan <span dir="ltr"><<a href="mailto:xiuli.pan@intel.com" target="_blank">xiuli.pan@intel.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Pan Xiuli <<a href="mailto:xiuli.pan@intel.com">xiuli.pan@intel.com</a>><br>
<br>
We first find regs that have pool in simple linear scale, and save them<br>
in HoleRegPool, when allocte regs we first try to search fit candidate<br>
in the pool and choose the most fit one to reuse.<br>
<br>
V2: Refine hole reuse only in one block.<br>
V3: Refine data structure with less variable, add OCL_REUSE_HOLE_REG to<br>
control the optimization.<br>
V4: Spilt the patch into instruction ID part and hole reuse, refine the<br>
blockID of the reg.<br>
V5: Refine some variable and function name. Add check for not spill the<br>
hole regs that already been used.<br>
<br>
Signed-off-by: Pan Xiuli <<a href="mailto:xiuli.pan@intel.com">xiuli.pan@intel.com</a>><br>
---<br>
 backend/src/backend/gen_reg_<wbr>allocation.cpp | 125 +++++++++++++++++++++++++----<br>
 backend/src/backend/gen_reg_<wbr>allocation.hpp |  11 +++<br>
 2 files changed, 119 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/backend/src/backend/gen_reg_<wbr>allocation.cpp b/backend/src/backend/gen_reg_<wbr>allocation.cpp<br>
index 2b76eee..26d4394 100644<br>
--- a/backend/src/backend/gen_reg_<wbr>allocation.cpp<br>
+++ b/backend/src/backend/gen_reg_<wbr>allocation.cpp<br>
@@ -50,12 +50,13 @@ namespace gbe<br>
   struct GenRegInterval {<br>
     INLINE GenRegInterval(ir::Register reg) :<br>
       reg(reg), minID(INT_MAX), maxID(-INT_MAX), accessCount(0),<br>
-      conflictReg(0), b3OpAlign(0) {}<br>
+      blockID(-1), conflictReg(0), b3OpAlign(0), usedHole(false), isHole(false){}<br>
     ir::Register reg;     //!< (virtual) register of the interval<br>
     int32_t minID, maxID; //!< Starting and ending points<br>
     int32_t accessCount;<br>
+    int32_t blockID; //!< blockID for in-block regs that can reuse hole<br>
     ir::Register conflictReg; // < has banck conflict with this register<br>
-    bool b3OpAlign;<br></blockquote><div><div>the patch looks good. But I think we need some comment here.<br></div>// usedHole may indicates 1.) a register placed in another's liveness hole or<br></div><div>// 2.) a register with its hole reused. So, you need to check isHole to determine what really happens.<br><br></div><div>- Ruiling<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+    bool b3OpAlign, <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">usedHole, isHole;<br>
   };<br>
<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><br></div></div>