History

Remove VT_REF

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.

Michael Matz committed 9 years ago

Commit a8b83ce1 parent 8b9697c3 files · +3 −12Browse files

Unified · Split

3 files
  1. tcc.h +0 −1
  2. tccgen.c +2 −10
  3. x86_64-gen.c +1 −1
tcc.h+0−1
@@ -825,7 +825,6 @@ struct filespec { · 824 unmodified lines
825#define VT_CMP 0x0033 /* the value is stored in processor flags (in vc) */825#define VT_CMP 0x0033 /* the value is stored in processor flags (in vc) */
826#define VT_JMP 0x0034 /* value is the consequence of jmp true (even) */826#define VT_JMP 0x0034 /* value is the consequence of jmp true (even) */
827#define VT_JMPI 0x0035 /* value is the consequence of jmp false (odd) */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#define VT_LVAL 0x0100 /* var is an lvalue */828#define VT_LVAL 0x0100 /* var is an lvalue */
830#define VT_SYM 0x0200 /* a symbol value is added */829#define VT_SYM 0x0200 /* a symbol value is added */
831#define VT_MUSTCAST 0x0400 /* value must be casted to be correct (used for830#define VT_MUSTCAST 0x0400 /* value must be casted to be correct (used for
tccgen.c+2−10
@@ -1026,8 +1026,6 @@ static void move_reg(int r, int s, int t) · 1025 unmodified lines
1026/* get address of vtop (vtop MUST BE an lvalue) */1026/* get address of vtop (vtop MUST BE an lvalue) */
1027ST_FUNC void gaddrof(void)1027ST_FUNC void gaddrof(void)
1028{1028{
1029 if (vtop->r & VT_REF)
1030 gv(RC_INT);
1031 vtop->r &= ~VT_LVAL;1029 vtop->r &= ~VT_LVAL;
1032 /* tricky: if saved lvalue, then we can go back to lvalue */1030 /* tricky: if saved lvalue, then we can go back to lvalue */
1033 if ((vtop->r & VT_VALMASK) == VT_LLOCAL)1031 if ((vtop->r & VT_VALMASK) == VT_LLOCAL)
@@ -1237,13 +1235,7 @@ ST_FUNC int gv(int rc) · 203 unmodified lines
1237 t = vtop->type.t;1235 t = vtop->type.t;
1238 t1 = t;1236 t1 = t;
1239 /* compute memory access type */1237 /* compute memory access type */
1240 if (vtop->r & VT_REF)1238 if (vtop->r & VT_LVAL_BYTE)
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)
1247 t = VT_BYTE;1239 t = VT_BYTE;
1248 else if (vtop->r & VT_LVAL_SHORT)1240 else if (vtop->r & VT_LVAL_SHORT)
1249 t = VT_SHORT;1241 t = VT_SHORT;
@@ -4616,7 +4608,7 @@ ST_FUNC void unary(void) · 3366 unmodified lines
4616 skip(')');4608 skip(')');
4617 if ((vtop->r & VT_VALMASK) != VT_LOCAL)4609 if ((vtop->r & VT_VALMASK) != VT_LOCAL)
4618 tcc_error("__builtin_va_start expects a local variable");4610 tcc_error("__builtin_va_start expects a local variable");
4619 vtop->r &= ~(VT_LVAL | VT_REF);4611 vtop->r &= ~VT_LVAL;
4620 vtop->type = char_pointer_type;4612 vtop->type = char_pointer_type;
4621 vtop->c.i += 8;4613 vtop->c.i += 8;
4622 vstore();4614 vstore();
x86_64-gen.c+1−1
@@ -957,7 +957,7 @@ void gfunc_prolog(CType *func_type) · 956 unmodified lines
957 if (reg_param_index < REGN) {957 if (reg_param_index < REGN) {
958 gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);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 } else {961 } else {
962 if (reg_param_index < REGN) {962 if (reg_param_index < REGN) {
963 /* save arguments passed by register */963 /* save arguments passed by register */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t