Add Gen IR WHILE.
authorLuo Xionghu <xionghu.luo@intel.com>
Mon, 15 Sep 2014 00:23:37 +0000 (08:23 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Fri, 26 Sep 2014 04:56:37 +0000 (12:56 +0800)
Add Gen IR WHILE to mark the strucutred region.

Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/ir/instruction.cpp
backend/src/ir/instruction.hpp
backend/src/ir/instruction.hxx

index 2d86480..e4e30ed 100644 (file)
@@ -349,7 +349,7 @@ namespace ir {
     {
     public:
       INLINE BranchInstruction(Opcode op, LabelIndex labelIndex, Register predicate, bool inv_pred=false) {
-        GBE_ASSERT(op == OP_BRA || op == OP_IF);
+        GBE_ASSERT(op == OP_BRA || op == OP_IF || op == OP_WHILE);
         this->opcode = op;
         this->predicate = predicate;
         this->labelIndex = labelIndex;
@@ -1721,6 +1721,11 @@ DECL_MEM_FN(GetImageInfoInstruction, uint8_t, getImageIndex(void), getImageIndex
     return internal::BranchInstruction(OP_ENDIF, labelIndex).convert();
   }
 
+  // WHILE
+  Instruction WHILE(LabelIndex labelIndex, Register pred) {
+    return internal::BranchInstruction(OP_WHILE, labelIndex, pred).convert();
+  }
+
   // RET
   Instruction RET(void) {
     return internal::BranchInstruction(OP_RET).convert();
index 3526a41..6807615 100644 (file)
@@ -687,6 +687,8 @@ namespace ir {
   Instruction ELSE(LabelIndex labelIndex);
   /*! endif */
   Instruction ENDIF(LabelIndex labelIndex);
+  /*! (pred) while labelIndex */
+  Instruction WHILE(LabelIndex labelIndex, Register pred);
   /*! ret */
   Instruction RET(void);
   /*! load.type.space {dst1,...,dst_valueNum} offset value */
index 40b5305..5fed286 100644 (file)
@@ -98,3 +98,4 @@ DECL_INSN(MAD, TernaryInstruction)
 DECL_INSN(IF, BranchInstruction)
 DECL_INSN(ENDIF, BranchInstruction)
 DECL_INSN(ELSE, BranchInstruction)
+DECL_INSN(WHILE, BranchInstruction)