core/x86/instr.c
/* allocates storage for instr_num_srcs src operands and instr_num_dsts dst operands
 * assumes that instr is currently all zeroed out!
 */
allocates storage for instr_num_srcs src operands and instr_num_dsts dst operands
assumes that instr is currently all zeroed out!
allocates storage for instr_num_srcs src operands and instr_num_dsts dst operands assumes that instr is currently all zeroed out!
void
instr_set_num_opnds(dcontext_t *dcontext,
                    instr_t *instr, int instr_num_dsts, int instr_num_srcs)
{
    if (instr_num_dsts > 0) {
        CLIENT_ASSERT(instr->num_dsts == 0 && instr->dsts == NULL,
                      "instr_set_num_opnds: dsts are already set");
        CLIENT_ASSERT_TRUNCATE(instr->num_dsts, byte, instr_num_dsts,
                               "instr_set_num_opnds: too many dsts");
        instr->num_dsts = (byte) instr_num_dsts;
        instr->dsts = (opnd_t *) heap_alloc(dcontext, instr_num_dsts*sizeof(opnd_t)
                                          HEAPACCT(ACCT_IR));
    }
    if (instr_num_srcs > 0) {
        if (instr_num_srcs > 1) {
            CLIENT_ASSERT(instr->num_srcs <= 1 && instr->srcs == NULL,
                          "instr_set_num_opnds: srcs are already set");
            instr->srcs = (opnd_t *) heap_alloc(dcontext, (instr_num_srcs-1)*sizeof(opnd_t)
                                              HEAPACCT(ACCT_IR));
        }
        CLIENT_ASSERT_TRUNCATE(instr->num_srcs, byte, instr_num_srcs,
                               "instr_set_num_opnds: too many srcs");
        instr->num_srcs = (byte) instr_num_srcs;
    }
    instr_being_modified(instr, false);
    instr_set_operands_valid(instr, true);
}
void instr_set_num_opnds ( dcontext_t * dcontext , instr_t * instr , int instr_num_dsts , int instr_num_srcs ) { if ( instr_num_dsts > 0 ) { CLIENT_ASSERT ( instr -> num_dsts == 0 && instr -> dsts == NULL , " " ) ; CLIENT_ASSERT_TRUNCATE ( instr -> num_dsts , byte , instr_num_dsts , " " ) ; instr -> num_dsts = ( byte ) instr_num_dsts ; instr -> dsts = ( opnd_t * ) heap_alloc ( dcontext , instr_num_dsts * sizeof ( opnd_t ) HEAPACCT ( ACCT_IR ) ) ; } if ( instr_num_srcs > 0 ) { if ( instr_num_srcs > 1 ) { CLIENT_ASSERT ( instr -> num_srcs <= 1 && instr -> srcs == NULL , " " ) ; instr -> srcs = ( opnd_t * ) heap_alloc ( dcontext , ( instr_num_srcs - 1 ) * sizeof ( opnd_t ) HEAPACCT ( ACCT_IR ) ) ; } CLIENT_ASSERT_TRUNCATE ( instr -> num_srcs , byte , instr_num_srcs , " " ) ; instr -> num_srcs = ( byte ) instr_num_srcs ; } instr_being_modified ( instr , false ) ; instr_set_operands_valid ( instr , true ) ; }
allocates storage for instr_num_srcs src operands and instr_num_dsts dst operands
 assumes that instr is currently all zeroed out!
allocates storage for instr_num_srcs src operands and instr_num_dsts dst operands assumes that instr is currently all zeroed out!
/* remember that src0 is static, rest are dynamic */ /*raw bits invalid*/ /* assume all operands are valid */