mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
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:
parent
13f09b10d6
commit
7b1850917d
3 changed files with 45 additions and 0 deletions
|
@ -54,6 +54,7 @@
|
|||
#include "strpool.h"
|
||||
#include "symtab.h"
|
||||
#include "type.h"
|
||||
#include "value.h"
|
||||
|
||||
static daglabel_t *free_labels;
|
||||
static dagnode_t *free_nodes;
|
||||
|
@ -372,6 +373,16 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n)
|
|||
first_param = 2;
|
||||
} else if (!strncmp (n->label->opcode, "<CALL", 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)) {
|
||||
for (i = first_param; i < *num_params - '0'; i++) {
|
||||
|
|
|
@ -25,6 +25,7 @@ test_progs_dat=\
|
|||
deadbool.dat \
|
||||
infloop.dat \
|
||||
modulo.dat \
|
||||
return-ivar.dat \
|
||||
structlive.dat \
|
||||
structptr.dat \
|
||||
vecinit.dat \
|
||||
|
@ -84,6 +85,13 @@ modulo.dat: $(modulo_obj) $(QFCC_DEP)
|
|||
modulo.run: Makefile 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_obj=$(structlive_dat_SOURCES:.r=.qfo)
|
||||
structlive.dat: $(structlive_obj) $(QFCC_DEP)
|
||||
|
|
26
tools/qfcc/test/return-ivar.r
Normal file
26
tools/qfcc/test/return-ivar.r
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue