summaryrefslogtreecommitdiff
path: root/src/cmd/5g/gsubr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/5g/gsubr.c')
-rw-r--r--src/cmd/5g/gsubr.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/cmd/5g/gsubr.c b/src/cmd/5g/gsubr.c
index 445825625..37e9db126 100644
--- a/src/cmd/5g/gsubr.c
+++ b/src/cmd/5g/gsubr.c
@@ -957,15 +957,16 @@ naddr(Node *n, Addr *a)
a->offset = n->xoffset;
break;
-// case OPARAM:
-// // n->left is PHEAP ONAME for stack parameter.
-// // compute address of actual parameter on stack.
-// a->etype = simtype[n->left->type->etype];
-// a->width = n->left->type->width;
-// a->offset = n->xoffset;
-// a->sym = n->left->sym;
-// a->type = D_PARAM;
-// break;
+ case OPARAM:
+ // n->left is PHEAP ONAME for stack parameter.
+ // compute address of actual parameter on stack.
+ a->etype = simtype[n->left->type->etype];
+ a->width = n->left->type->width;
+ a->offset = n->xoffset;
+ a->sym = n->left->sym;
+ a->type = D_OREG;
+ a->name = D_PARAM;
+ break;
case ONAME:
a->etype = 0;
@@ -1606,7 +1607,11 @@ oindex:
if(o & OPtrto)
nodconst(&n2, types[TUINT32], l->type->type->bound);
}
- gins(optoas(OCMP, types[TUINT32]), reg1, &n2);
+ regalloc(&n3, n2.type, N);
+ cgen(&n2, &n3);
+ p1 = gins(optoas(OCMP, types[TUINT32]), reg1, N);
+ raddr(&n3, p1);
+ regfree(&n3);
p1 = gbranch(optoas(OLT, types[TUINT32]), T);
ginscall(throwindex, 0);
patch(p1, pc);
@@ -1648,7 +1653,11 @@ oindex_const:
n1.type = types[tptr];
n1.xoffset = Array_nel;
nodconst(&n2, types[TUINT32], v);
- gins(optoas(OCMP, types[TUINT32]), &n1, &n2);
+ regalloc(&n3, types[TUINT32], N);
+ cgen(&n2, &n3);
+ p1 = gins(optoas(OCMP, types[TUINT32]), &n1, N);
+ raddr(&n3, p1);
+ regfree(&n3);
p1 = gbranch(optoas(OGT, types[TUINT32]), T);
ginscall(throwindex, 0);
patch(p1, pc);