logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 753bb3880e9e45df07e965246a6d2d610e0985f0
parent 97a32b15ad96a127d7afdeddbfa67857e85957e4
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 21 Feb 2019 22:44:44 -0800

qbe: Update to latest git and add a few patches

Diffstat:

M.gitmodules1+
Apkg/qbe/patch/0001-Increase-maximum-string-length.patch28++++++++++++++++++++++++++++
Apkg/qbe/patch/0002-amd64-Make-floating-constants-their-own-temporaries.patch29+++++++++++++++++++++++++++++
Apkg/qbe/patch/0003-Rearrange-the-fields-in-Ins-so-the-bit-fields-get-pa.patch104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpkg/qbe/rev2+-
5 files changed, 163 insertions(+), 1 deletion(-)

diff --git a/.gitmodules b/.gitmodules @@ -198,6 +198,7 @@ [submodule "pkg/qbe/src"] path = pkg/qbe/src url = git://c9x.me/qbe.git + ignore = all [submodule "pkg/samurai/src"] path = pkg/samurai/src url = https://github.com/michaelforney/samurai diff --git a/pkg/qbe/patch/0001-Increase-maximum-string-length.patch b/pkg/qbe/patch/0001-Increase-maximum-string-length.patch @@ -0,0 +1,28 @@ +From 9a5f78919d8d37684d653a8ef1da47a8bfd556a9 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 31 Jan 2019 18:00:24 -0800 +Subject: [PATCH] Increase maximum string length + +The C standard requires that implementations support internal identifiers +at least 63 characters long, so QBE should allow for identifiers at +least that long. +--- + all.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/all.h b/all.h +index 24a1755..1364024 100644 +--- a/all.h ++++ b/all.h +@@ -31,7 +31,7 @@ typedef struct Dat Dat; + typedef struct Target Target; + + enum { +- NString = 32, ++ NString = 64, + NPred = 63, + NIns = 1 << 20, + NAlign = 3, +-- +2.20.1 + diff --git a/pkg/qbe/patch/0002-amd64-Make-floating-constants-their-own-temporaries.patch b/pkg/qbe/patch/0002-amd64-Make-floating-constants-their-own-temporaries.patch @@ -0,0 +1,29 @@ +From 90c037be8ee0ec9c16d035fc067a8aa9554ea2c7 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Wed, 13 Feb 2019 16:39:52 -0800 +Subject: [PATCH] amd64: Make floating constants their own temporaries + +Otherwise, we may attempt a memory-to-memory mov if trying to save the +constant to a slot (for example a spilled phi with a constant float +argument). +--- + amd64/isel.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/amd64/isel.c b/amd64/isel.c +index 6aea850..babcd65 100644 +--- a/amd64/isel.c ++++ b/amd64/isel.c +@@ -84,6 +84,9 @@ fixarg(Ref *r, int k, int op, Fn *fn) + sprintf(buf, "fp%d", n); + a.offset.label = intern(buf); + fn->mem[fn->nmem-1] = a; ++ r0 = r1; ++ r1 = newtmp("isel", k, fn); ++ emit(Ocopy, k, r1, r0, R); + } + else if (!cpy && k == Kl && noimm(r0, fn)) { + /* load constants that do not fit in +-- +2.20.1 + diff --git a/pkg/qbe/patch/0003-Rearrange-the-fields-in-Ins-so-the-bit-fields-get-pa.patch b/pkg/qbe/patch/0003-Rearrange-the-fields-in-Ins-so-the-bit-fields-get-pa.patch @@ -0,0 +1,104 @@ +From 6324d4f3607c3faf05c09f18fcef0b162b212e86 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 14 Feb 2019 13:23:28 -0800 +Subject: [PATCH] Rearrange the fields in Ins so the bit-fields get packed + together + +--- + all.h | 2 +- + amd64/sysv.c | 2 +- + arm64/abi.c | 5 +---- + load.c | 2 +- + parse.c | 12 ++++++------ + 5 files changed, 10 insertions(+), 13 deletions(-) + +diff --git a/all.h b/all.h +index 1364024..668bb77 100644 +--- a/all.h ++++ b/all.h +@@ -197,9 +197,9 @@ struct Op { + + struct Ins { + uint op:30; ++ uint cls:2; + Ref to; + Ref arg[2]; +- uint cls:2; + }; + + struct Phi { +diff --git a/amd64/sysv.c b/amd64/sysv.c +index d70e70d..86c59bf 100644 +--- a/amd64/sysv.c ++++ b/amd64/sysv.c +@@ -345,7 +345,7 @@ selcall(Fn *fn, Ins *i0, Ins *i1, RAlloc **rap) + ra = alloc(sizeof *ra); + /* specific to NAlign == 3 */ + al = aret.align >= 2 ? aret.align - 2 : 0; +- ra->i = (Ins){Oalloc+al, r1, {getcon(aret.size, fn)}, Kl}; ++ ra->i = (Ins){Oalloc+al, Kl, r1, {getcon(aret.size, fn)}}; + ra->link = (*rap); + *rap = ra; + } else { +diff --git a/arm64/abi.c b/arm64/abi.c +index 1c97ef3..6eb40e3 100644 +--- a/arm64/abi.c ++++ b/arm64/abi.c +@@ -313,10 +313,7 @@ stkblob(Ref r, Class *c, Fn *fn, Insl **ilp) + al = c->t->align - 2; /* NAlign == 3 */ + if (al < 0) + al = 0; +- il->i = (Ins){ +- Oalloc + al, r, +- {getcon(c->t->size, fn)}, Kl +- }; ++ il->i = (Ins){Oalloc + al, Kl, r, {getcon(c->t->size, fn)}}; + il->link = *ilp; + *ilp = il; + } +diff --git a/load.c b/load.c +index 504b2d8..6f5b6ab 100644 +--- a/load.c ++++ b/load.c +@@ -77,7 +77,7 @@ iins(int cls, int op, Ref a0, Ref a1, Loc *l) + ist->num = inum++; + ist->bid = l->blk->id; + ist->off = l->off; +- ist->new.ins = (Ins){op, R, {a0, a1}, cls}; ++ ist->new.ins = (Ins){op, cls, R, {a0, a1}}; + return ist->new.ins.to = newtmp("ld", cls, curf); + } + +diff --git a/parse.c b/parse.c +index 3c4200e..b0cdd8c 100644 +--- a/parse.c ++++ b/parse.c +@@ -452,19 +452,19 @@ parserefl(int arg) + err("invalid function parameter"); + if (k == 4) + if (arg) +- *curi = (Ins){Oargc, R, {TYPE(ty), r}, Kl}; ++ *curi = (Ins){Oargc, Kl, R, {TYPE(ty), r}}; + else +- *curi = (Ins){Oparc, r, {TYPE(ty)}, Kl}; ++ *curi = (Ins){Oparc, Kl, r, {TYPE(ty)}}; + else if (env) + if (arg) +- *curi = (Ins){Oarge, R, {r}, k}; ++ *curi = (Ins){Oarge, k, R, {r}}; + else +- *curi = (Ins){Opare, r, {R}, k}; ++ *curi = (Ins){Opare, k, r, {R}}; + else + if (arg) +- *curi = (Ins){Oarg, R, {r}, k}; ++ *curi = (Ins){Oarg, k, R, {r}}; + else +- *curi = (Ins){Opar, r, {R}, k}; ++ *curi = (Ins){Opar, k, r, {R}}; + curi++; + hasenv |= env; + if (peek() == Trparen) +-- +2.20.1 + diff --git a/pkg/qbe/rev b/pkg/qbe/rev @@ -1 +1 @@ -10 +11