diff options
author | Linus Torvalds <torvalds@penguin.transmeta.com> | 2003-04-09 15:30:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:25 -0700 |
commit | bbd57e9990529223b129893b7b764d3a6ec856ba (patch) | |
tree | 81b7e14fb826cd9c2c0de93b36e8b0be2b779c42 | |
parent | Show switch- and case-statements in some half-way sane (diff) | |
download | sparse-bbd57e9990529223b129893b7b764d3a6ec856ba.tar.gz sparse-bbd57e9990529223b129893b7b764d3a6ec856ba.tar.bz2 sparse-bbd57e9990529223b129893b7b764d3a6ec856ba.zip |
Make symbol addressing do something half-way sane.
-rw-r--r-- | show-parse.c | 11 | ||||
-rw-r--r-- | symbol.c | 1 | ||||
-rw-r--r-- | symbol.h | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/show-parse.c b/show-parse.c index 9c41902..3b44204 100644 --- a/show-parse.c +++ b/show-parse.c @@ -682,7 +682,16 @@ static int show_postop(struct expression *expr) static int show_symbol_expr(struct symbol *sym) { int new = new_pseudo(); - printf("\tmovi.%d\t\tv%d,$%s\n", BITS_IN_POINTER, new, show_ident(sym->ident)); + + if (sym->ctype.modifiers & (MOD_TOPLEVEL | MOD_EXTERN | MOD_STATIC)) { + printf("\tmovi.%d\t\tv%d,$%s\n", BITS_IN_POINTER, new, show_ident(sym->ident)); + return new; + } + if (sym->ctype.modifiers & MOD_ADDRESSABLE) { + printf("\taddi.%d\t\tv%d,vFP,$%lld\n", BITS_IN_POINTER, new, sym->value); + return new; + } + printf("\taddi.%d\t\tv%d,vFP,$xxx\n", BITS_IN_POINTER, new); return new; } @@ -264,6 +264,7 @@ void bind_symbol(struct symbol *sym, struct ident *ident, enum namespace ns) scope = block_scope; if (toplevel(scope)) { + sym->ctype.modifiers |= MOD_TOPLEVEL; if (sym->ctype.modifiers & MOD_STATIC) scope = file_scope; } @@ -119,6 +119,7 @@ struct symbol { #define MOD_NOCAST 0x100000 #define MOD_NODEREF 0x200000 #define MOD_ACCESSED 0x400000 +#define MOD_TOPLEVEL 0x800000 // scoping.. /* Basic types */ extern struct symbol void_type, |