Remove GETRET; values are now returned directly by CALL. Fix a bug in
convertstackops which was resulting in duplicate IR groups.
This commit is contained in:
parent
ceb938fb3c
commit
2d52b1fdaa
|
@ -130,9 +130,9 @@ DECLARATIONS
|
|||
|
||||
cr;
|
||||
ubyteX; /* bottom 8 bits valid, the rest undefined */
|
||||
ubyte0; /* bottom 8 bits valid, the rest 0 */
|
||||
ubyte0; /* bottom 8 bits valid, the rest 0 */
|
||||
ushortX; /* bottom 16 bits valid, the rest undefined */
|
||||
ushort0; /* bottom 16 bits valid, the rest 0 */
|
||||
ushort0; /* bottom 16 bits valid, the rest 0 */
|
||||
|
||||
address fragment;
|
||||
|
||||
|
@ -181,14 +181,6 @@ PATTERNS
|
|||
emit "! setret8"
|
||||
cost 1;
|
||||
|
||||
(ret)reg = GETRET4
|
||||
emit "! getret4"
|
||||
cost 1;
|
||||
|
||||
(pret)reg = GETRET8
|
||||
emit "! getret8"
|
||||
cost 1;
|
||||
|
||||
STACKADJUST4(delta:CONST4)
|
||||
when signed_constant(%delta, 16)
|
||||
emit "addi sp, sp, $delta"
|
||||
|
@ -401,12 +393,34 @@ PATTERNS
|
|||
emit "b $false"
|
||||
cost 8;
|
||||
|
||||
CALL(dest:LABEL4)
|
||||
CALL1(dest:LABEL4)
|
||||
with corrupted(volatile)
|
||||
emit "bl $dest"
|
||||
cost 4;
|
||||
|
||||
CALL(dest:(int)reg)
|
||||
out:(ret)reg = CALL4(dest:LABEL4)
|
||||
with corrupted(volatile)
|
||||
emit "bl $dest"
|
||||
cost 4;
|
||||
|
||||
out:(pret)reg = CALL8(dest:LABEL4)
|
||||
with corrupted(volatile)
|
||||
emit "bl $dest"
|
||||
cost 4;
|
||||
|
||||
CALL1(dest:(int)reg)
|
||||
with corrupted(volatile)
|
||||
emit "mtspr ctr, %dest"
|
||||
emit "bcctrl 20, 0, 0"
|
||||
cost 8;
|
||||
|
||||
out:(ret)reg = CALL4(dest:(int)reg)
|
||||
with corrupted(volatile)
|
||||
emit "mtspr ctr, %dest"
|
||||
emit "bcctrl 20, 0, 0"
|
||||
cost 8;
|
||||
|
||||
out:(pret)reg = CALL8(dest:(int)reg)
|
||||
with corrupted(volatile)
|
||||
emit "mtspr ctr, %dest"
|
||||
emit "bcctrl 20, 0, 0"
|
||||
|
|
|
@ -88,7 +88,8 @@ static void convert_block(struct basicblock* bb)
|
|||
for (i=0; i<pushes.count; i++)
|
||||
{
|
||||
struct ir* ir = pushes.item[i].right;
|
||||
*ir = *ir->left;
|
||||
ir->opcode = IR_NOP;
|
||||
ir->size = 0;
|
||||
}
|
||||
|
||||
for (i=0; i<pops.count; i++)
|
||||
|
|
|
@ -4,6 +4,7 @@ static struct basicblock* current_bb;
|
|||
|
||||
static int stackptr;
|
||||
static struct ir* stack[64];
|
||||
static struct ir* lastcall;
|
||||
|
||||
static struct ir* convert(struct ir* src, int destsize, int opcodebase);
|
||||
static struct ir* appendir(struct ir* ir);
|
||||
|
@ -237,7 +238,7 @@ static void insn_simple(int opcode)
|
|||
struct ir* dest = pop(EM_pointersize);
|
||||
|
||||
materialise_stack();
|
||||
appendir(
|
||||
lastcall = appendir(
|
||||
new_ir1(
|
||||
IR_CALL, 0,
|
||||
dest
|
||||
|
@ -867,13 +868,9 @@ static void insn_ivalue(int opcode, arith value)
|
|||
|
||||
case op_lfr:
|
||||
{
|
||||
push(
|
||||
appendir(
|
||||
new_ir0(
|
||||
IR_GETRET, value
|
||||
)
|
||||
)
|
||||
);
|
||||
assert(lastcall != NULL);
|
||||
lastcall->size = value;
|
||||
push(lastcall);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -918,15 +915,12 @@ static void insn_ivalue(int opcode, arith value)
|
|||
}
|
||||
|
||||
materialise_stack();
|
||||
appendir(
|
||||
new_ir1(
|
||||
IR_CALL, 0,
|
||||
new_labelir(helper)
|
||||
)
|
||||
);
|
||||
push(
|
||||
new_ir0(
|
||||
IR_GETRET, EM_wordsize
|
||||
appendir(
|
||||
new_ir1(
|
||||
IR_CALL, EM_wordsize,
|
||||
new_labelir(helper)
|
||||
)
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
@ -1198,7 +1192,7 @@ static void insn_lvalue(int opcode, const char* label, arith offset)
|
|||
case op_cal:
|
||||
assert(offset == 0);
|
||||
materialise_stack();
|
||||
appendir(
|
||||
lastcall = appendir(
|
||||
new_ir1(
|
||||
IR_CALL, 0,
|
||||
new_labelir(label)
|
||||
|
|
|
@ -102,7 +102,7 @@ S IFLT
|
|||
S IFLE
|
||||
|
||||
# Procedures
|
||||
V CALL
|
||||
S CALL
|
||||
|
||||
# Flow control --- these never return
|
||||
V JUMP
|
||||
|
@ -113,7 +113,6 @@ V RET
|
|||
|
||||
# Special
|
||||
S STACKADJUST
|
||||
S GETRET
|
||||
S SETRET
|
||||
S GETFP
|
||||
S GETSP
|
||||
|
|
Loading…
Reference in a new issue