mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-26 21:13:42 +01:00
Rewrite it.
(Logical change 1.55)
This commit is contained in:
parent
818d0241f2
commit
ea8a74ba29
1 changed files with 37 additions and 108 deletions
|
@ -1,109 +1,38 @@
|
|||
#define TEMPLATE(name, code...) \
|
||||
.globl name##_start, name##_end; \
|
||||
name##_start:; \
|
||||
code;; \
|
||||
name##_end:
|
||||
.globl func_add1, func_add1_end
|
||||
.proc func_add1
|
||||
func_add1:
|
||||
{.mib add r8 = 1, r32
|
||||
nop.i 0
|
||||
br.ret.sptk.many rp
|
||||
}
|
||||
func_add1_end:
|
||||
.endp func_add1
|
||||
|
||||
.sdata
|
||||
global_value: data8 0
|
||||
|
||||
.text
|
||||
|
||||
TEMPLATE(get_r4, mov r31 = r4)
|
||||
TEMPLATE(get_r5, mov r31 = r5)
|
||||
TEMPLATE(get_r6, mov r31 = r6)
|
||||
TEMPLATE(get_r7, mov r31 = r7)
|
||||
TEMPLATE(get_r30, mov r31 = r30)
|
||||
TEMPLATE(get_bsp, mov r31 = ar.bsp)
|
||||
TEMPLATE(get_bspstore, \
|
||||
mov r30 = ar.rsc;; mov ar.rsc = 0;; \
|
||||
mov r31 = ar.bspstore;; mov ar.rsc = r30)
|
||||
TEMPLATE(get_pfs, mov r31 = ar.pfs)
|
||||
TEMPLATE(get_rnat, mov r31 = ar.rnat)
|
||||
TEMPLATE(get_unat, mov r31 = ar.unat)
|
||||
TEMPLATE(get_fpsr, mov r31 = ar.fpsr)
|
||||
TEMPLATE(get_lc, mov r31 = ar.lc)
|
||||
TEMPLATE(get_pr, mov r31 = pr)
|
||||
TEMPLATE(get_rp, mov r31 = b0)
|
||||
TEMPLATE(get_b1, mov r31 = b1)
|
||||
TEMPLATE(get_b2, mov r31 = b2)
|
||||
TEMPLATE(get_b3, mov r31 = b3)
|
||||
TEMPLATE(get_b4, mov r31 = b4)
|
||||
TEMPLATE(get_b5, mov r31 = b5)
|
||||
TEMPLATE(get_f2, mov f127 = f2)
|
||||
TEMPLATE(get_f3, mov f127 = f3)
|
||||
TEMPLATE(get_f4, mov f127 = f4)
|
||||
TEMPLATE(get_f5, mov f127 = f5)
|
||||
TEMPLATE(get_f16, mov f127 = f16)
|
||||
TEMPLATE(get_f17, mov f127 = f17)
|
||||
TEMPLATE(get_f18, mov f127 = f18)
|
||||
TEMPLATE(get_f19, mov f127 = f19)
|
||||
TEMPLATE(get_f20, mov f127 = f20)
|
||||
TEMPLATE(get_f21, mov f127 = f21)
|
||||
TEMPLATE(get_f22, mov f127 = f22)
|
||||
TEMPLATE(get_f23, mov f127 = f23)
|
||||
TEMPLATE(get_f24, mov f127 = f24)
|
||||
TEMPLATE(get_f25, mov f127 = f25)
|
||||
TEMPLATE(get_f26, mov f127 = f26)
|
||||
TEMPLATE(get_f27, mov f127 = f27)
|
||||
TEMPLATE(get_f28, mov f127 = f28)
|
||||
TEMPLATE(get_f29, mov f127 = f29)
|
||||
TEMPLATE(get_f30, mov f127 = f30)
|
||||
TEMPLATE(get_f31, mov f127 = f31)
|
||||
|
||||
TEMPLATE(put_r1, mov r1 = r31)
|
||||
TEMPLATE(put_r4, mov r4 = r31)
|
||||
TEMPLATE(put_r5, mov r5 = r31)
|
||||
TEMPLATE(put_r6, mov r6 = r31)
|
||||
TEMPLATE(put_r7, mov r7 = r31)
|
||||
TEMPLATE(put_bsp, mov ar.bsp = r31)
|
||||
TEMPLATE(put_bspstore, \
|
||||
mov r30 = ar.rsc;; mov ar.rsc = 0;; \
|
||||
mov ar.bspstore = r31;; mov ar.rsc = r30)
|
||||
TEMPLATE(put_pfs, mov ar.pfs = r31)
|
||||
TEMPLATE(put_rnat, mov ar.rnat = r31)
|
||||
TEMPLATE(put_unat, mov ar.unat = r31)
|
||||
TEMPLATE(put_fpsr, mov ar.fpsr = r31)
|
||||
TEMPLATE(put_lc, mov ar.lc = r31)
|
||||
TEMPLATE(put_pr, mov pr = r31, -1)
|
||||
TEMPLATE(put_rp, mov b0 = r31)
|
||||
TEMPLATE(put_b1, mov b1 = r31)
|
||||
TEMPLATE(put_b2, mov b2 = r31)
|
||||
TEMPLATE(put_b3, mov b3 = r31)
|
||||
TEMPLATE(put_b4, mov b4 = r31)
|
||||
TEMPLATE(put_b5, mov b5 = r31)
|
||||
TEMPLATE(put_f2, mov f2 = f127)
|
||||
TEMPLATE(put_f3, mov f3 = f127)
|
||||
TEMPLATE(put_f4, mov f4 = f127)
|
||||
TEMPLATE(put_f5, mov f5 = f127)
|
||||
TEMPLATE(put_f16, mov f16 = f127)
|
||||
TEMPLATE(put_f17, mov f17 = f127)
|
||||
TEMPLATE(put_f18, mov f18 = f127)
|
||||
TEMPLATE(put_f19, mov f19 = f127)
|
||||
TEMPLATE(put_f20, mov f20 = f127)
|
||||
TEMPLATE(put_f21, mov f21 = f127)
|
||||
TEMPLATE(put_f22, mov f22 = f127)
|
||||
TEMPLATE(put_f23, mov f23 = f127)
|
||||
TEMPLATE(put_f24, mov f24 = f127)
|
||||
TEMPLATE(put_f25, mov f25 = f127)
|
||||
TEMPLATE(put_f26, mov f26 = f127)
|
||||
TEMPLATE(put_f27, mov f27 = f127)
|
||||
TEMPLATE(put_f28, mov f28 = f127)
|
||||
TEMPLATE(put_f29, mov f29 = f127)
|
||||
TEMPLATE(put_f30, mov f30 = f127)
|
||||
TEMPLATE(put_f31, mov f31 = f127)
|
||||
|
||||
TEMPLATE(load_imm, movl r31 = 0)
|
||||
|
||||
TEMPLATE(store_sprel, add r2 = r30, sp;; st8 [r2] = r31)
|
||||
TEMPLATE(load_sprel, add r2 = r30, sp;; ld8 r31 = [r2])
|
||||
|
||||
TEMPLATE(spill_sprel, add r2 = r30, sp;; st8.spill [r2] = r31)
|
||||
TEMPLATE(fill_sprel, add r2 = r30, sp;; ld8.fill r31 = [r2])
|
||||
|
||||
TEMPLATE(add_sp, add r12 = r30, r12)
|
||||
TEMPLATE(call, mov b6 = r30;; br.call.sptk.many rp = b6)
|
||||
TEMPLATE(ret, br.ret.sptk.many rp)
|
||||
TEMPLATE(alloc_8_8_8_0, alloc r31 = ar.pfs, 8, 8, 8, 0)
|
||||
TEMPLATE(alloc_8_8_8_8, alloc r31 = ar.pfs, 8, 8, 8, 8)
|
||||
TEMPLATE(rot, br.wtop.sptk.few 1f; 1:)
|
||||
.globl func_add3, func_add3_end
|
||||
.proc func_add3
|
||||
func_add3:
|
||||
{.mmi alloc loc1 = ar.pfs, 2, 2, 2, 0
|
||||
ld8 r8 = [in1], 8 // load the function pointer
|
||||
mov loc0 = rp
|
||||
} ;;
|
||||
{.mmi
|
||||
ld8 r9 = [r8], 8 // load the entry-point
|
||||
mov out0 = in0
|
||||
mov out1 = in1
|
||||
} ;;
|
||||
{.mib ld8 gp = [r8] // load the gp
|
||||
mov b6 = r9
|
||||
br.call.sptk rp = b6
|
||||
}
|
||||
{.mii
|
||||
add r8 = 2, r8
|
||||
mov ar.pfs = loc1
|
||||
mov rp = loc0
|
||||
}
|
||||
{.mib
|
||||
mov loc0 = 1 // trash loc0
|
||||
mov loc1 = 3 // trash loc1
|
||||
br.ret.sptk.many rp
|
||||
}
|
||||
func_add3_end:
|
||||
.endp func_add3
|
||||
|
|
Loading…
Reference in a new issue