Experiments with save/restore registers for call8

This commit is contained in:
Olof Astrand
2020-07-14 14:13:04 +02:00
parent 4c65ae60c5
commit 7c0d6f329d
2 changed files with 25 additions and 0 deletions

View File

@@ -4,6 +4,13 @@ define alignment=1;
define space ram type=ram_space size=4 default;
define space register type=register_space size=4;
define space special_register type=ram_space size=4;
define space save_register type=ram_space size=4;
# Address registers (AR).
define save_register offset=0x0000 size=4 [
sa0 sa1 sa2 sa3 sa4 sa5 sa6 sa7 sa8 sa9 sa10 sa11 sa12 sa13 sa14 sa15
];
# Address registers (AR).
define register offset=0x0000 size=4 [

View File

@@ -11,6 +11,22 @@ macro popVal(val32) {
}
macro save() {
sa3 = a3;
sa4 = a4;
sa5 = a5;
sa6 = a6;
sa7 = a7;
}
macro restore() {
a3 = sa3;
a4 = sa4;
a5 = sa5;
a6 = sa6;
a7 = sa7;
}
## Windowed Register Option ##
@@ -28,6 +44,7 @@ macro popVal(val32) {
# CALL8 - Call PC-relative, Rotate Window by 8, pg. 300.
:call8 srel_6.23_sb2 is srel_6.23_sb2 & u2_4.5 = 0b10 & op0 = 0b0101 {
local dst = srel_6.23_sb2;
save();
#s2=a2;
#s3=a3;
#s4=a4;
@@ -42,6 +59,7 @@ macro popVal(val32) {
a7=a15;
a0 = inst_start + 3;
call [dst];
restore();
}
# CALL12 - Call PC-relative, Rotate Window by 12, pg. 302.