More opcodes.

This commit is contained in:
David Given 2016-10-22 11:26:28 +02:00
parent 7ae888b754
commit ceb938fb3c
3 changed files with 89 additions and 0 deletions

View file

@ -194,6 +194,10 @@ PATTERNS
emit "addi sp, sp, $delta"
cost 4;
STACKADJUST4(in:(int)reg)
emit "add sp, sp, %in"
cost 4;
out:(int)reg = GETFP4
emit "mr %out, fp"
cost 4;
@ -206,6 +210,14 @@ PATTERNS
emit "addi %out, %in, 8"
cost 4;
out:(int)reg = GETSP4
emit "mr %out, sp"
cost 4;
SETSP4(in:(int)reg)
emit "mr sp, %in"
cost 4;
/* Memory operations */

View file

@ -817,6 +817,15 @@ static void insn_ivalue(int opcode, arith value)
break;
}
case op_ass:
appendir(
new_ir1(
IR_STACKADJUST, EM_pointersize,
pop(value)
)
);
break;
case op_ret:
{
if (value > 0)
@ -1015,6 +1024,72 @@ static void insn_ivalue(int opcode, arith value)
break;
}
case op_lor:
{
switch (value)
{
case 1:
appendir(
new_ir0(
IR_GETSP, EM_pointersize
)
);
break;
default:
fatal("'lor %d' not supported", value);
}
break;
}
case op_str:
{
switch (value)
{
case 1:
appendir(
new_ir1(
IR_SETSP, EM_pointersize,
pop(EM_pointersize)
)
);
break;
default:
fatal("'str %d' not supported", value);
}
break;
}
case op_blm:
{
/* Input stack: ( src dest -- ) */
/* Memmove stack: ( size src dest -- ) */
struct ir* dest = pop(EM_pointersize);
struct ir* src = pop(EM_pointersize);
push(new_wordir(value));
push(src);
push(dest);
materialise_stack();
appendir(
new_ir1(
IR_CALL, 0,
new_labelir("memmove")
)
);
appendir(
new_ir1(
IR_STACKADJUST, EM_pointersize,
new_wordir(EM_pointersize*2 + EM_wordsize)
)
);
break;
}
case op_lin:
{
/* Set line number --- ignore. */

View file

@ -116,6 +116,8 @@ S STACKADJUST
S GETRET
S SETRET
S GETFP
S GETSP
S SETSP
S CHAINFP
S FPTOARGS