Commit 069c57ce authored by Taddeus Kroes's avatar Taddeus Kroes

Merge branch 'master' of github.com:taddeus/peephole

parents 4dbce732 158030a2
.file 1 "acron.c"
# GNU C 2.7.2.3 [AL 1.1, MM 40, tma 0.1] SimpleScalar running sstrix compiled by GNU C
# Cc1 defaults:
# -mgas -mgpOPT
# Cc1 arguments (-G value = 8, Cpu = default, ISA = 1):
# -quiet -dumpbase -O0 -o
gcc2_compiled.:
__gnu_compiled_c:
.globl w
......@@ -72,25 +74,25 @@ is_vowel:
sb $3,0($fp)
move $2,$0
lb $4,0($fp)
li $5,0x00000041 # 65
li $5,0x00000041 # $5 = 65
beq $4,$5,$L3
lb $4,0($fp)
li $5,0x00000045 # 69
li $5,0x00000045 # $5 = 69
beq $4,$5,$L3
lb $4,0($fp)
li $5,0x00000049 # 73
li $5,0x00000049 # $5 = 73
beq $4,$5,$L3
lb $4,0($fp)
li $5,0x0000004f # 79
li $5,0x0000004f # $5 = 79
beq $4,$5,$L3
lb $4,0($fp)
li $5,0x00000055 # 85
li $5,0x00000055 # $5 = 85
beq $4,$5,$L3
lb $4,0($fp)
li $5,0x00000059 # 89
li $5,0x00000059 # $5 = 89
bne $4,$5,$L2
$L3:
li $2,0x00000001 # 1
li $2,0x00000001 # $2 = 1
$L2:
j $L1
$L1:
......@@ -117,7 +119,7 @@ do_perm:
sw $7,68($fp)
sw $0,24($fp)
lw $2,64($fp)
li $3,0x00000001 # 1
li $3,0x00000001 # $3 = 1
bne $2,$3,$L5
lw $2,pindex
move $3,$2
......@@ -182,7 +184,7 @@ $L5:
sw $2,24($fp)
beq $2,$0,$L8
lw $2,24($fp)
li $3,0x00000003 # 3
li $3,0x00000003 # $3 = 3
bne $2,$3,$L7
$L8:
j $L4
......@@ -222,8 +224,8 @@ $L13:
sll $2,$3,2
lw $3,60($fp)
addu $2,$2,$3
li $3,0x00000001 # 1
sw $3,0($2)
li $3,0x00000001 # $3 = 1
sw $3,0($2) # 0($2) = 1
lw $4,16($fp)
lw $5,60($fp)
lw $6,64($fp)
......@@ -358,8 +360,8 @@ main:
sw $fp,24($sp)
move $fp,$sp
jal __main
li $2,0x00000004 # 4
sw $2,20($fp)
li $2,0x00000004 # $2 = 4
sw $2,20($fp) # 20($fp) = 4
$L28:
lw $2,20($fp)
slt $3,$2,7
......@@ -376,8 +378,8 @@ $L35:
sll $2,$3,2
la $3,done
addu $2,$2,$3
li $3,0x00000001 # 1
sw $3,0($2)
li $3,0x00000001 # $3 = 1
sw $3,0($2) # 0($2) = 1
lw $4,16($fp)
la $5,done
move $6,$0
......
.file 1 "dhrystone.c"
# GNU C 2.7.2.3 [AL 1.1, MM 40, tma 0.1] SimpleScalar running sstrix compiled by GNU C
# Cc1 defaults:
# -mgas -mgpOPT
# Cc1 arguments (-G value = 8, Cpu = default, ISA = 1):
# -quiet -dumpbase -O0 -o
gcc2_compiled.:
__gnu_compiled_c:
.globl Version
......@@ -96,7 +98,7 @@ Proc0:
sw $fp,140($sp)
sw $16,136($sp)
move $fp,$sp
addu $4,$fp,120
addu $4,$sp,120
jal times
lw $2,120($fp)
sw $2,104($fp)
......@@ -115,24 +117,23 @@ $L4:
lw $3,104($fp)
subu $2,$2,$3
sw $2,112($fp)
li $4,0x00000030 # 48
li $4,0x00000030 # $4 = 48
jal malloc
sw $2,PtrGlbNext
li $4,0x00000030 # 48
li $4,0x00000030 # $4 = 48
jal malloc
sw $2,PtrGlb
lw $2,PtrGlb
lw $3,PtrGlbNext
sw $3,0($2)
lw $2,PtrGlb
sw $0,4($2)
lw $2,PtrGlb
li $3,0x00000002 # 2
sw $3,8($2)
li $3,0x00000002 # $3 = 2
sw $3,8($2) # 8($2) = 2
lw $2,PtrGlb
li $3,0x00000028 # 40
sw $3,12($2)
lw $3,PtrGlb
li $3,0x00000028 # $3 = 40
sw $3,12($2) # 12($2) = 40
lw $3,PtrGlb # $3 = unknown
addu $2,$3,16
move $4,$2
la $5,$LC0
......@@ -141,8 +142,8 @@ $L4:
move $4,$2
la $5,$LC1
jal strcpy
li $2,0x0000000a # 10
sw $2,Array2Glob+1660
li $2,0x0000000a # $2 = 10
sw $2,Array2Glob+1660 # Array2Glob+1660 = 10
addu $4,$fp,120
jal times
lw $2,120($fp)
......@@ -154,16 +155,16 @@ $L7:
$L10:
jal Proc5
jal Proc4
li $2,0x00000002 # 2
sw $2,16($fp)
li $2,0x00000003 # 3
sw $2,20($fp)
li $2,0x00000002 # $2 = 2
sw $2,16($fp) # 16($fp) = 2
li $2,0x00000003 # $2 = 3
sw $2,20($fp) # 20($fp) = 3
addu $2,$fp,72
move $4,$2
la $5,$LC2
jal strcpy
li $2,0x00000001 # 1
sw $2,32($fp)
li $2,0x00000001 # $2 = 1
sw $2,32($fp) # 32($fp) = 1
addu $2,$fp,40
addu $3,$fp,72
move $4,$2
......@@ -179,8 +180,8 @@ $L11:
beq $2,$0,$L12
$L13:
lw $2,16($fp)
move $4,$2
sll $3,$4,2
# Dead code: move $4, $2
sll $3,$2,2
addu $3,$3,$2
lw $2,20($fp)
subu $3,$3,$2
......@@ -203,7 +204,7 @@ $L12:
jal Proc8
lw $4,PtrGlb
jal Proc1
li $2,0x00000041 # 65
li $2,0x00000041 # $2 = 65
sb $2,29($fp)
$L14:
lb $2,29($fp)
......@@ -213,7 +214,7 @@ $L14:
$L17:
lb $2,29($fp)
move $4,$2
li $5,0x00000043 # 67
li $5,0x00000043 # $5 = 67
jal Func1
lw $3,32($fp)
bne $3,$2,$L18
......@@ -234,15 +235,14 @@ $L15:
mult $2,$3
mflo $2
sw $2,24($fp)
lw $2,24($fp)
lw $3,16($fp)
div $2,$2,$3
sw $2,20($fp)
lw $2,24($fp)
lw $3,20($fp)
subu $2,$2,$3
move $4,$2
sll $3,$4,3
# Dead code: move $4, $2
sll $3,$2,3
subu $3,$3,$2
lw $2,16($fp)
subu $3,$3,$2
......@@ -261,22 +261,21 @@ $L8:
lw $3,112($fp)
subu $2,$2,$3
sw $2,108($fp)
lw $2,108($fp)
li $6,0x51eb851f # 1374389535
li $6,0x51eb851f # $6 = 1374389535
mult $2,$6
mfhi $5
mflo $4
srl $6,$5,0
move $7,$0
# Dead code: mflo $4
srl $6,$5,0 # $6 = unknown
# Dead code: move $7, $0
sra $3,$6,5
sra $4,$2,31
subu $2,$3,$4
la $4,$LC3
la $5,Version
li $6,0x00001388 # 5000
li $6,0x00001388 # $6 = 5000
move $7,$2
jal printf
li $2,0x0007a120 # 500000
li $2,0x0007a120 # $2 = 500000
lw $3,108($fp)
div $2,$2,$3
la $4,$LC4
......@@ -306,12 +305,12 @@ Proc1:
lw $2,PtrGlb
move $4,$3
move $5,$2
li $6,0x00000030 # 48
li $6,0x00000030 # $6 = 48
jal memcpy
lw $2,24($fp)
li $3,0x00000005 # 5
sw $3,12($2)
lw $3,24($fp)
li $3,0x00000005 # $3 = 5
sw $3,12($2) # 12($2) = 5
lw $3,24($fp) # $3 = unknown
lw $2,0($3)
lw $3,24($fp)
lw $4,12($3)
......@@ -331,9 +330,9 @@ Proc1:
bne $2,$0,$L20
lw $2,24($fp)
lw $3,0($2)
li $2,0x00000006 # 6
sw $2,12($3)
lw $2,24($fp)
li $2,0x00000006 # $2 = 6
sw $2,12($3) # 12($3) = 6
lw $2,24($fp) # $2 = unknown
lw $3,24($fp)
lw $4,0($3)
addu $3,$4,8
......@@ -351,7 +350,7 @@ Proc1:
lw $4,0($3)
addu $3,$4,12
lw $4,12($2)
li $5,0x0000000a # 10
li $5,0x0000000a # $5 = 10
move $6,$3
jal Proc7
j $L21
......@@ -362,7 +361,7 @@ $L20:
move $3,$4
move $4,$2
move $5,$3
li $6,0x00000030 # 48
li $6,0x00000030 # $6 = 48
jal memcpy
$L21:
$L19:
......@@ -388,7 +387,7 @@ Proc2:
sw $2,0($fp)
$L23:
lb $2,Char1Glob
li $3,0x00000041 # 65
li $3,0x00000041 # $3 = 65
bne $2,$3,$L26
lw $3,0($fp)
subu $2,$3,1
......@@ -432,12 +431,12 @@ Proc3:
sw $4,0($2)
j $L30
$L29:
li $2,0x00000064 # 100
sw $2,IntGlob
li $2,0x00000064 # $2 = 100
sw $2,IntGlob # IntGlob = 100
$L30:
lw $3,PtrGlb
addu $2,$3,12
li $4,0x0000000a # 10
li $4,0x0000000a # $4 = 10
lw $5,IntGlob
move $6,$2
jal Proc7
......@@ -461,11 +460,10 @@ Proc4:
xori $3,$2,0x0041
sltu $2,$3,1
sw $2,0($fp)
lw $2,0($fp)
lw $3,BoolGlob
or $2,$2,$3
sw $2,0($fp)
li $2,0x00000042 # 66
li $2,0x00000042 # $2 = 66
sb $2,Char2Glob
$L31:
move $sp,$fp # sp not trusted here
......@@ -482,7 +480,7 @@ Proc5:
subu $sp,$sp,8
sw $fp,0($sp)
move $fp,$sp
li $2,0x00000041 # 65
li $2,0x00000041 # $2 = 65
sb $2,Char1Glob
sw $0,BoolGlob
$L32:
......@@ -510,8 +508,8 @@ Proc6:
jal Func3
bne $2,$0,$L34
lw $2,28($fp)
li $3,0x00000003 # 3
sw $3,0($2)
li $3,0x00000003 # $3 = 3
sw $3,0($2) # 0($2) = 3
$L34:
lw $2,24($fp)
sltu $3,$2,5
......@@ -546,21 +544,21 @@ $L37:
j $L39
$L38:
lw $2,28($fp)
li $3,0x00000003 # 3
sw $3,0($2)
li $3,0x00000003 # $3 = 3
sw $3,0($2) # 0($2) = 3
$L39:
j $L35
$L40:
lw $2,28($fp)
li $3,0x00000001 # 1
sw $3,0($2)
li $3,0x00000001 # $3 = 1
sw $3,0($2) # 0($2) = 1
j $L35
$L41:
j $L35
$L42:
lw $2,28($fp)
li $3,0x00000002 # 2
sw $3,0($2)
li $3,0x00000002 # $3 = 2
sw $3,0($2) # 0($2) = 2
$L44:
$L35:
$L33:
......@@ -654,7 +652,7 @@ $L50:
move $4,$2
sll $2,$4,2
move $5,$3
sll $4,$5,1
sll $4,$3,1
addu $4,$4,$3
sll $3,$4,4
addu $4,$4,$3
......@@ -671,26 +669,26 @@ $L49:
sw $3,4($fp)
j $L47
$L48:
# Dead code: lw $3, 0($fp)
# Dead code: lw $2, 0($fp)
# Dead code: move $4, $2
# Dead code: sll $2, $4, 2
# Dead code: move $5, $3
# Dead code: sll $4, $3, 1
# Dead code: addu $4, $4, $3
# Dead code: sll $3, $4, 4
# Dead code: addu $4, $4, $3
# Dead code: sll $3, $4, 2
# Dead code: lw $4, 20($fp)
# Dead code: addu $3, $3, $4
# Dead code: addu $4, $2, $3
# Dead code: subu $2, $4, 4
lw $3,0($fp)
lw $2,0($fp)
move $4,$2
sll $2,$4,2
move $5,$3
sll $4,$5,1
addu $4,$4,$3
sll $3,$4,4
addu $4,$4,$3
sll $3,$4,2
lw $4,20($fp)
addu $3,$3,$4
addu $4,$2,$3
subu $2,$4,4
lw $3,0($fp)
lw $2,0($fp)
move $4,$2
sll $2,$4,2
move $5,$3
sll $4,$5,1
# Dead code: move $5, $3
sll $4,$3,1
addu $4,$4,$3
sll $3,$4,4
addu $4,$4,$3
......@@ -704,7 +702,7 @@ $L48:
move $5,$3
sll $3,$5,2
move $6,$4
sll $5,$6,1
sll $5,$4,1
addu $5,$5,$4
sll $4,$5,4
addu $5,$5,$4
......@@ -738,8 +736,8 @@ $L48:
addu $3,$3,$4
lw $4,0($3)
sw $4,0($2)
li $2,0x00000005 # 5
sw $2,IntGlob
li $2,0x00000005 # $2 = 5
sw $2,IntGlob # IntGlob = 5
$L46:
move $sp,$fp # sp not trusted here
lw $fp,8($sp)
......@@ -770,7 +768,7 @@ Func1:
j $L51
j $L53
$L52:
li $2,0x00000001 # 1
li $2,0x00000001 # $2 = 1
j $L51
$L53:
$L51:
......@@ -791,8 +789,8 @@ Func2:
move $fp,$sp
sw $4,32($fp)
sw $5,36($fp)
li $2,0x00000001 # 1
sw $2,16($fp)
li $2,0x00000001 # $2 = 1
sw $2,16($fp) # 16($fp) = 1
$L55:
lw $2,16($fp)
slt $3,$2,2
......@@ -811,7 +809,7 @@ $L57:
move $5,$3
jal Func1
bne $2,$0,$L58
li $2,0x00000041 # 65
li $2,0x00000041 # $2 = 65
sb $2,20($fp)
lw $3,16($fp)
addu $2,$3,1
......@@ -826,13 +824,13 @@ $L56:
lb $2,20($fp)
slt $3,$2,91
beq $3,$0,$L59
li $2,0x00000007 # 7
sw $2,16($fp)
li $2,0x00000007 # $2 = 7
sw $2,16($fp) # 16($fp) = 7
$L59:
lb $2,20($fp)
li $3,0x00000058 # 88
li $3,0x00000058 # $3 = 88
bne $2,$3,$L60
li $2,0x00000001 # 1
li $2,0x00000001 # $2 = 1
j $L54
j $L61
$L60:
......@@ -843,7 +841,7 @@ $L60:
lw $2,16($fp)
addu $3,$2,7
sw $3,16($fp)
li $2,0x00000001 # 1
li $2,0x00000001 # $2 = 1
j $L54
j $L63
$L62:
......@@ -870,10 +868,9 @@ Func3:
sw $4,16($fp)
lw $2,16($fp)
sw $2,0($fp)
lw $2,0($fp)
li $3,0x00000002 # 2
li $3,0x00000002 # $3 = 2
bne $2,$3,$L65
li $2,0x00000001 # 1
li $2,0x00000001 # $2 = 1
j $L64
$L65:
move $2,$0
......
......@@ -148,6 +148,8 @@ class TestStatement(unittest.TestCase):
arg2)
self.assertEqual(S('command', 's.s', '$1', '10($2)').get_use(), \
arg2)
self.assertEqual(S('command', 'sw', '$1', '10($2)').get_use(), \
arg2)
self.assertEqual(S('command', 'sb', '$1', '10($2)').get_use(), \
arg2)
self.assertEqual(S('command', 'mtc1', '$1', '$2').get_use(), arg1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment