qbe

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

commit 3ef269315409c698a1e0f689722136dcd974fe36
parent 2d5c07fa4e9bf8ae4ee31652ef61fa4e2003b3e7
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Thu,  1 Oct 2015 13:19:09 -0400

support negative frame offsets in emit

They are used to access function parameters passed
on the stack.

Diffstat:
Mlisc/emit.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisc/emit.c b/lisc/emit.c @@ -83,10 +83,16 @@ Next: break; case RSlot: Slot: { + int off; struct { int i:14; } x = {ref.val}; /* fixme */ assert(NAlign == 3); - assert(fn->slot >= x.i); - fprintf(f, "%d(%%rbp)", -4 * (fn->slot - x.i)); + if (x.i < 0) + off = -4 * x.i; + else { + assert(fn->slot >= x.i); + off = -4 * (fn->slot - x.i); + } + fprintf(f, "%d(%%rbp)", off); break; } case RCon: