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
825825 #define VT_CMP 0x0033 /* the value is stored in processor flags (in vc) */
826826 #define VT_JMP 0x0034 /* value is the consequence of jmp true (even) */
827827 #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 */
829828 #define VT_LVAL 0x0100 /* var is an lvalue */
830829 #define VT_SYM 0x0200 /* a symbol value is added */
831830 #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
10261026 /* get address of vtop (vtop MUST BE an lvalue) */
10271027 ST_FUNC void gaddrof(void)
10281028 {
1029− if (vtop->r & VT_REF)
1030− gv(RC_INT);
10311029 vtop->r &= ~VT_LVAL;
10321030 /* tricky: if saved lvalue, then we can go back to lvalue */
10331031 if ((vtop->r & VT_VALMASK) == VT_LLOCAL)
@@ -1237,13 +1235,7 @@ ST_FUNC int gv(int rc) · 203 unmodified lines
12371235 t = vtop->type.t;
12381236 t1 = t;
12391237 /* 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)
12471239 t = VT_BYTE;
12481240 else if (vtop->r & VT_LVAL_SHORT)
12491241 t = VT_SHORT;
@@ -4616,7 +4608,7 @@ ST_FUNC void unary(void) · 3366 unmodified lines
46164608 skip(')');
46174609 if ((vtop->r & VT_VALMASK) != VT_LOCAL)
46184610 tcc_error("__builtin_va_start expects a local variable");
4619− vtop->r &= ~(VT_LVAL | VT_REF);
4611+ vtop->r &= ~VT_LVAL;
46204612 vtop->type = char_pointer_type;
46214613 vtop->c.i += 8;
46224614 vstore();
x86_64-gen.c+1−1
@@ -957,7 +957,7 @@ void gfunc_prolog(CType *func_type) · 956 unmodified lines
957957 if (reg_param_index < REGN) {
958958 gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);
959959 }
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);
961961 } else {
962962 if (reg_param_index < REGN) {
963963 /* 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