void Expander::expand(bh_ir& bhir) { int end = bhir.instr_list.size(); for(int pc=0; pc<end; ++pc) { bh_instruction& instr = bhir.instr_list[pc]; int increase = 0; switch(instr.opcode) { case BH_POWER: if (powk_) { end += expand_powk(bhir, pc); end += increase; pc += increase; } break; case BH_MATMUL: if (matmul_) { end += expand_matmul(bhir, pc); end += increase; pc += increase; } break; case BH_SIGN: if (sign_) { increase = expand_sign(bhir, pc); end += increase; pc += increase; } break; default: break; } } }
void Expander::expand(bh_ir& bhir) { int end = bhir.instr_list.size(); for(int pc=0; pc<end; ++pc) { bh_instruction& instr = bhir.instr_list[pc]; int increase = 0; switch(instr.opcode) { case BH_POWER: if (powk_) { increase = expand_powk(bhir, pc); end += increase; pc += increase; } break; case BH_MATMUL: if (matmul_) { increase = expand_matmul(bhir, pc); end += increase; pc += increase; } break; case BH_SIGN: if (sign_) { increase = expand_sign(bhir, pc); end += increase; pc += increase; } break; case BH_REPEAT: if (repeat_) { increase = expand_repeat(bhir, pc); end += increase; pc += increase; } break; case BH_ADD_REDUCE: case BH_MULTIPLY_REDUCE: case BH_MINIMUM_REDUCE: case BH_MAXIMUM_REDUCE: case BH_LOGICAL_AND_REDUCE: case BH_BITWISE_AND_REDUCE: case BH_LOGICAL_OR_REDUCE: case BH_BITWISE_OR_REDUCE: case BH_LOGICAL_XOR_REDUCE: case BH_BITWISE_XOR_REDUCE: if (reduce1d_ && instr.operand[1].ndim == 1) { increase = expand_reduce1d(bhir, pc, reduce1d_); end += increase; pc += increase; } break; default: break; } } }