@@ -192,7 +192,6 @@ static const char *current_section;
static void emit_comment(const char * fmt, ...) FORMAT_ATTR(1);
static void emit_move(struct storage *src, struct storage *dest,
struct symbol *ctype, const char *comment);
-static int type_is_signed(struct symbol *sym);
static struct storage *x86_address_gen(struct expression *expr);
static struct storage *x86_symbol_expr(struct symbol *sym);
static void x86_symbol(struct symbol *sym);
@@ -1165,7 +1164,7 @@ static void emit_move(struct storage *src, struct storage *dest,
if (ctype) {
bits = ctype->bit_size;
- is_signed = type_is_signed(ctype);
+ is_signed = is_signed_type(ctype);
} else {
bits = 32;
is_signed = 0;
@@ -1357,7 +1356,7 @@ static struct storage *emit_binop(struct expression *expr)
if ((expr->op == '/') || (expr->op == '%'))
return emit_divide(expr, left, right);
- is_signed = type_is_signed(expr->ctype);
+ is_signed = is_signed_type(expr->ctype);
switch (expr->op) {
case '+':
@@ -2266,15 +2265,6 @@ static void x86_symbol_init(struct symbol *sym)
priv->addr = new;
}
-static int type_is_signed(struct symbol *sym)
-{
- if (sym->type == SYM_NODE)
- sym = sym->ctype.base_type;
- if (sym->type == SYM_PTR)
- return 0;
- return !(sym->ctype.modifiers & MOD_UNSIGNED);
-}
-
static struct storage *x86_label_expr(struct expression *expr)
{
struct storage *new = stack_alloc(4);
@@ -949,15 +949,6 @@ static int show_symbol_init(struct symbol *sym)
return 0;
}
-static int type_is_signed(struct symbol *sym)
-{
- if (sym->type == SYM_NODE)
- sym = sym->ctype.base_type;
- if (sym->type == SYM_PTR)
- return 0;
- return !(sym->ctype.modifiers & MOD_UNSIGNED);
-}
-
static int show_cast_expr(struct expression *expr)
{
struct symbol *old_type, *new_type;
@@ -973,7 +964,7 @@ static int show_cast_expr(struct expression *expr)
if (oldbits >= newbits)
return op;
new = new_pseudo();
- is_signed = type_is_signed(old_type);
+ is_signed = is_signed_type(old_type);
if (is_signed) {
printf("\tsext%d.%d\tv%d,v%d\n", oldbits, newbits, new, op);
} else {
@@ -335,6 +335,15 @@ static inline int is_enum_type(const struct symbol *type)
return (type->type == SYM_ENUM);
}
+static inline int is_signed_type(struct symbol *sym)
+{
+ if (sym->type == SYM_NODE)
+ sym = sym->ctype.base_type;
+ if (sym->type == SYM_PTR)
+ return 0;
+ return !(sym->ctype.modifiers & MOD_UNSIGNED);
+}
+
static inline int is_type_type(struct symbol *type)
{
return (type->ctype.modifiers & MOD_TYPE) != 0;
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- compile-i386.c | 14 ++------------ show-parse.c | 11 +---------- symbol.h | 9 +++++++++ 3 files changed, 12 insertions(+), 22 deletions(-)