The canonical way to describe a local variable that actually holds the address of an lvalue is VT_LLOCAL. Remove the last user of VT_REF, and handling of it, thereby freeing a flag for SValue.r.
Unified · Split
| @@ -825,7 +825,6 @@ struct filespec { · 824 unmodified lines | ||
| 825 | 825 | #define VT_CMP 0x0033 /* the value is stored in processor flags (in vc) */ |
| 826 | 826 | #define VT_JMP 0x0034 /* value is the consequence of jmp true (even) */ |
| 827 | 827 | #define VT_JMPI 0x0035 /* value is the consequence of jmp false (odd) */ |
| 828 | −#define VT_REF 0x0040 /* value is pointer to structure rather than address */ | |
| 829 | 828 | #define VT_LVAL 0x0100 /* var is an lvalue */ |
| 830 | 829 | #define VT_SYM 0x0200 /* a symbol value is added */ |
| 831 | 830 | #define VT_MUSTCAST 0x0400 /* value must be casted to be correct (used for |
| @@ -1026,8 +1026,6 @@ static void move_reg(int r, int s, int t) · 1025 unmodified lines | ||
| 1026 | 1026 | /* get address of vtop (vtop MUST BE an lvalue) */ |
| 1027 | 1027 | ST_FUNC void gaddrof(void) |
| 1028 | 1028 | { |
| 1029 | − if (vtop->r & VT_REF) | |
| 1030 | − gv(RC_INT); | |
| 1031 | 1029 | vtop->r &= ~VT_LVAL; |
| 1032 | 1030 | /* tricky: if saved lvalue, then we can go back to lvalue */ |
| 1033 | 1031 | if ((vtop->r & VT_VALMASK) == VT_LLOCAL) |
| @@ -1237,13 +1235,7 @@ ST_FUNC int gv(int rc) · 203 unmodified lines | ||
| 1237 | 1235 | t = vtop->type.t; |
| 1238 | 1236 | t1 = t; |
| 1239 | 1237 | /* compute memory access type */ |
| 1240 | − if (vtop->r & VT_REF) | |
| 1241 | −#if defined(TCC_TARGET_ARM64) || defined(TCC_TARGET_X86_64) | |
| 1242 | − t = VT_PTR; | |
| 1243 | −#else | |
| 1244 | − t = VT_INT; | |
| 1245 | −#endif | |
| 1246 | − else if (vtop->r & VT_LVAL_BYTE) | |
| 1238 | + if (vtop->r & VT_LVAL_BYTE) | |
| 1247 | 1239 | t = VT_BYTE; |
| 1248 | 1240 | else if (vtop->r & VT_LVAL_SHORT) |
| 1249 | 1241 | t = VT_SHORT; |
| @@ -4616,7 +4608,7 @@ ST_FUNC void unary(void) · 3366 unmodified lines | ||
| 4616 | 4608 | skip(')'); |
| 4617 | 4609 | if ((vtop->r & VT_VALMASK) != VT_LOCAL) |
| 4618 | 4610 | tcc_error("__builtin_va_start expects a local variable"); |
| 4619 | − vtop->r &= ~(VT_LVAL | VT_REF); | |
| 4611 | + vtop->r &= ~VT_LVAL; | |
| 4620 | 4612 | vtop->type = char_pointer_type; |
| 4621 | 4613 | vtop->c.i += 8; |
| 4622 | 4614 | vstore(); |
| @@ -957,7 +957,7 @@ void gfunc_prolog(CType *func_type) · 956 unmodified lines | ||
| 957 | 957 | if (reg_param_index < REGN) { |
| 958 | 958 | gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr); |
| 959 | 959 | } |
| 960 | − sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL | VT_REF, addr); | |
| 960 | + sym_push(sym->v & ~SYM_FIELD, type, VT_LLOCAL | VT_LVAL, addr); | |
| 961 | 961 | } else { |
| 962 | 962 | if (reg_param_index < REGN) { |
| 963 | 963 | /* save arguments passed by register */ |