qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit b19b9a27a0efa7d46eda31d0bb81ade955d80e99
parent d1c6c305f7244775541c3ba6e0422e9a0bb5d521
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Fri, 18 Mar 2016 14:44:20 -0400

handle padding correctly in types

Diffstat:
Mlisc/isel.c | 8++++++--
Mlisc/lisc.h | 5+++--
Mlisc/parse.c | 5+++--
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisc/isel.c b/lisc/isel.c @@ -395,10 +395,14 @@ aclass(AClass *a, Typ *t) for (e=0, s=0; e<2; e++) { cls = -1; for (n=0; n<8 && t->seg[s].len; s++) { - if (t->seg[s].flt) { + if (t->seg[s].ispad) { + /* don't change anything */ + } + else if (t->seg[s].isflt) { if (cls == -1) cls = Kd; - } else + } + else cls = Kl; n += t->seg[s].len; } diff --git a/lisc/lisc.h b/lisc/lisc.h @@ -435,8 +435,9 @@ struct Typ { int align; struct { - uint flt:1; - uint len:31; + uint isflt:1; + uint ispad:1; + uint len:30; } seg[NSeg+1]; }; diff --git a/lisc/parse.c b/lisc/parse.c @@ -745,7 +745,7 @@ parsetyp() a = s - a; if (++n < NSeg) { /* padding segment */ - ty->seg[n].flt = 0; + ty->seg[n].ispad = 1; ty->seg[n].len = a; } } @@ -757,7 +757,8 @@ parsetyp() c = 1; while (c-- > 0) { if (++n < NSeg) { - ty->seg[n].flt = flt; + ty->seg[n].isflt = flt; + ty->seg[n].ispad = 0; ty->seg[n].len = s; } sz += a + s;