snoeathurc.h
This commit is contained in:
306
tests/negate.asm
306
tests/negate.asm
@ -1,36 +1,12 @@
|
||||
.text 0x00400000
|
||||
.globl main
|
||||
la $28, _heap_
|
||||
la $4, _a__str__35_
|
||||
# was: la _a__str__35__addr, _a__str__35_
|
||||
la $4, _a__str__8_
|
||||
# was: la _a__str__8__addr, _a__str__8_
|
||||
ori $3, $0, 1
|
||||
# was: ori _a__str__35__init, $0, 1
|
||||
# was: ori _a__str__8__init, $0, 1
|
||||
sw $3, 0($4)
|
||||
# was: sw _a__str__35__init, 0(_a__str__35__addr)
|
||||
la $4, _a__str__25_
|
||||
# was: la _a__str__25__addr, _a__str__25_
|
||||
ori $3, $0, 1
|
||||
# was: ori _a__str__25__init, $0, 1
|
||||
sw $3, 0($4)
|
||||
# was: sw _a__str__25__init, 0(_a__str__25__addr)
|
||||
la $4, _a__str__19_
|
||||
# was: la _a__str__19__addr, _a__str__19_
|
||||
ori $3, $0, 1
|
||||
# was: ori _a__str__19__init, $0, 1
|
||||
sw $3, 0($4)
|
||||
# was: sw _a__str__19__init, 0(_a__str__19__addr)
|
||||
la $4, _a__str__13_
|
||||
# was: la _a__str__13__addr, _a__str__13_
|
||||
ori $3, $0, 1
|
||||
# was: ori _a__str__13__init, $0, 1
|
||||
sw $3, 0($4)
|
||||
# was: sw _a__str__13__init, 0(_a__str__13__addr)
|
||||
la $4, _a__str__7_
|
||||
# was: la _a__str__7__addr, _a__str__7_
|
||||
ori $3, $0, 1
|
||||
# was: ori _a__str__7__init, $0, 1
|
||||
sw $3, 0($4)
|
||||
# was: sw _a__str__7__init, 0(_a__str__7__addr)
|
||||
# was: sw _a__str__8__init, 0(_a__str__8__addr)
|
||||
la $4, _true
|
||||
# was: la _true_addr, _true
|
||||
ori $3, $0, 4
|
||||
@ -47,6 +23,38 @@
|
||||
_stop_:
|
||||
ori $2, $0, 10
|
||||
syscall
|
||||
# Function write_nl
|
||||
write_nl:
|
||||
sw $31, -4($29)
|
||||
sw $16, -8($29)
|
||||
addi $29, $29, -12
|
||||
# ori _param_b_1_,$2,0
|
||||
ori $16, $2, 0
|
||||
# was: ori _tmp_4_, _param_b_1_, 0
|
||||
# ori _letBind_3_,_tmp_4_,0
|
||||
la $2, _true
|
||||
# was: la $2, _true
|
||||
bne $16, $0, _wBoolF_5_
|
||||
# was: bne _letBind_3_, $0, _wBoolF_5_
|
||||
la $2, _false
|
||||
# was: la $2, _false
|
||||
_wBoolF_5_:
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
la $2, _a__str__8_
|
||||
# was: la _tmp_7_, _a__str__8_
|
||||
# _a__str__8_: string "\n"
|
||||
# ori _letBind_6_,_tmp_7_,0
|
||||
# ori $2,_tmp_7_,0
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
ori $2, $16, 0
|
||||
# was: ori _write_nlres_2_, _letBind_3_, 0
|
||||
# ori $2,_write_nlres_2_,0
|
||||
addi $29, $29, 12
|
||||
lw $16, -8($29)
|
||||
lw $31, -4($29)
|
||||
jr $31
|
||||
# Function main
|
||||
main:
|
||||
sw $31, -4($29)
|
||||
@ -55,119 +63,123 @@ main:
|
||||
sw $17, -12($29)
|
||||
sw $16, -8($29)
|
||||
addi $29, $29, -24
|
||||
ori $16, $0, 1
|
||||
# was: ori _tmp_3_, $0, 1
|
||||
# ori _letBind_2_,_tmp_3_,0
|
||||
la $2, _true
|
||||
# was: la $2, _true
|
||||
bne $16, $0, _wBoolF_4_
|
||||
# was: bne _letBind_2_, $0, _wBoolF_4_
|
||||
la $2, _false
|
||||
# was: la $2, _false
|
||||
_wBoolF_4_:
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
la $2, _a__str__7_
|
||||
# was: la _tmp_6_, _a__str__7_
|
||||
# _a__str__7_: string "\n"
|
||||
# ori _letBind_5_,_tmp_6_,0
|
||||
# ori $2,_tmp_6_,0
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
ori $17, $0, 0
|
||||
# was: ori _tmp_9_, $0, 0
|
||||
# ori _letBind_8_,_tmp_9_,0
|
||||
la $2, _true
|
||||
# was: la $2, _true
|
||||
bne $17, $0, _wBoolF_10_
|
||||
# was: bne _letBind_8_, $0, _wBoolF_10_
|
||||
la $2, _false
|
||||
# was: la $2, _false
|
||||
_wBoolF_10_:
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
la $2, _a__str__13_
|
||||
# was: la _tmp_12_, _a__str__13_
|
||||
# _a__str__13_: string "\n"
|
||||
# ori _letBind_11_,_tmp_12_,0
|
||||
# ori $2,_tmp_12_,0
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
ori $18, $0, 0
|
||||
# was: ori _tmp_15_, $0, 0
|
||||
# ori _letBind_14_,_tmp_15_,0
|
||||
la $2, _true
|
||||
# was: la $2, _true
|
||||
bne $18, $0, _wBoolF_16_
|
||||
# was: bne _letBind_14_, $0, _wBoolF_16_
|
||||
la $2, _false
|
||||
# was: la $2, _false
|
||||
_wBoolF_16_:
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
la $2, _a__str__19_
|
||||
# was: la _tmp_18_, _a__str__19_
|
||||
# _a__str__19_: string "\n"
|
||||
# ori _letBind_17_,_tmp_18_,0
|
||||
# ori $2,_tmp_18_,0
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
ori $19, $0, 1
|
||||
# was: ori _tmp_21_, $0, 1
|
||||
# ori _letBind_20_,_tmp_21_,0
|
||||
la $2, _true
|
||||
# was: la $2, _true
|
||||
bne $19, $0, _wBoolF_22_
|
||||
# was: bne _letBind_20_, $0, _wBoolF_22_
|
||||
la $2, _false
|
||||
# was: la $2, _false
|
||||
_wBoolF_22_:
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
la $2, _a__str__25_
|
||||
# was: la _tmp_24_, _a__str__25_
|
||||
# _a__str__25_: string "\n"
|
||||
# ori _letBind_23_,_tmp_24_,0
|
||||
# ori $2,_tmp_24_,0
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
# ori _letBind_26_,_letBind_2_,0
|
||||
beq $16, $0, _endLabel_29_
|
||||
# was: beq _letBind_26_, $0, _endLabel_29_
|
||||
ori $3, $0, 3
|
||||
# was: ori _divide_L_14_, $0, 3
|
||||
ori $2, $0, 2
|
||||
# was: ori _divide_R_15_, $0, 2
|
||||
div $3, $3, $2
|
||||
# was: div _eq_L_12_, _divide_L_14_, _divide_R_15_
|
||||
ori $2, $0, 1
|
||||
# was: ori _eq_R_13_, $0, 1
|
||||
ori $4, $0, 0
|
||||
# was: ori _arg_11_, $0, 0
|
||||
bne $3, $2, _false_16_
|
||||
# was: bne _eq_L_12_, _eq_R_13_, _false_16_
|
||||
ori $4, $0, 1
|
||||
# was: ori _arg_11_, $0, 1
|
||||
_false_16_:
|
||||
ori $2, $4, 0
|
||||
# was: ori $2, _arg_11_, 0
|
||||
jal write_nl
|
||||
# was: jal write_nl, $2
|
||||
ori $16, $2, 0
|
||||
# was: ori _letBind_10_, $2, 0
|
||||
ori $2, $0, 3
|
||||
# was: ori _negate_R_23_, $0, 3
|
||||
sub $3, $0, $2
|
||||
# was: sub _divide_L_21_, $0, _negate_R_23_
|
||||
ori $2, $0, 2
|
||||
# was: ori _divide_R_22_, $0, 2
|
||||
div $3, $3, $2
|
||||
# was: div _eq_L_19_, _divide_L_21_, _divide_R_22_
|
||||
ori $2, $0, 2
|
||||
# was: ori _negate_R_24_, $0, 2
|
||||
sub $2, $0, $2
|
||||
# was: sub _eq_R_20_, $0, _negate_R_24_
|
||||
ori $4, $0, 0
|
||||
# was: ori _arg_18_, $0, 0
|
||||
bne $3, $2, _false_25_
|
||||
# was: bne _eq_L_19_, _eq_R_20_, _false_25_
|
||||
ori $4, $0, 1
|
||||
# was: ori _arg_18_, $0, 1
|
||||
_false_25_:
|
||||
ori $2, $4, 0
|
||||
# was: ori $2, _arg_18_, 0
|
||||
jal write_nl
|
||||
# was: jal write_nl, $2
|
||||
ori $17, $2, 0
|
||||
# was: ori _letBind_17_, $2, 0
|
||||
ori $2, $0, 3
|
||||
# was: ori _divide_L_30_, $0, 3
|
||||
ori $3, $0, 2
|
||||
# was: ori _negate_R_32_, $0, 2
|
||||
sub $3, $0, $3
|
||||
# was: sub _divide_R_31_, $0, _negate_R_32_
|
||||
div $3, $2, $3
|
||||
# was: div _eq_L_28_, _divide_L_30_, _divide_R_31_
|
||||
ori $2, $0, 2
|
||||
# was: ori _negate_R_33_, $0, 2
|
||||
sub $2, $0, $2
|
||||
# was: sub _eq_R_29_, $0, _negate_R_33_
|
||||
ori $4, $0, 0
|
||||
# was: ori _arg_27_, $0, 0
|
||||
bne $3, $2, _false_34_
|
||||
# was: bne _eq_L_28_, _eq_R_29_, _false_34_
|
||||
ori $4, $0, 1
|
||||
# was: ori _arg_27_, $0, 1
|
||||
_false_34_:
|
||||
ori $2, $4, 0
|
||||
# was: ori $2, _arg_27_, 0
|
||||
jal write_nl
|
||||
# was: jal write_nl, $2
|
||||
ori $18, $2, 0
|
||||
# was: ori _letBind_26_, $2, 0
|
||||
ori $2, $0, 3
|
||||
# was: ori _negate_R_41_, $0, 3
|
||||
sub $2, $0, $2
|
||||
# was: sub _divide_L_39_, $0, _negate_R_41_
|
||||
ori $3, $0, 2
|
||||
# was: ori _negate_R_42_, $0, 2
|
||||
sub $3, $0, $3
|
||||
# was: sub _divide_R_40_, $0, _negate_R_42_
|
||||
div $3, $2, $3
|
||||
# was: div _eq_L_37_, _divide_L_39_, _divide_R_40_
|
||||
ori $2, $0, 1
|
||||
# was: ori _eq_R_38_, $0, 1
|
||||
ori $4, $0, 0
|
||||
# was: ori _arg_36_, $0, 0
|
||||
bne $3, $2, _false_43_
|
||||
# was: bne _eq_L_37_, _eq_R_38_, _false_43_
|
||||
ori $4, $0, 1
|
||||
# was: ori _arg_36_, $0, 1
|
||||
_false_43_:
|
||||
ori $2, $4, 0
|
||||
# was: ori $2, _arg_36_, 0
|
||||
jal write_nl
|
||||
# was: jal write_nl, $2
|
||||
# ori _letBind_35_,$2,0
|
||||
# ori _arg_44_,_letBind_10_,0
|
||||
beq $16, $19, _false_47_
|
||||
# was: beq _arg_44_, 0, _false_47_
|
||||
ori $16, $17, 0
|
||||
# was: ori _letBind_26_, _letBind_8_, 0
|
||||
_endLabel_29_:
|
||||
beq $16, $0, _endLabel_28_
|
||||
# was: beq _letBind_26_, $0, _endLabel_28_
|
||||
# was: ori _arg_44_, _letBind_17_, 0
|
||||
_false_47_:
|
||||
beq $16, $19, _false_46_
|
||||
# was: beq _arg_44_, 0, _false_46_
|
||||
ori $16, $18, 0
|
||||
# was: ori _letBind_26_, _letBind_14_, 0
|
||||
_endLabel_28_:
|
||||
beq $16, $0, _endLabel_27_
|
||||
# was: beq _letBind_26_, $0, _endLabel_27_
|
||||
ori $16, $19, 0
|
||||
# was: ori _letBind_26_, _letBind_20_, 0
|
||||
_endLabel_27_:
|
||||
# ori _tmp_31_,_letBind_26_,0
|
||||
# ori _letBind_30_,_tmp_31_,0
|
||||
la $2, _true
|
||||
# was: la $2, _true
|
||||
bne $16, $0, _wBoolF_32_
|
||||
# was: bne _letBind_30_, $0, _wBoolF_32_
|
||||
la $2, _false
|
||||
# was: la $2, _false
|
||||
_wBoolF_32_:
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
la $2, _a__str__35_
|
||||
# was: la _tmp_34_, _a__str__35_
|
||||
# _a__str__35_: string "\n"
|
||||
# ori _letBind_33_,_tmp_34_,0
|
||||
# ori $2,_tmp_34_,0
|
||||
jal putstring
|
||||
# was: jal putstring, $2
|
||||
# was: ori _arg_44_, _letBind_26_, 0
|
||||
_false_46_:
|
||||
beq $16, $19, _false_45_
|
||||
# was: beq _arg_44_, 0, _false_45_
|
||||
ori $16, $2, 0
|
||||
# was: ori _arg_44_, _letBind_35_, 0
|
||||
_false_45_:
|
||||
ori $2, $16, 0
|
||||
# was: ori _mainres_1_, _letBind_30_, 0
|
||||
# ori $2,_mainres_1_,0
|
||||
# was: ori $2, _arg_44_, 0
|
||||
jal write_nl
|
||||
# was: jal write_nl, $2
|
||||
# ori _mainres_9_,$2,0
|
||||
# ori $2,_mainres_9_,0
|
||||
addi $29, $29, 24
|
||||
lw $19, -20($29)
|
||||
lw $18, -16($29)
|
||||
@ -287,23 +299,7 @@ _Msg_DivZero_:
|
||||
.asciiz "division by zero"
|
||||
# String Literals
|
||||
.align 2
|
||||
_a__str__35_:
|
||||
.space 4
|
||||
.asciiz "\n"
|
||||
.align 2
|
||||
_a__str__25_:
|
||||
.space 4
|
||||
.asciiz "\n"
|
||||
.align 2
|
||||
_a__str__19_:
|
||||
.space 4
|
||||
.asciiz "\n"
|
||||
.align 2
|
||||
_a__str__13_:
|
||||
.space 4
|
||||
.asciiz "\n"
|
||||
.align 2
|
||||
_a__str__7_:
|
||||
_a__str__8_:
|
||||
.space 4
|
||||
.asciiz "\n"
|
||||
.align 2
|
||||
|
Reference in New Issue
Block a user