From 56e3933feeb8837461d81ca78c8d8a138ff94cd2 Mon Sep 17 00:00:00 2001 From: Anders Magnusson Date: Mon, 29 Oct 2007 16:36:23 +0000 Subject: 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). --- usr.bin/pcc/mip/optim2.c | 5 +++-- usr.bin/pcc/mip/reader.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'usr.bin') 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&"); -- cgit v1.2.3