core/kernel_linux/clients/stress_dead_reg_module.c
/* check if this instr set an register to immed value */
check if this instr set an register to immed value
check if this instr set an register to immed value
static bool
reg_set_immed(instr_t *instr, reg_id_t reg)
{
    int opcode = instr_get_opcode(instr);
    if((opcode == OP_sub || opcode == OP_xor) &&
       (opnd_same(instr_get_src(instr, 0), 
                  instr_get_src(instr, 1))))
	return true;
    if(opcode == OP_mov_ld          && 
       opnd_is_immed(instr_get_src(instr, 0)))
        return true;
    if (opcode == OP_mov_imm)
        return true;
    return false;
}
static bool reg_set_immed ( instr_t * instr , reg_id_t reg ) { int opcode = instr_get_opcode ( instr ) ; if ( ( opcode == OP_sub || opcode == OP_xor ) && ( opnd_same ( instr_get_src ( instr , 0 ) , instr_get_src ( instr , 1 ) ) ) ) return true ; if ( opcode == OP_mov_ld && opnd_is_immed ( instr_get_src ( instr , 0 ) ) ) return true ; if ( opcode == OP_mov_imm ) return true ; return false ; }
check if this instr set an register to immed value
check if this instr set an register to immed value
// for case of r1 = r1 - r1, or r1 = r1 xor r1