summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAnders Magnusson <ragge@cvs.openbsd.org>2007-10-29 16:36:23 +0000
committerAnders Magnusson <ragge@cvs.openbsd.org>2007-10-29 16:36:23 +0000
commit56e3933feeb8837461d81ca78c8d8a138ff94cd2 (patch)
tree7bf8f0338d77be836f7bf915767107bac635dfc3 /usr.bin
parentf2d4d50433f1f93a99e18ff5273855ba5561c778 (diff)
Updates from master repo:
> Allow ADDROF to fall through to table, for PIC code generation. > Tighten check on GOTO argument and only complain that the label is out-of-range > if we are actually jumping to label (ICON).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/pcc/mip/optim2.c5
-rw-r--r--usr.bin/pcc/mip/reader.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/pcc/mip/optim2.c b/usr.bin/pcc/mip/optim2.c
index c0401d478db..9d155a95a65 100644
--- a/usr.bin/pcc/mip/optim2.c
+++ b/usr.bin/pcc/mip/optim2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: optim2.c,v 1.3 2007/10/01 18:51:02 otto Exp $ */
+/* $OpenBSD: optim2.c,v 1.4 2007/10/29 16:36:22 ragge Exp $ */
/*
* Copyright (c) 2004 Anders Magnusson (ragge@ludd.luth.se).
* All rights reserved.
@@ -597,7 +597,8 @@ cfg_build(struct labelinfo *labinfo)
pnode->bblock = bb;
if ((bb->last->type == IP_NODE) &&
- (bb->last->ip_node->n_op == GOTO)) {
+ (bb->last->ip_node->n_op == GOTO) &&
+ (bb->last->ip_node->n_left->n_op == ICON)) {
if (bb->last->ip_node->n_left->n_lval - labinfo->low >
labinfo->size) {
comperr("Label out of range: %d, base %d",
diff --git a/usr.bin/pcc/mip/reader.c b/usr.bin/pcc/mip/reader.c
index 8ea4e1af50c..69d3a5b30f1 100644
--- a/usr.bin/pcc/mip/reader.c
+++ b/usr.bin/pcc/mip/reader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reader.c,v 1.7 2007/10/23 18:43:00 ragge Exp $ */
+/* $OpenBSD: reader.c,v 1.8 2007/10/29 16:36:22 ragge Exp $ */
/*
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
* All rights reserved.
@@ -441,6 +441,7 @@ again: switch (o = p->n_op) {
case STARG:
case UCALL:
case USTCALL:
+ case ADDROF:
rv = finduni(p, cookie);
break;
@@ -839,7 +840,7 @@ deltemp(NODE *p)
p->n_op = OREG;
p->n_rval = FPREG;
p->n_lval = w->tempaddr;
- } else if (p->n_op == ADDROF) {
+ } else if (p->n_op == ADDROF && p->n_left->n_op != NAME) {
/* TEMPs are already converted to OREGs */
if ((l = p->n_left)->n_op != OREG)
comperr("bad U&");