📄 03-math.s
字号:
! SPARC assembly: ! Automatically generated by ASM.SPARCGenerator.section ".data".GLOBALFIELD:.ARRAY_OUT_OF_BOUND: .asciz "testcases/codegen/03-math.dcf:%d: runtime error: array out of bound; accessing: %d, array size: %d\n" .align 4.DIVISION_ZERO: .asciz "testcases/codegen/03-math.dcf:%d: runtime error: division to zero\n" .align 4.CONTROL_FALLING_OFF: .asciz "testcases/codegen/03-math.dcf:%s: runtime error: control falling off the end of the method: %s , missing a return value\n" .align 4.section ".text" .align 4 .global main .globl mainmain: sethi %hi(.GLOBALFIELD), %g2 or %g2, %lo(.GLOBALFIELD), %g2 save %sp, -104, %sp st %g0, [%fp-4] st %g0, [%fp-8] st %g0, [%fp-12] ! Move instruction for the int literal: -2147483647 sethi %hi(-2147483647), %l0 or %l0, %lo(-2147483647), %l0 ! Move instruction for the int literal: 1 mov 1, %l1 sub %l0, %l1, %l2 !Location id store instruction for stmt location: i1 = expression st %l2, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg1), %g1 or %g1, %lo(.CalloutArg1), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 100 mov 100, %l0 ! Move instruction for the int literal: 50 mov 50, %l1 sub %l0, %l1, %l2 ! Move instruction for the int literal: 1 mov 1, %l0 sll %l2, %l0, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg2), %g1 or %g1, %lo(.CalloutArg2), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 100 mov 100, %l0 ! Move instruction for the int literal: 50 mov 50, %l1 sub %l0, %l1, %l2 ! Move instruction for the int literal: 40 mov 40, %l0 sub %l2, %l0, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg3), %g1 or %g1, %lo(.CalloutArg3), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 100 mov 100, %l0 ! Move instruction for the int literal: 50 mov 50, %l1 sub %l0, %l1, %l2 ! Move instruction for the int literal: 40 mov 40, %l0 add %l2, %l0, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg4), %g1 or %g1, %lo(.CalloutArg4), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 100 mov 100, %l0 ! Move instruction for the int literal: 5 mov 5, %l1 ! Move instruction for the int literal: 4 mov 4, %l2 smul %l1, %l2, %l3 sub %l0, %l3, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg5), %g1 or %g1, %lo(.CalloutArg5), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 10 mov 10, %l0 ! Move instruction for the int literal: 5 mov 5, %l1 smul %l0, %l1, %l2 ! Move instruction for the int literal: 4 mov 4, %l0 sub %l2, %l0, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg6), %g1 or %g1, %lo(.CalloutArg6), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: -3 mov -3, %l0 ! ExpUminus encountered: subtract 0 from the expression value: sub %g0, %l0, %l1 ! ExpUminus encountered: subtract 0 from the expression value: sub %g0, %l1, %l0 ! ExpUminus encountered: subtract 0 from the expression value: sub %g0, %l0, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg7), %g1 or %g1, %lo(.CalloutArg7), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 3 mov 3, %l0 !Location id store instruction for stmt location: i1 = expression st %l0, [%fp-4] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Load instruction for the location identifier: i1 ld [%fp-4], %l1 smul %l0, %l1, %l2 ! Move instruction for the int literal: -2 mov -2, %l0 sub %l2, %l0, %l1 !Location id store instruction for stmt location: i1 = expression st %l1, [%fp-4] mov 8, %g3 sub %sp, %g3, %sp sethi %hi(.CalloutArg8), %g1 or %g1, %lo(.CalloutArg8), %g1 ! Preparing parameter -> sp% + offset: st %g1, [%sp+92] ! Load instruction for the location identifier: i1 ld [%fp-4], %l0 ! Preparing parameter -> sp%+offset: st %l0, [%sp+96] ! Preparing parameter -> Ro: ld [%sp+92], %o0 ! Preparing parameter -> Ro: ld [%sp+96], %o1 call printf,0 nop mov %o0, %l0 mov 8, %g3 add %sp, %g3, %sp ! Move instruction for the int literal: 4 mov 4, %l0 ! Move instruction for the int literal: 4 mov 4, %l1 add %l1, %l1, %l2 !Datasection.CalloutArg1: .asciz "min int operation: result should be -2147483648, is: %d\n" .align 8.CalloutArg2: .asciz "paren assoc: result should be 100, is: %d\n" .align 8.CalloutArg3: .asciz "- assoc: result should be 10, is: %d\n" .align 8.CalloutArg4: .asciz "-,+ assoc: result should be 90, is: %d\n" .align 8.CalloutArg5: .asciz "- * assoc: result should be 80, is: %d\n" .align 8.CalloutArg6: .asciz "result should be 46, is: %d\n" .align 8.CalloutArg7: .asciz "uminus: result should be 3, is: %d\n" .align 8.CalloutArg8: .asciz "*, -, uses var: result should be 11, is: %d\n" .align 8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -