c code -> mips code
글쓴이: gusiri / 작성시간: 수, 2008/05/14 - 7:06오후
txt 파일로 첨부한 c 코드를 mips 코드로 바꾸고 싶습니다.
몇일밤 새면서 toolchain 을 계속 설치하려고 하는데 실패...
당장 급한 것이라서 혹시 mips cross compile이 가능하신 분께 부탁드립니다.
첨부한 c 코드를 mips code 로 바꿔만 주시면 감사하겠습니다 ㅠ
당장 급해서 이것만 해결되면 아예 포멧을 해버리고 처음부터 오기로 해볼작정입니다!
File attachments:
첨부 | 파일 크기 |
---|---|
tour.txt | 1.64 KB |
Forums:
꼭 도와드리고 싶어서....
이것은 mipsel cross compiler 로 뽑았습니다.
참고로 젠투리눅스를 사용하신다면 CrossCompiler 환경구축하는데 매우 편리합니다. Cross환경 구축하는데는 젠투리눅스 추천하고 싶어 글 남깁니다.
.file 1 "t.c"
.section .mdebug.abi32
.previous
.abicalls
.globl x
.data
.align 2
.type x, @object
.size x, 32
x:
.word -1
.word 5
.word 2
.word 8
.word 7
.word 1
.word 9
.word 3
.globl y
.align 2
.type y, @object
.size y, 32
y:
.word -1
.word 5
.word 3
.word 4
.word 2
.word 6
.word 6
.word 2
.text
.align 2
.globl distance
.ent distance
.type distance, @function
distance:
.frame $fp,8,$31 # vars= 0, regs= 1/0, args= 0, gp= 0
.mask 0x40000000,-8
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set reorder
addiu $sp,$sp,-8
sw $fp,0($sp)
move $fp,$sp
sw $4,8($fp)
sw $5,12($fp)
la $3,x
lw $2,12($fp)
sll $2,$2,2
addu $4,$2,$3
la $3,x
lw $2,8($fp)
sll $2,$2,2
addu $2,$2,$3
lw $3,0($4)
lw $2,0($2)
subu $4,$3,$2
mult $4,$4
mflo $4
la $3,y
lw $2,12($fp)
sll $2,$2,2
addu $5,$2,$3
la $3,y
lw $2,8($fp)
sll $2,$2,2
addu $2,$2,$3
lw $3,0($5)
lw $2,0($2)
subu $2,$3,$2
mult $2,$2
mflo $2
addu $4,$4,$2
move $2,$4
move $sp,$fp
lw $fp,0($sp)
addiu $sp,$sp,8
j $31
.end distance
.rdata
.align 2
$LC0:
.word -1
.word 7
.word 0
.word 0
.word 0
.word 0
.word 0
.word 1
.align 2
$LC1:
.ascii "%d \000"
.align 2
$LC2:
.ascii "\n\n\000"
.align 2
$LC3:
.ascii "%d %d %d %d %d %d %d\n\000"
.align 2
$LC4:
.ascii "%d %d %d %d %d %d %d\000"
.text
.align 2
.globl main
.ent main
.type main, @function
main:
.frame $fp,392,$31 # vars= 336, regs= 3/0, args= 32, gp= 8
.mask 0xc0010000,-8
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set reorder
addiu $sp,$sp,-392
sw $31,384($sp)
sw $fp,380($sp)
sw $16,376($sp)
move $fp,$sp
.cprestore 32
addiu $2,$fp,40
li $3,256 # 0x100
move $4,$2
move $5,$0
move $6,$3
jal memset
lw $2,$LC0
lw $3,$LC0+4
lw $4,$LC0+8
lw $5,$LC0+12
lw $6,$LC0+16
lw $7,$LC0+20
lw $8,$LC0+24
lw $9,$LC0+28
sw $2,296($fp)
sw $3,300($fp)
sw $4,304($fp)
sw $5,308($fp)
sw $6,312($fp)
sw $7,316($fp)
sw $8,320($fp)
sw $9,324($fp)
sw $0,328($fp)
sw $0,332($fp)
sw $0,336($fp)
sw $0,340($fp)
sw $0,344($fp)
sw $0,348($fp)
sw $0,352($fp)
sw $0,356($fp)
li $2,1 # 0x1
sw $2,360($fp)
$L3:
lw $2,360($fp)
slt $2,$2,8
bne $2,$0,$L4
b $L5
$L4:
li $2,1 # 0x1
sw $2,364($fp)
$L6:
lw $2,364($fp)
slt $2,$2,8
bne $2,$0,$L7
b $L8
$L7:
lw $2,360($fp)
sll $3,$2,3
lw $2,364($fp)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $16,$3,$2
lw $4,360($fp)
lw $5,364($fp)
jal distance
sw $2,0($16)
lw $3,360($fp)
lw $2,364($fp)
bne $3,$2,$L9
lw $2,360($fp)
sll $3,$2,3
lw $2,364($fp)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,0($3)
$L9:
lw $3,364($fp)
li $2,1 # 0x1
beq $3,$2,$L11
lw $3,364($fp)
li $2,7 # 0x7
beq $3,$2,$L11
b $L10
$L11:
lw $2,360($fp)
sll $3,$2,3
lw $2,364($fp)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,0($3)
$L10:
lw $2,360($fp)
sll $3,$2,3
lw $2,364($fp)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
la $4,$LC1
lw $5,0($2)
jal printf
lw $2,364($fp)
addiu $2,$2,1
sw $2,364($fp)
b $L6
$L8:
la $4,$LC2
jal printf
lw $2,360($fp)
addiu $2,$2,1
sw $2,360($fp)
b $L3
$L5:
li $2,1 # 0x1
sw $2,360($fp)
$L12:
lw $2,360($fp)
slt $2,$2,6
bne $2,$0,$L13
b $L14
$L13:
li $2,999 # 0x3e7
sw $2,368($fp)
li $2,1 # 0x1
sw $2,364($fp)
$L15:
lw $2,364($fp)
slt $2,$2,7
bne $2,$0,$L16
b $L17
$L16:
lw $2,360($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
lw $2,256($2)
sll $3,$2,3
lw $2,364($fp)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
lw $3,0($2)
lw $2,368($fp)
slt $2,$3,$2
beq $2,$0,$L18
lw $2,360($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
lw $2,256($2)
sll $3,$2,3
lw $2,364($fp)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
lw $2,0($2)
sw $2,368($fp)
lw $2,364($fp)
sw $2,372($fp)
$L18:
lw $2,364($fp)
addiu $2,$2,1
sw $2,364($fp)
b $L15
$L17:
lw $2,360($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
lw $2,372($fp)
sw $2,260($3)
lw $2,360($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $6,$3,$2
lw $2,360($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
lw $5,256($2)
lw $2,360($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $4,$3,$2
move $2,$5
sll $3,$2,3
lw $2,260($4)
addu $2,$3,$2
sll $3,$2,2
addiu $2,$fp,40
addu $2,$3,$2
lw $2,0($2)
sw $2,288($6)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,32($3)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,64($3)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,96($3)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,128($3)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,160($3)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,192($3)
lw $2,372($fp)
sll $3,$2,2
addiu $2,$fp,40
addu $3,$3,$2
li $2,999 # 0x3e7
sw $2,224($3)
lw $2,360($fp)
addiu $2,$2,1
sw $2,360($fp)
b $L12
$L14:
lw $4,320($fp)
lw $5,324($fp)
jal distance
sw $2,352($fp)
lw $2,312($fp)
sw $2,16($sp)
lw $2,308($fp)
sw $2,20($sp)
lw $2,304($fp)
sw $2,24($sp)
lw $2,300($fp)
sw $2,28($sp)
la $4,$LC3
lw $5,324($fp)
lw $6,320($fp)
lw $7,316($fp)
jal printf
lw $2,344($fp)
sw $2,16($sp)
lw $2,340($fp)
sw $2,20($sp)
lw $2,336($fp)
sw $2,24($sp)
lw $2,332($fp)
sw $2,28($sp)
la $4,$LC4
lw $5,356($fp)
lw $6,352($fp)
lw $7,348($fp)
jal printf
move $2,$0
move $sp,$fp
lw $31,384($sp)
lw $fp,380($sp)
lw $16,376($sp)
addiu $sp,$sp,392
j $31
.end main
.ident "GCC: (GNU) 3.4.2"
도구의 결함은 장인의 손으로 극복한다.
우와 눈물 날려고 하네요 ㅠ
정말 감사합니다. 꼭 도와드리고 싶어서...완전 눈물날뻔 했습니다 ㅠ
^ㅡ^
훈훈한 모습이군요
훈훈한 모습이군요 ㅎㅎ
MIPS C 컴파일러 만들던 즐거운 기억이 갑자기 떠오르는군요 -_-
조교님이 structure 지원 여부는 체크 안하겠다고 해서 어찌나 기쁘던지 ㅎㅎㅎ
댓글 달기