NVlabs / NVBit

200 stars 18 forks source link

How to read unified register number? #22

Closed mkhairy closed 4 years ago

mkhairy commented 4 years ago

Hello,

When I took a look at the operand_t union, I do not see a struct for the unified register number. I see "struct reg", but I think this used for vector register. Is it also used for a unified register number?

   union {
        struct {
            uint64_t value;
        } imm_uint64;

        struct {
            double value;
        } imm_double;

        struct {
            int num;
            /* register properties .XXX */
            char prop[MAX_CHARS];
        } reg;

        struct {
            int num;
        } pred;

        struct {
            int id;
            bool has_imm_offset;
            int imm_offset;
            bool has_reg_offset;
            int reg_offset;
        } cbank;

        struct {
            bool has_ra;
            int ra_num;
            regModifierType ra_mod;
            bool has_ur;
            int ur_num;
            bool has_imm;
            int imm;
        } mref;

        struct {
            char array[MAX_CHARS];
        } generic;

    } u;
} operand_t;
x-y-z commented 4 years ago

Yes. When operandType is REG, operand_t.u.reg.num is vector register number. When operandType is UREG, it means unified register number.

mkhairy commented 4 years ago

Ok, I got it. Thanks!