[qfcc] Support def exprs in integral value extractors

This commit is contained in:
Bill Currie 2020-03-17 10:56:45 +09:00
parent e4a403bbb3
commit 80967e1471

View file

@ -1049,7 +1049,10 @@ is_integer_val (expr_t *e)
&& is_integral (e->e.symbol->type)) { && is_integral (e->e.symbol->type)) {
return 1; return 1;
} }
if (e->type == ex_def && e->e.def->constant
&& is_integral (e->e.def->type)) {
return 1; return 1;
}
return 0; return 0;
} }
@ -1072,6 +1075,10 @@ expr_integer (expr_t *e)
&& is_integral (e->e.symbol->s.def->type)) { && is_integral (e->e.symbol->s.def->type)) {
return D_INT (e->e.symbol->s.def); return D_INT (e->e.symbol->s.def);
} }
if (e->type == ex_def && e->e.def->constant
&& is_integral (e->e.def->type)) {
return D_INT (e->e.def);
}
internal_error (e, "not an integer constant"); internal_error (e, "not an integer constant");
} }
@ -1093,6 +1100,10 @@ expr_uinteger (expr_t *e)
&& is_integral (e->e.symbol->s.def->type)) { && is_integral (e->e.symbol->s.def->type)) {
return D_INT (e->e.symbol->s.def); return D_INT (e->e.symbol->s.def);
} }
if (e->type == ex_def && e->e.def->constant
&& is_integral (e->e.def->type)) {
return D_INT (e->e.def);
}
internal_error (e, "not an unsigned constant"); internal_error (e, "not an unsigned constant");
} }