A. "Hello
World" Function Without Unwind Directives
// The string is defined in the read only data section
.section .rdata, "a", "progbits"
.align 8
.STRING1:
stringz "Hello World!!!\n"
// The definition of the function hello is in the text section
// The following registers are saved in local registers:
// gp = r1 - loc0 = r32
// rp = b0 - loc1 = r33
// ar.pfs - loc2 = r34
// sp = r12 - loc3 = r35
.text
.global hello
.proc hello
hello:
alloc loc2 = ar.pfs, 0, 4, 1, 0
mov loc3 = sp
mov loc1 = b0
addl out0 = @ltoff(.STRING1), gp
;;
ld8 out0 = [out0]
mov loc0 = gp
br.call.sptk.many b0 = printf
;;
mov gp = loc0
mov ar.pfs = loc2
mov b0 = loc1
mov sp = loc3
br.ret.sptk.many b0
.endp hello
.global printf
.type printf, @function |
B. "Hello
World" Function With Unwind Directives
.file "hello.c"
.pred.safe_across_calls p1-p5,p16-p63
.section .rdata, "a", "progbits"
.align 8
.STRING1:
stringz "Hello World!!!\n"
.text
.align 16
.global hello#
.proc hello#
hello:
.prologue
.save ar.pfs, r34
alloc r34 = ar.pfs, 0, 4, 1, 0
.vframe r35
mov r35 = r12
.save rp, r33
mov r33 = b0
.body
addl r36 = @ltoff(.STRING1), gp
;;
ld8 r36 = [r36]
mov r32 = r1
br.call.sptk.many b0 = printf#
;;
mov r1 = r32
mov ar.pfs = r34
mov b0 = r33
.restore sp
mov r12 = r35
br.ret.sptk.many b0
.endp hello#
.global printf#
.type printf#, @function |