编译到 MIPS 我得到这个 .file 1 "c2mips.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:
.text
.align 2
.globl fibRecursive
.ent fibRecursive
fibRecursive:
.frame $fp,40,$31 # vars= 8, regs= 3/0, args= 16, extra= 0
.mask 0xc0010000,-8
.fmask 0x00000000,0
subu $sp,$sp,40
sw $31,32($sp)
sw $fp,28($sp)
sw $16,24($sp)
move $fp,$sp
sw $4,40($fp)
lw $2,40($fp)
slt $3,$2,2
beq $3,$0,$L2
lw $2,40($fp)
sw $2,16($fp)
j $L3
$L2:
lw $3,40($fp)
addu $2,$3,-1
move $4,$2
jal fibRecursive
move $16,$2
lw $3,40($fp)
addu $2,$3,-2
move $4,$2
jal fibRecursive
addu $3,$16,$2
sw $3,16($fp)
$L3:
lw $3,16($fp)
move $2,$3
j $L1
$L1:
move $sp,$fp # sp not trusted here
lw $31,32($sp)
lw $fp,28($sp)
lw $16,24($sp)
addu $sp,$sp,40
j $31
.end fibRecursive
.rdata
.align 2
$LC0:
.ascii " The %d - th Fibonacci number is % d . n \000"
.text
.align 2
.globl main
.ent main
main:
.frame $fp,32,$31 # vars= 8, regs= 2/0, args= 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,32
sw $31,28($sp)
sw $fp,24($sp)
move $fp,$sp
sw $4,32($fp)
sw $5,36($fp)
jal __main
li $2,10 # 0x0000000a
sw $2,16($fp)
lw $4,16($fp)
jal fibRecursive
sw $2,20($fp)
la $4,$LC0
lw $5,16($fp)
lw $6,20($fp)
jal printf
move $2,$0
j $L4
$L4:
move $sp,$fp # sp not trusted here
lw $31,28($sp)
lw $fp,24($sp)
addu $sp,$sp,32
j $31
.end main