⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 algebra.s

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 S
字号:
    ! SPARC assembly:     ! Automatically generated by ASM.SPARCGenerator.section	".data".GLOBALFIELD:.ARRAY_OUT_OF_BOUND:	.asciz "testcases/dataflow/algebra.dcf:%d: runtime error: array out of bound; accessing: %d, array size: %d\n"	.align 4.DIVISION_ZERO:	.asciz "testcases/dataflow/algebra.dcf:%d: runtime error: division to zero\n"	.align 4.CONTROL_FALLING_OFF:	.asciz "testcases/dataflow/algebra.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 mainfoo:	save	%sp, -96, %sp	st	%g0, [%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]	! Preparing parameter -> Ro:  	ld	[%sp+92], %o0	call	printf,0	nop	mov	%o0, %l0	mov	8, %g3	add	%sp, %g3, %sp	! Move instruction for the int literal:  10	mov	10, %l0	mov	%l0, %i0	!Return statement for method:	ret	restore	!Run time error: Control falling off detected and reported here:	sethi	%hi(.CONTROL_FALLING_OFF), %o0	or	%o0, %lo(.CONTROL_FALLING_OFF), %o0	sethi	%hi(.MDNAME_foo_LINE_NO), %o1	or	%o1, %lo(.MDNAME_foo_LINE_NO), %o1	sethi	%hi(.MDNAME_foo), %o2	or	%o2, %lo(.MDNAME_foo), %o2	call	printf,0	nop	call	exit,0	nop	.globl mainmain:	sethi	%hi(.GLOBALFIELD), %g2	or	%g2, %lo(.GLOBALFIELD), %g2	save	%sp, -120, %sp	st	%g0, [%fp-4]	st	%g0, [%fp-8]	st	%g0, [%fp-12]	st	%g0, [%fp-16]	st	%g0, [%fp-20]	st	%g0, [%fp-24]	st	%g0, [%fp-28]	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg2), %g1	or	%g1, %lo(.CalloutArg2), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Preparing parameter -> Ro:  	ld	[%sp+92], %o0	call	printf,0	nop	mov	%o0, %l0	mov	8, %g3	add	%sp, %g3, %sp	mov	0, %g3	sub	%sp, %g3, %sp	call	readint,0	nop	mov	%o0, %l0	mov	0, %g3	add	%sp, %g3, %sp	!Location id store instruction for stmt location:   a = expression	st	%l0, [%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]	! Preparing parameter -> Ro:  	ld	[%sp+92], %o0	call	printf,0	nop	mov	%o0, %l0	mov	8, %g3	add	%sp, %g3, %sp	mov	0, %g3	sub	%sp, %g3, %sp	call	readint,0	nop	mov	%o0, %l0	mov	0, %g3	add	%sp, %g3, %sp	!Location id store instruction for stmt location:   b = expression	st	%l0, [%fp-8]	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg4), %g1	or	%g1, %lo(.CalloutArg4), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Preparing parameter -> Ro:  	ld	[%sp+92], %o0	call	printf,0	nop	mov	%o0, %l0	mov	8, %g3	add	%sp, %g3, %sp	mov	0, %g3	sub	%sp, %g3, %sp	call	readint,0	nop	mov	%o0, %l0	mov	0, %g3	add	%sp, %g3, %sp	!Location id store instruction for stmt location:   c = expression	st	%l0, [%fp-12]	! Load instruction for the location identifier:  a	ld	[%fp-4], %l0	! Load instruction for the location identifier:  a	ld	[%fp-4], %l1	sub	%l0, %l1, %l2	!Location id store instruction for stmt location:   x = expression	st	%l2, [%fp-16]	! Load instruction for the location identifier:  b	ld	[%fp-8], %l0	!Location id store instruction for stmt location:   y = expression	st	%l0, [%fp-20]	! Load instruction for the location identifier:  c	ld	[%fp-12], %l0	!Location id store instruction for stmt location:   z = expression	st	%l0, [%fp-24]	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:  x	ld	[%fp-16], %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	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:  y	ld	[%fp-20], %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	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:  z	ld	[%fp-24], %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	! Load instruction for the location identifier:  a	ld	[%fp-4], %l0	! Load instruction for the location identifier:  b	ld	[%fp-8], %l1	add	%l0, %l1, %l2	! Load instruction for the location identifier:  c	ld	[%fp-12], %l0	add	%l2, %l0, %l1	! Load instruction for the location identifier:  a	ld	[%fp-4], %l0	sub	%l1, %l0, %l2	!Location id store instruction for stmt location:   x = expression	st	%l2, [%fp-16]	! Move instruction for the int literal:  3	mov	3, %l0	! Load instruction for the location identifier:  b	ld	[%fp-8], %l1	smul	%l0, %l1, %l2	! Load instruction for the location identifier:  b	ld	[%fp-8], %l0	! Move instruction for the int literal:  2	mov	2, %l1	sll	%l0, %l1, %l3	add	%l2, %l3, %l0	!Location id store instruction for stmt location:   y = expression	st	%l0, [%fp-20]	! Move instruction for the int literal:  -2	mov	-2, %l0	! Load instruction for the location identifier:  c	ld	[%fp-12], %l1	smul	%l0, %l1, %l2	! Load instruction for the location identifier:  a	ld	[%fp-4], %l0	! Load instruction for the location identifier:  c	ld	[%fp-12], %l1	smul	%l0, %l1, %l3	add	%l2, %l3, %l0	! Load instruction for the location identifier:  c	ld	[%fp-12], %l1	! Move instruction for the int literal:  1	mov	1, %l2	sll	%l1, %l2, %l3	add	%l0, %l3, %l1	! Move instruction for the int literal:  3	mov	3, %l0	! Load instruction for the location identifier:  a	ld	[%fp-4], %l2	smul	%l0, %l2, %l3	! Load instruction for the location identifier:  c	ld	[%fp-12], %l0	smul	%l3, %l0, %l2	add	%l1, %l2, %l0	!Location id store instruction for stmt location:   z = expression	st	%l0, [%fp-24]	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:  x	ld	[%fp-16], %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	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg9), %g1	or	%g1, %lo(.CalloutArg9), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Load instruction for the location identifier:  y	ld	[%fp-20], %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	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg10), %g1	or	%g1, %lo(.CalloutArg10), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Load instruction for the location identifier:  z	ld	[%fp-24], %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:  0	mov	0, %l0	!Location id store instruction for stmt location:   x = expression	st	%l0, [%fp-16]	! Load instruction for the location identifier:  b	ld	[%fp-8], %l0	mov	0, %g3	sub	%sp, %g3, %sp	call	foo,0	nop	mov	%o0, %l1	mov	0, %g3	add	%sp, %g3, %sp	smul	%l0, %l1, %l2	! Load instruction for the location identifier:  c	ld	[%fp-12], %l0	mov	0, %g3	sub	%sp, %g3, %sp	call	foo,0	nop	mov	%o0, %l1	mov	0, %g3	add	%sp, %g3, %sp	smul	%l0, %l1, %l3	add	%l2, %l3, %l0	!Location id store instruction for stmt location:   y = expression	st	%l0, [%fp-20]	! Load instruction for the location identifier:  a	ld	[%fp-4], %l0	! Load instruction for the location identifier:  a	ld	[%fp-4], %l1	sub	%l0, %l1, %l2	! Load instruction for the location identifier:  b	ld	[%fp-8], %l0	smul	%l2, %l0, %l1	!Location id store instruction for stmt location:   z = expression	st	%l1, [%fp-24]	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg11), %g1	or	%g1, %lo(.CalloutArg11), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Load instruction for the location identifier:  x	ld	[%fp-16], %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	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg12), %g1	or	%g1, %lo(.CalloutArg12), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Load instruction for the location identifier:  y	ld	[%fp-20], %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	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg13), %g1	or	%g1, %lo(.CalloutArg13), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Load instruction for the location identifier:  z	ld	[%fp-24], %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	! Load instruction for the location identifier:  a	ld	[%fp-4], %l0	! Load instruction for the location identifier:  b	ld	[%fp-8], %l1	add	%l0, %l1, %l2	! Load instruction for the location identifier:  c	ld	[%fp-12], %l0	! Move instruction for the int literal:  1	mov	1, %l1	add	%l0, %l1, %l3	smul	%l2, %l3, %l0	!Location id store instruction for stmt location:   x = expression	st	%l0, [%fp-16]	mov	8, %g3	sub	%sp, %g3, %sp	sethi	%hi(.CalloutArg14), %g1	or	%g1, %lo(.CalloutArg14), %g1	! Preparing parameter -> sp% + offset:  	st	%g1, [%sp+92]	! Load instruction for the location identifier:  x	ld	[%fp-16], %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	!Return statement for method:	ret	restore	!Datasection.CalloutArg1:	.asciz "Hi, I am a side effect.\n"	.align 8.MDNAME_foo:	.asciz "'foo( )'"	.align 8.MDNAME_foo_LINE_NO:	.asciz "9"	.align 8.CalloutArg2:	.asciz "A? "	.align 8.CalloutArg3:	.asciz "B? "	.align 8.CalloutArg4:	.asciz "C? "	.align 8.CalloutArg5:	.asciz "x: %d  "	.align 8.CalloutArg6:	.asciz "y: %d  "	.align 8.CalloutArg7:	.asciz "z: %d\n"	.align 8.CalloutArg8:	.asciz "x: %d  "	.align 8.CalloutArg9:	.asciz "y: %d  "	.align 8.CalloutArg10:	.asciz "z: %d\n"	.align 8.CalloutArg11:	.asciz "x: %d  "	.align 8.CalloutArg12:	.asciz "y: %d  "	.align 8.CalloutArg13:	.asciz "z: %d\n"	.align 8.CalloutArg14:	.asciz "x: %d\n"	.align 8.MDNAME_main:	.asciz "'main( )'"	.align 8.MDNAME_main_LINE_NO:	.asciz "55"	.align 8

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -