aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-02-19 23:50:13 +0100
committerMichael Matz <matz@suse.de>2017-05-02 03:07:36 +0200
commita8b83ce43a95fa519dacfe7690a3a0098af7909c (patch)
treead077ee960d6aa5dc503ce2a45bab9618a3457ac
parent8b9697ca6b756af47eac153961abec70fd9dad6e (diff)
downloadtinycc-a8b83ce43a95fa519dacfe7690a3a0098af7909c.tar.gz
tinycc-a8b83ce43a95fa519dacfe7690a3a0098af7909c.tar.bz2
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.
-rw-r--r--tcc.h1
-rw-r--r--tccgen.c12
-rw-r--r--x86_64-gen.c2
3 files changed, 3 insertions, 12 deletions
diff --git a/tcc.h b/tcc.h
index ae7bb30..02619ba 100644
--- a/tcc.h
+++ b/tcc.h
@@ -825,7 +825,6 @@ struct filespec {
#define VT_CMP 0x0033 /* the value is stored in processor flags (in vc) */
#define VT_JMP 0x0034 /* value is the consequence of jmp true (even) */
#define VT_JMPI 0x0035 /* value is the consequence of jmp false (odd) */
-#define VT_REF 0x0040 /* value is pointer to structure rather than address */
#define VT_LVAL 0x0100 /* var is an lvalue */
#define VT_SYM 0x0200 /* a symbol value is added */
#define VT_MUSTCAST 0x0400 /* value must be casted to be correct (used for
diff --git a/tccgen.c b/tccgen.c
index 8d54ade..d8aa71e 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -1026,8 +1026,6 @@ static void move_reg(int r, int s, int t)
/* get address of vtop (vtop MUST BE an lvalue) */
ST_FUNC void gaddrof(void)
{
- if (vtop->r & VT_REF)
- gv(RC_INT);
vtop->r &= ~VT_LVAL;
/* tricky: if saved lvalue, then we can go back to lvalue */
if ((vtop->r & VT_VALMASK) == VT_LLOCAL)
@@ -1237,13 +1235,7 @@ ST_FUNC int gv(int rc)
t = vtop->type.t;
t1 = t;
/* compute memory access type */
- if (vtop->r & VT_REF)
-#if defined(TCC_TARGET_ARM64) || defined(TCC_TARGET_X86_64)
- t = VT_PTR;
-#else
- t = VT_INT;
-#endif
- else if (vtop->r & VT_LVAL_BYTE)
+ if (vtop->r & VT_LVAL_BYTE)
t = VT_BYTE;
else if (vtop->r & VT_LVAL_SHORT)
t = VT_SHORT;
@@ -4616,7 +4608,7 @@ ST_FUNC void unary(void)
skip(')');
if ((vtop->r & VT_VALMASK) != VT_LOCAL)
tcc_error("__builtin_va_start expects a local variable");
- vtop->r &= ~(VT_LVAL | VT_REF);
+ vtop->r &= ~VT_LVAL;
vtop->type = char_pointer_type;
vtop->c.i += 8;
vstore();
diff --git a/x86_64-gen.c b/x86_64-gen.c
index 9f19e78..0c0968c 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -957,7 +957,7 @@ void gfunc_prolog(CType *func_type)
if (reg_param_index < REGN) {
gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);
}
- sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL | VT_REF, addr);
+ sym_push(sym->v & ~SYM_FIELD, type, VT_LLOCAL | VT_LVAL, addr);
} else {
if (reg_param_index < REGN) {
/* save arguments passed by register */