.file 1 "myC.c"
# -G value = 8, Cpu = 3000, ISA = 1
# GNU C version cygnus-2.7.2-970404 (mips-mips-ecoff) compiled by GNU C version cygnus-2.7.2-970404.
# options passed: -msoft-float
# options enabled: -fpeephole -ffunction-cse -fkeep-static-consts
# -fpcc-struct-return -fcommon -fverbose-asm -fgnu-linker -msoft-float
# -meb -mcpu=3000
gcc2_compiled.:
__gnu_compiled_c:
.sdata
.align 2
x.2:
.word 0
.align 2
$LC0:
.ascii "%d\n\000"
.text
.align 2
.globl func
.ent func
func:
.frame $fp,24,$31 # vars= 0, regs= 2/0, args= 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,24
sw $31,20($sp)
sw $fp,16($sp)
move $fp,$sp
la $4,$LC0
lw $5,x.2
jal printf
lw $2,x.2
addu $3,$2,1
sw $3,x.2
$L1:
move $sp,$fp # sp not trusted here
lw $31,20($sp)
lw $fp,16($sp)
addu $sp,$sp,24
j $31
.end func
.align 2
.globl main
.ent main
main:
.frame $fp,24,$31 # vars= 0, regs= 2/0, args= 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,24
sw $31,20($sp)
sw $fp,16($sp)
move $fp,$sp
jal __main
jal func
jal func
jal func
move $2,$0
j $L2
$L2:
move $sp,$fp # sp not trusted here
lw $31,20($sp)
lw $fp,16($sp)
addu $sp,$sp,24
j $31
.end main
靜態變量的比喻
我進行這種轉換的首選工具鏈是MipsIT程序。
到目前爲止你有什麼? –
難道你不能編譯它然後反彙編對象代碼? – RichieHindle
查看http://stackoverflow.com/questions/14700933/cannot-translate-this-c-code-to-mips-assembly/14715054#14715054 – JosephH