ref: 4fc4ebc1ca4f375c6f9b1d8babb53e03da51214f
parent: cd2bb9016e9aaa3ccf69e17a206d5a25ac1fd6f1
author: Ori Bernstein <[email protected]>
date: Fri Jun 15 11:35:49 EDT 2012
Slices work for both read and write through. Or so it seems. However, Oslbase, Osllen are now disallowed after tree reduction.
--- a/8/isel.c
+++ b/8/isel.c
@@ -245,9 +245,12 @@
}
/* We have a few common cases to optimize here:
+ * Oaddr(expr)
+ * or:
* Oadd(
* reg,
* reg||const))
+ *
* or:
* Oadd(
* reg,
@@ -281,8 +284,10 @@
scale = 1;
l = NULL;
- if (exprop(e) == Oadd) {
- args = e->expr.args;
+ args = e->expr.args;
+ if (exprop(e) == Oaddr) {
+ l = selexpr(s, args[0]);
+ } else if (exprop(e) == Oadd) {
b = selexpr(s, args[0]);
if (ismergablemul(args[1], &scale))
o = selexpr(s, args[1]->expr.args[0]);
@@ -739,7 +744,7 @@
is.curbb = is.bb[j];
for (i = 0; i < fn->cfg->bb[j]->nnl; i++) {
isel(&is, fn->cfg->bb[j]->nl[i]);
- //g(&is, Ilbl, locstrlbl("_"), NULL);
+ g(&is, Ilbl, locstrlbl("#_"), NULL);
}
}
is.curbb = is.bb[is.nbb - 1];
--- a/8/reduce.c
+++ b/8/reduce.c
@@ -306,7 +306,7 @@
if (args[0]->expr.type->type == Tyarray)
t = mkexpr(-1, Oaddr, args[0], NULL);
else if (args[0]->expr.type->type == Tyslice)
- t = mkexpr(-1, Oslbase, args[0], NULL);
+ t = mkexpr(-1, Oload, mkexpr(1, Oaddr, args[0], NULL), NULL);
else
die("Can't index type %s\n", tystr(n->expr.type));
u = rval(s, args[1]);