diff options
| author | seyko <seyko2@gmail.com> | 2016-04-16 12:41:53 +0300 |
|---|---|---|
| committer | seyko <seyko2@gmail.com> | 2016-04-16 12:41:53 +0300 |
| commit | e010b1396bebc7e3ccace4247114f92f544082d6 (patch) | |
| tree | 82cd4f8bc47c2425e78b3de9678a25e25e67171a /tccgen.c | |
| parent | 5ee097fce9dee7eb4dc782c5d6bce75c01243d63 (diff) | |
| download | tinycc-e010b1396bebc7e3ccace4247114f92f544082d6.tar.gz tinycc-e010b1396bebc7e3ccace4247114f92f544082d6.tar.bz2 | |
__builtin_expect no-op
Taken from David Mertens tcc branch on github
https://github.com/run4flat/tinycc.git
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -84,6 +84,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, int case_re static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope); static int decl0(int l, int is_for_loop_init); static void expr_eq(void); +static void expr_lor_const(void); static void unary_type(CType *type); static void vla_runtime_type_size(CType *type, int *a); static void vla_sp_restore(void); @@ -3938,6 +3939,22 @@ ST_FUNC void unary(void) vtop->type.t |= VT_UNSIGNED; break; + case TOK_builtin_expect: + { + /* __builtin_expect is a no-op for now */ + int saved_nocode_wanted; + next(); + skip('('); + expr_eq(); + skip(','); + saved_nocode_wanted = nocode_wanted; + nocode_wanted = 1; + expr_lor_const(); + vpop(); + nocode_wanted = saved_nocode_wanted; + skip(')'); + } + break; case TOK_builtin_types_compatible_p: { CType type1, type2; @@ -4466,6 +4483,26 @@ static void expr_or(void) } } +/* XXX: fix this mess */ +static void expr_land_const(void) +{ + expr_or(); + while (tok == TOK_LAND) { + next(); + expr_or(); + gen_op(TOK_LAND); + } +} +static void expr_lor_const(void) +{ + expr_land_const(); + while (tok == TOK_LOR) { + next(); + expr_land_const(); + gen_op(TOK_LOR); + } +} + static void expr_land(void) { expr_or(); |
