diff options
| author | Michael Matz <matz@suse.de> | 2016-10-06 04:05:30 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:13 +0100 |
| commit | f081acbfba84ffdf1e479f932906bf10f88cd1c2 (patch) | |
| tree | 16f39dd9b65312bc83bb5b3d3e462b6242630b9a /tcc.h | |
| parent | 3bc9c325c5fa754043986cc70ff2af45c2196c38 (diff) | |
| download | tinycc-f081acbfba84ffdf1e479f932906bf10f88cd1c2.tar.gz tinycc-f081acbfba84ffdf1e479f932906bf10f88cd1c2.tar.bz2 | |
Support local register variables
Similar to GCC a local asm register variable enforces the use of a
specified register in asm operands (and doesn't otherwise
matter). Works only if the variable is directly mentioned as
operand. For that we now generally store a backpointer from
an SValue to a Sym when the SValue was the result of unary()
parsing a symbol identifier.
Diffstat (limited to 'tcc.h')
| -rw-r--r-- | tcc.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -372,7 +372,8 @@ typedef struct SValue { unsigned short r2; /* second register, used for 'long long' type. If not used, set to VT_CONST */ CValue c; /* constant, if VT_CONST */ - struct Sym *sym; /* symbol, if (VT_SYM | VT_CONST) */ + struct Sym *sym; /* symbol, if (VT_SYM | VT_CONST), or if + result of unary() for an identifier. */ } SValue; struct Attribute { @@ -407,7 +408,7 @@ typedef struct Sym { int scope; /* scope level for locals */ }; union { - long r; /* associated register */ + long r; /* associated register or VT_CONST/VT_LOCAL and LVAL type */ struct Attribute a; }; union { @@ -416,7 +417,7 @@ typedef struct Sym { }; CType type; /* associated type */ union { - struct Sym *next; /* next related symbol */ + struct Sym *next; /* next related symbol (for fields and anoms) */ long jnext; /* next jump label */ }; struct Sym *prev; /* prev symbol in stack */ @@ -1542,6 +1543,7 @@ ST_FUNC void gen_expr32(ExprValue *pe); ST_FUNC void gen_expr64(ExprValue *pe); #endif ST_FUNC void asm_opcode(TCCState *s1, int opcode); +ST_FUNC int asm_parse_regvar(int t); ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg); ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier); ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, int nb_outputs, int is_output, uint8_t *clobber_regs, int out_reg); |
