Force RETURN's operand to be live.

This seems to be the final fix to get return-ivar.r working.
This commit is contained in:
Bill Currie 2012-12-20 21:01:46 +09:00
parent 13f09b10d6
commit 7b1850917d
3 changed files with 45 additions and 0 deletions

View file

@ -54,6 +54,7 @@
#include "strpool.h" #include "strpool.h"
#include "symtab.h" #include "symtab.h"
#include "type.h" #include "type.h"
#include "value.h"
static daglabel_t *free_labels; static daglabel_t *free_labels;
static dagnode_t *free_nodes; static dagnode_t *free_nodes;
@ -372,6 +373,16 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n)
first_param = 2; first_param = 2;
} else if (!strncmp (n->label->opcode, "<CALL", 5)) { } else if (!strncmp (n->label->opcode, "<CALL", 5)) {
num_params = n->label->opcode + 5; num_params = n->label->opcode + 5;
} else if (!strcmp (n->label->opcode, "<RETURN>")) {
daglabel_t *label = n->children[0]->label;
if (!label->op) {
set_iter_t *lab_i;
for (lab_i = set_first (n->children[0]->identifiers); lab_i;
lab_i = set_next (lab_i)) {
label = dag->labels[lab_i->value];
}
}
label->live = 1;
} }
if (num_params && isdigit (*num_params)) { if (num_params && isdigit (*num_params)) {
for (i = first_param; i < *num_params - '0'; i++) { for (i = first_param; i < *num_params - '0'; i++) {

View file

@ -25,6 +25,7 @@ test_progs_dat=\
deadbool.dat \ deadbool.dat \
infloop.dat \ infloop.dat \
modulo.dat \ modulo.dat \
return-ivar.dat \
structlive.dat \ structlive.dat \
structptr.dat \ structptr.dat \
vecinit.dat \ vecinit.dat \
@ -84,6 +85,13 @@ modulo.dat: $(modulo_obj) $(QFCC_DEP)
modulo.run: Makefile build-run modulo.run: Makefile build-run
TEST_HARNESS_OPTS=--float $(srcdir)/build-run $@ TEST_HARNESS_OPTS=--float $(srcdir)/build-run $@
return_ivar_dat_SOURCES=return-ivar.r
return_ivar_obj=$(return_ivar_dat_SOURCES:.r=.qfo)
return-ivar.dat: $(return_ivar_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(return_ivar_obj)
return-ivar.run: Makefile build-run
$(srcdir)/build-run $@
structlive_dat_SOURCES=structlive.r structlive_dat_SOURCES=structlive.r
structlive_obj=$(structlive_dat_SOURCES:.r=.qfo) structlive_obj=$(structlive_dat_SOURCES:.r=.qfo)
structlive.dat: $(structlive_obj) $(QFCC_DEP) structlive.dat: $(structlive_obj) $(QFCC_DEP)

View file

@ -0,0 +1,26 @@
typedef struct Point {
int x;
int y;
} Point;
@interface Object //just so the runtime doesn't complain
{
Class isa;
Point origin;
}
-(Point) origin;
@end
@implementation Object
-(Point) origin
{
Point p;
p = origin;
return p;
}
@end
void __obj_exec_class (struct obj_module *msg) = #0;
int main()
{
return 0;
}