Commit d5d09486 authored by John van Groningen's avatar John van Groningen
Browse files

add function repl_r_a_args_n_a to push the pointers of a record on the A stack...

add function repl_r_a_args_n_a to push the pointers of a record on the A stack and yield the number of these pointers
parent 8952630c
......@@ -327,6 +327,7 @@ start_address:
.globl printD
.globl DtoAC
.globl push_t_r_args
.globl repl_r_a_args_n_a
.globl push_a_r_args
.globl halt
.globl dump
......@@ -1378,6 +1379,44 @@ push_r_a_elements:
ret x29
repl_r_a_args_n_a:
ldr x9,[x8]
mov x29,x30
ldr x30,[x28],#8
ldrh w6,[x9]
cmp x6,#0
beq repl_r_a_args_n_a_0
cmp x6,#2
blo repl_r_a_args_n_a_1
ldr x10,[x8,#16]
beq repl_r_a_args_n_a_2
sub x5,x6,#1
add x9,x10,x5,lsl #3
repl_r_a_args_n_a_4:
ldr x10,[x9,#-8]!
str x10,[x26],#8
subs x5,x5,#1
jne repl_r_a_args_n_a_4
repl_r_a_args_n_a_1:
ldr x10,[x8,#8]
str x10,[x26],#8
repl_r_a_args_n_a_0:
ret x29
repl_r_a_args_n_a_2:
ldrh w5,[x9,#-2]
cmp x5,#258
beq repl_r_a_args_n_a_3
ldr x10,[x10]
repl_r_a_args_n_a_3:
str x10,[x26],#8
b repl_r_a_args_n_a_1
BtoAC:
tst x6,x6
beq BtoAC_false
......
......@@ -334,6 +334,7 @@ start_address:
.globl printD
.globl DtoAC
.globl push_t_r_args
.globl repl_r_a_args_n_a
.globl push_a_r_args
.globl halt
.globl dump
......@@ -1406,6 +1407,40 @@ push_r_a_elements:
ldr r4,[sp],#4
ldr pc,[sp],#4
repl_r_a_args_n_a:
ldr r7,[r6]
ldrh r4,[r7]
cmp r4,#0
beq repl_r_a_args_n_a_0
cmp r4,#2
blo repl_r_a_args_n_a_1
ldr r8,[r6,#4]
beq repl_r_a_args_n_a_2
sub r3,r4,#1
add r7,r8,r3,lsl #2
repl_r_a_args_n_a_4:
ldr r8,[r7,#-4]!
str r8,[r9],#4
subs r3,r3,#1
jne repl_r_a_args_n_a_4
repl_r_a_args_n_a_1:
ldr r8,[r6,#4]
str r8,[r9],#4
repl_r_a_args_n_a_0:
ldr pc,[sp],#4
repl_r_a_args_n_a_2:
ldrb r3,[r7,#-2]
cmp r3,#2
beq repl_r_a_args_n_a_3
ldr r8,[r8]
repl_r_a_args_n_a_3:
str r8,[r9],#4
b repl_r_a_args_n_a_1
BtoAC:
tst r4,r4
beq BtoAC_false
......
......@@ -424,6 +424,7 @@ _DATA ends
public printD
public DtoAC
public push_t_r_args
public repl_r_a_args_n_a
public push_a_r_args
public halt
public dump
......@@ -1903,6 +1904,43 @@ push_r_a_elements:
pop rax
ret
repl_r_a_args_n_a:
mov rdx,qword ptr [rcx]
movzx rax,word ptr [rdx]
test rax,rax
je repl_r_a_args_n_a_0
cmp rax,2
jb repl_r_a_args_n_a_1
mov rbp,16[rcx]
je repl_r_a_args_n_a_2
lea rdx,(-8)[rbp+rax*8]
lea rbx,(-1)[rax]
repl_r_a_args_n_a_4:
mov rbp,(-8)[rdx]
sub rdx,8
mov [rsi],rbp
add rsi,8
dec rbx
jne repl_r_a_args_n_a_4
repl_r_a_args_n_a_1:
mov rbp,8[rcx]
mov [rsi],rbp
add rsi,8
repl_r_a_args_n_a_0:
ret
repl_r_a_args_n_a_2:
cmp word ptr (-2)[rdx],258
je repl_r_a_args_n_a_3
mov rbp,[rbp]
repl_r_a_args_n_a_3:
mov [rsi],rbp
add rsi,8
jmp repl_r_a_args_n_a_1
BtoAC:
test al,al
je BtoAC_false
......
......@@ -412,6 +412,7 @@ start_address:
.globl printD
.globl DtoAC
.globl push_t_r_args
.globl repl_r_a_args_n_a
.globl push_a_r_args
.globl halt
.globl @halt
......@@ -1489,6 +1490,43 @@ push_r_a_elements:
popl d0
ret
repl_r_a_args_n_a:
movl (a0),a1
movzwl 2(a1),d0
test d0,d0
je repl_r_a_args_n_a_0
cmp $2,d0
jb repl_r_a_args_n_a_1
movl 8(a0),a2
je repl_r_a_args_n_a_2
lea -4(a2,d0,4),a1
lea -1(d0),d1
repl_r_a_args_n_a_4:
movl -4(a1),a2
subl $4,a1
movl a2,(a3)
addl $4,a3
dec d1
jne repl_r_a_args_n_a_4
repl_r_a_args_n_a_1:
movl 4(a0),a2
movl a2,(a3)
addl $4,a3
repl_r_a_args_n_a_0:
ret
repl_r_a_args_n_a_2:
cmpw $258,-2(a1)
je repl_r_a_args_n_a_3
movl (a2),a2
repl_r_a_args_n_a_3:
movl a2,(a3)
addl $4,a3
jmp repl_r_a_args_n_a_1
BtoAC:
testb d0b,d0b
je BtoAC_false
......
......@@ -473,6 +473,7 @@ _profile_current_cost_centre:
.globl printD
.globl DtoAC
.globl push_t_r_args
.globl repl_r_a_args_n_a
.globl push_a_r_args
.globl halt
.globl dump
......@@ -1828,6 +1829,43 @@ push_r_a_elements:
pop rax
ret
repl_r_a_args_n_a:
mov rdx,qword ptr [rcx]
movzx rax,word ptr [rdx]
test rax,rax
att_je repl_r_a_args_n_a_0
cmp rax,2
att_jb repl_r_a_args_n_a_1
mov rbp,[rcx+16]
att_je repl_r_a_args_n_a_2
lea rdx,[rbp+rax*8-8]
lea rbx,[rax-1]
repl_r_a_args_n_a_4:
mov rbp,[rdx-8]
sub rdx,8
mov [rsi],rbp
add rsi,8
dec rbx
att_jne repl_r_a_args_n_a_4
repl_r_a_args_n_a_1:
mov rbp,[rcx+8]
mov [rsi],rbp
add rsi,8
repl_r_a_args_n_a_0:
ret
repl_r_a_args_n_a_2:
cmp word ptr [rdx-2],258
att_je repl_r_a_args_n_a_3
mov rbp,[rbp]
repl_r_a_args_n_a_3:
mov [rsi],rbp
add rsi,8
att_jmp repl_r_a_args_n_a_1
BtoAC:
test al,al
je BtoAC_false
......
......@@ -338,6 +338,7 @@ start_address:
.globl printD
.globl DtoAC
.globl push_t_r_args
.globl repl_r_a_args_n_a
.globl push_a_r_args
.globl halt
.globl dump
......@@ -1437,6 +1438,40 @@ push_r_a_elements:
ldr r1,[sp],#4
pop {pc}
repl_r_a_args_n_a:
ldr r3,[r2]
ldrh r1,[r3]
cmp r1,#0
beq repl_r_a_args_n_a_0
cmp r1,#2
blo repl_r_a_args_n_a_1
ldr r4,[r2,#4]
beq repl_r_a_args_n_a_2
sub r1,r0,#1
add r3,r4,r1,lsl #2
repl_r_a_args_n_a_4:
ldr r4,[r3,#-4]!
str r4,[r5],#4
subs r0,r0,#1
jne repl_r_a_args_n_a_4
repl_r_a_args_n_a_1:
ldr r4,[r2,#4]
str r4,[r5],#4
repl_r_a_args_n_a_0:
pop {pc}
repl_r_a_args_n_a_2:
ldrb r1,[r3,#-2]
cmp r1,#2
beq repl_r_a_args_n_a_3
ldr r4,[r4]
repl_r_a_args_n_a_3:
str r4,[r5],#4
b repl_r_a_args_n_a_1
BtoAC:
tst r1,r1
beq BtoAC_false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment