913 lines
14 KiB
ArmAsm
913 lines
14 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "69_expr_eval.sy"
|
|
.globl next_char
|
|
.p2align 1
|
|
.type next_char,@function
|
|
next_char:
|
|
addi sp, sp, -16
|
|
sd ra, 8(sp)
|
|
call getch
|
|
lui a1, %hi(last_char)
|
|
sw a0, %lo(last_char)(a1)
|
|
ld ra, 8(sp)
|
|
addi sp, sp, 16
|
|
ret
|
|
.Lfunc_end0:
|
|
.size next_char, .Lfunc_end0-next_char
|
|
|
|
.globl is_space
|
|
.p2align 1
|
|
.type is_space,@function
|
|
is_space:
|
|
addi a1, a0, -32
|
|
seqz a1, a1
|
|
addi a0, a0, -10
|
|
seqz a0, a0
|
|
or a0, a0, a1
|
|
ret
|
|
.Lfunc_end1:
|
|
.size is_space, .Lfunc_end1-is_space
|
|
|
|
.globl is_num
|
|
.p2align 1
|
|
.type is_num,@function
|
|
is_num:
|
|
addiw a0, a0, -48
|
|
sltiu a0, a0, 10
|
|
ret
|
|
.Lfunc_end2:
|
|
.size is_num, .Lfunc_end2-is_num
|
|
|
|
.globl next_token
|
|
.p2align 1
|
|
.type next_token,@function
|
|
next_token:
|
|
addi sp, sp, -48
|
|
sd ra, 40(sp)
|
|
sd s0, 32(sp)
|
|
sd s1, 24(sp)
|
|
sd s2, 16(sp)
|
|
sd s3, 8(sp)
|
|
lui s0, %hi(last_char)
|
|
lw a0, %lo(last_char)(s0)
|
|
li s1, 32
|
|
li s2, 10
|
|
j .LBB3_2
|
|
.LBB3_1:
|
|
call getch
|
|
sw a0, %lo(last_char)(s0)
|
|
.LBB3_2:
|
|
sext.w a1, a0
|
|
beq a1, s1, .LBB3_1
|
|
beq a1, s2, .LBB3_1
|
|
addiw a1, a0, -58
|
|
li s1, -10
|
|
bgeu a1, s1, .LBB3_6
|
|
lui a1, %hi(other)
|
|
sw a0, %lo(other)(a1)
|
|
call getch
|
|
lui a1, %hi(last_char)
|
|
sw a0, %lo(last_char)(a1)
|
|
li a0, 1
|
|
j .LBB3_10
|
|
.LBB3_6:
|
|
addiw a0, a0, -48
|
|
lui s0, %hi(num)
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bltu a1, s1, .LBB3_9
|
|
li s3, 10
|
|
li s1, -10
|
|
.LBB3_8:
|
|
lw a1, %lo(num)(s0)
|
|
mulw a1, a1, s3
|
|
addw a0, a0, a1
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bgeu a1, s1, .LBB3_8
|
|
.LBB3_9:
|
|
li a0, 0
|
|
.LBB3_10:
|
|
lui a1, %hi(cur_token)
|
|
sw a0, %lo(cur_token)(a1)
|
|
ld ra, 40(sp)
|
|
ld s0, 32(sp)
|
|
ld s1, 24(sp)
|
|
ld s2, 16(sp)
|
|
ld s3, 8(sp)
|
|
addi sp, sp, 48
|
|
ret
|
|
.Lfunc_end3:
|
|
.size next_token, .Lfunc_end3-next_token
|
|
|
|
.globl panic
|
|
.p2align 1
|
|
.type panic,@function
|
|
panic:
|
|
addi sp, sp, -16
|
|
sd ra, 8(sp)
|
|
li a0, 112
|
|
call putch
|
|
li a0, 97
|
|
call putch
|
|
li a0, 110
|
|
call putch
|
|
li a0, 105
|
|
call putch
|
|
li a0, 99
|
|
call putch
|
|
li a0, 33
|
|
call putch
|
|
li a0, 10
|
|
call putch
|
|
li a0, -1
|
|
ld ra, 8(sp)
|
|
addi sp, sp, 16
|
|
ret
|
|
.Lfunc_end4:
|
|
.size panic, .Lfunc_end4-panic
|
|
|
|
.globl get_op_prec
|
|
.p2align 1
|
|
.type get_op_prec,@function
|
|
get_op_prec:
|
|
addiw a0, a0, -37
|
|
li a1, 10
|
|
bltu a1, a0, .LBB5_2
|
|
lui a1, %hi(.Lswitch.table.eval.1)
|
|
addi a1, a1, %lo(.Lswitch.table.eval.1)
|
|
slli a0, a0, 2
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
ret
|
|
.LBB5_2:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end5:
|
|
.size get_op_prec, .Lfunc_end5-get_op_prec
|
|
|
|
.globl stack_push
|
|
.p2align 1
|
|
.type stack_push,@function
|
|
stack_push:
|
|
lw a2, 0(a0)
|
|
addiw a2, a2, 1
|
|
sw a2, 0(a0)
|
|
slli a2, a2, 2
|
|
add a0, a0, a2
|
|
sw a1, 0(a0)
|
|
ret
|
|
.Lfunc_end6:
|
|
.size stack_push, .Lfunc_end6-stack_push
|
|
|
|
.globl stack_pop
|
|
.p2align 1
|
|
.type stack_pop,@function
|
|
stack_pop:
|
|
lw a2, 0(a0)
|
|
slli a1, a2, 2
|
|
add a1, a1, a0
|
|
lw a1, 0(a1)
|
|
addiw a2, a2, -1
|
|
sw a2, 0(a0)
|
|
mv a0, a1
|
|
ret
|
|
.Lfunc_end7:
|
|
.size stack_pop, .Lfunc_end7-stack_pop
|
|
|
|
.globl stack_peek
|
|
.p2align 1
|
|
.type stack_peek,@function
|
|
stack_peek:
|
|
lw a1, 0(a0)
|
|
slli a1, a1, 2
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
ret
|
|
.Lfunc_end8:
|
|
.size stack_peek, .Lfunc_end8-stack_peek
|
|
|
|
.globl stack_size
|
|
.p2align 1
|
|
.type stack_size,@function
|
|
stack_size:
|
|
lw a0, 0(a0)
|
|
ret
|
|
.Lfunc_end9:
|
|
.size stack_size, .Lfunc_end9-stack_size
|
|
|
|
.globl eval_op
|
|
.p2align 1
|
|
.type eval_op,@function
|
|
eval_op:
|
|
addi a3, a0, -37
|
|
li a4, 10
|
|
li a0, 0
|
|
bltu a4, a3, .LBB10_3
|
|
slli a3, a3, 2
|
|
lui a4, %hi(.LJTI10_0)
|
|
addi a4, a4, %lo(.LJTI10_0)
|
|
add a3, a3, a4
|
|
lw a3, 0(a3)
|
|
jr a3
|
|
.LBB10_2:
|
|
remw a0, a1, a2
|
|
.LBB10_3:
|
|
ret
|
|
.LBB10_4:
|
|
mulw a0, a2, a1
|
|
ret
|
|
.LBB10_5:
|
|
addw a0, a2, a1
|
|
ret
|
|
.LBB10_6:
|
|
subw a0, a1, a2
|
|
ret
|
|
.LBB10_7:
|
|
divw a0, a1, a2
|
|
ret
|
|
.Lfunc_end10:
|
|
.size eval_op, .Lfunc_end10-eval_op
|
|
.section .rodata,"a",@progbits
|
|
.p2align 2
|
|
.LJTI10_0:
|
|
.word .LBB10_2
|
|
.word .LBB10_3
|
|
.word .LBB10_3
|
|
.word .LBB10_3
|
|
.word .LBB10_3
|
|
.word .LBB10_4
|
|
.word .LBB10_5
|
|
.word .LBB10_3
|
|
.word .LBB10_6
|
|
.word .LBB10_3
|
|
.word .LBB10_7
|
|
|
|
.text
|
|
.globl eval
|
|
.p2align 1
|
|
.type eval,@function
|
|
eval:
|
|
addi sp, sp, -2032
|
|
sd ra, 2024(sp)
|
|
sd s0, 2016(sp)
|
|
sd s1, 2008(sp)
|
|
sd s2, 2000(sp)
|
|
sd s3, 1992(sp)
|
|
sd s4, 1984(sp)
|
|
sd s5, 1976(sp)
|
|
sd s6, 1968(sp)
|
|
sd s7, 1960(sp)
|
|
sd s8, 1952(sp)
|
|
sd s9, 1944(sp)
|
|
sd s10, 1936(sp)
|
|
sd s11, 1928(sp)
|
|
addi sp, sp, -144
|
|
addi a0, sp, 1056
|
|
li a2, 1016
|
|
li a1, 0
|
|
call memset@plt
|
|
addi a0, sp, 24
|
|
li a2, 1024
|
|
li a1, 0
|
|
call memset@plt
|
|
lui a0, %hi(cur_token)
|
|
lw a0, %lo(cur_token)(a0)
|
|
beqz a0, .LBB11_2
|
|
.LBB11_1:
|
|
li a0, 112
|
|
call putch
|
|
li a0, 97
|
|
call putch
|
|
li a0, 110
|
|
call putch
|
|
li a0, 105
|
|
call putch
|
|
li a0, 99
|
|
call putch
|
|
li a0, 33
|
|
call putch
|
|
li a0, 10
|
|
call putch
|
|
li a0, -1
|
|
srli a0, a0, 32
|
|
j .LBB11_66
|
|
.LBB11_2:
|
|
lui a0, %hi(num)
|
|
lw a1, %lo(num)(a0)
|
|
li a0, 1
|
|
sw a0, 1048(sp)
|
|
lui s0, %hi(last_char)
|
|
lw a0, %lo(last_char)(s0)
|
|
sw a1, 1052(sp)
|
|
li s1, 32
|
|
li s2, 10
|
|
j .LBB11_4
|
|
.LBB11_3:
|
|
call getch
|
|
sw a0, %lo(last_char)(s0)
|
|
.LBB11_4:
|
|
sext.w a1, a0
|
|
beq a1, s1, .LBB11_3
|
|
beq a1, s2, .LBB11_3
|
|
addiw a1, a0, -58
|
|
li s7, -10
|
|
bgeu a1, s7, .LBB11_39
|
|
lui s0, %hi(other)
|
|
sw a0, %lo(other)(s0)
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
sw a0, %lo(last_char)(s2)
|
|
lui a1, %hi(cur_token)
|
|
li a2, 1
|
|
sw a2, %lo(cur_token)(a1)
|
|
li a1, 1377
|
|
slli a1, a1, 37
|
|
sd a1, 16(sp)
|
|
li s6, 32
|
|
li s8, 10
|
|
lui s10, %hi(num)
|
|
addi s11, sp, 1048
|
|
lui a1, %hi(.Lswitch.table.eval.1)
|
|
addi s5, a1, %lo(.Lswitch.table.eval.1)
|
|
lui a1, %hi(.LJTI11_0)
|
|
addi s9, a1, %lo(.LJTI11_0)
|
|
lw s3, %lo(other)(s0)
|
|
li a1, 47
|
|
bltu a1, s3, .LBB11_46
|
|
.LBB11_8:
|
|
sll a1, a2, s3
|
|
ld a2, 16(sp)
|
|
and a1, a1, a2
|
|
bnez a1, .LBB11_10
|
|
j .LBB11_46
|
|
.LBB11_9:
|
|
call getch
|
|
sw a0, %lo(last_char)(s2)
|
|
.LBB11_10:
|
|
sext.w a1, a0
|
|
beq a1, s6, .LBB11_9
|
|
beq a1, s8, .LBB11_9
|
|
addiw a1, a0, -58
|
|
bgeu a1, s7, .LBB11_14
|
|
sw a0, %lo(other)(s0)
|
|
call getch
|
|
li s4, 0
|
|
sw a0, %lo(last_char)(s2)
|
|
li a2, 1
|
|
lw a1, 24(sp)
|
|
lui a3, %hi(cur_token)
|
|
sw a2, %lo(cur_token)(a3)
|
|
bnez a1, .LBB11_17
|
|
j .LBB11_31
|
|
.LBB11_14:
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s10)
|
|
call getch
|
|
sw a0, %lo(last_char)(s2)
|
|
addiw a1, a0, -58
|
|
li s4, 1
|
|
bltu a1, s7, .LBB11_16
|
|
.LBB11_15:
|
|
lw a1, %lo(num)(s10)
|
|
mulw a1, a1, s8
|
|
addw a0, a0, a1
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s10)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bgeu a1, s7, .LBB11_15
|
|
.LBB11_16:
|
|
li a2, 0
|
|
lw a1, 24(sp)
|
|
lui a3, %hi(cur_token)
|
|
sw a2, %lo(cur_token)(a3)
|
|
beqz a1, .LBB11_31
|
|
.LBB11_17:
|
|
addiw a7, s3, -37
|
|
slli a2, a7, 2
|
|
add a6, a2, s5
|
|
slli a2, a1, 2
|
|
addi a3, sp, 24
|
|
add a4, a3, a2
|
|
j .LBB11_20
|
|
.LBB11_18:
|
|
remw a3, s0, a2
|
|
.LBB11_19:
|
|
addi a1, a1, -1
|
|
sw a3, 0(a5)
|
|
sext.w a2, a1
|
|
addi a4, a4, -4
|
|
beqz a2, .LBB11_31
|
|
.LBB11_20:
|
|
lw a5, 0(a4)
|
|
addiw a2, a5, -37
|
|
bltu s8, a2, .LBB11_23
|
|
slli a2, a2, 2
|
|
add a2, a2, s5
|
|
lw a3, 0(a2)
|
|
bgeu s8, a7, .LBB11_24
|
|
.LBB11_22:
|
|
li a2, 0
|
|
bgeu a3, a2, .LBB11_25
|
|
j .LBB11_32
|
|
.LBB11_23:
|
|
li a3, 0
|
|
bltu s8, a7, .LBB11_22
|
|
.LBB11_24:
|
|
lw a2, 0(a6)
|
|
bltu a3, a2, .LBB11_32
|
|
.LBB11_25:
|
|
lw s0, 1048(sp)
|
|
li a3, 0
|
|
slli a2, s0, 2
|
|
add a2, a2, s11
|
|
lw a2, 0(a2)
|
|
addiw s0, s0, -1
|
|
sw s0, 1048(sp)
|
|
slli s1, s0, 2
|
|
addi s0, a5, -37
|
|
add a5, s11, s1
|
|
bltu s8, s0, .LBB11_19
|
|
slli s1, s0, 2
|
|
add s1, s1, s9
|
|
lw s1, 0(s1)
|
|
lw s0, 0(a5)
|
|
jr s1
|
|
.LBB11_27:
|
|
mulw a3, s0, a2
|
|
j .LBB11_19
|
|
.LBB11_28:
|
|
addw a3, s0, a2
|
|
j .LBB11_19
|
|
.LBB11_29:
|
|
subw a3, s0, a2
|
|
j .LBB11_19
|
|
.LBB11_30:
|
|
divw a3, s0, a2
|
|
j .LBB11_19
|
|
.LBB11_31:
|
|
li a1, 0
|
|
.LBB11_32:
|
|
addiw a1, a1, 1
|
|
sw a1, 24(sp)
|
|
slli a1, a1, 2
|
|
addi a2, sp, 24
|
|
add a1, a1, a2
|
|
sw s3, 0(a1)
|
|
beqz s4, .LBB11_1
|
|
lw a1, 1048(sp)
|
|
lw a2, %lo(num)(s10)
|
|
addiw a1, a1, 1
|
|
sw a1, 1048(sp)
|
|
slli a1, a1, 2
|
|
add a1, a1, s11
|
|
sw a2, 0(a1)
|
|
lui s0, %hi(other)
|
|
j .LBB11_35
|
|
.LBB11_34:
|
|
call getch
|
|
sw a0, %lo(last_char)(s2)
|
|
.LBB11_35:
|
|
sext.w a1, a0
|
|
beq a1, s6, .LBB11_34
|
|
beq a1, s8, .LBB11_34
|
|
addiw a1, a0, -58
|
|
bgeu a1, s7, .LBB11_42
|
|
sw a0, %lo(other)(s0)
|
|
call getch
|
|
sw a0, %lo(last_char)(s2)
|
|
lui a1, %hi(cur_token)
|
|
li a2, 1
|
|
sw a2, %lo(cur_token)(a1)
|
|
lw s3, %lo(other)(s0)
|
|
li a1, 47
|
|
bgeu a1, s3, .LBB11_8
|
|
j .LBB11_46
|
|
.LBB11_39:
|
|
addiw a0, a0, -48
|
|
lui s0, %hi(num)
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bltu a1, s7, .LBB11_45
|
|
li s3, 10
|
|
li s1, -10
|
|
.LBB11_41:
|
|
lw a1, %lo(num)(s0)
|
|
mulw a1, a1, s3
|
|
addw a0, a0, a1
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bgeu a1, s1, .LBB11_41
|
|
j .LBB11_45
|
|
.LBB11_42:
|
|
addiw a0, a0, -48
|
|
lui s0, %hi(num)
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
addiw a1, a0, -58
|
|
li a2, -10
|
|
sw a0, %lo(last_char)(s2)
|
|
bltu a1, a2, .LBB11_45
|
|
li s3, 10
|
|
li s1, -11
|
|
.LBB11_44:
|
|
lw a1, %lo(num)(s0)
|
|
mulw a1, a1, s3
|
|
addw a0, a0, a1
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bltu s1, a1, .LBB11_44
|
|
.LBB11_45:
|
|
lui a1, %hi(cur_token)
|
|
sw zero, %lo(cur_token)(a1)
|
|
.LBB11_46:
|
|
li s0, 32
|
|
lui s1, %hi(last_char)
|
|
li s2, 10
|
|
j .LBB11_48
|
|
.LBB11_47:
|
|
call getch
|
|
sw a0, %lo(last_char)(s1)
|
|
.LBB11_48:
|
|
sext.w a1, a0
|
|
beq a1, s0, .LBB11_47
|
|
beq a1, s2, .LBB11_47
|
|
addiw a1, a0, -58
|
|
li s1, -10
|
|
bgeu a1, s1, .LBB11_52
|
|
lui a1, %hi(other)
|
|
sw a0, %lo(other)(a1)
|
|
call getch
|
|
lui a1, %hi(last_char)
|
|
sw a0, %lo(last_char)(a1)
|
|
li a0, 1
|
|
lw a1, 24(sp)
|
|
lui a2, %hi(cur_token)
|
|
sw a0, %lo(cur_token)(a2)
|
|
bnez a1, .LBB11_56
|
|
j .LBB11_65
|
|
.LBB11_52:
|
|
addiw a0, a0, -48
|
|
lui s0, %hi(num)
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bltu a1, s1, .LBB11_55
|
|
li s3, 10
|
|
li s1, -10
|
|
.LBB11_54:
|
|
lw a1, %lo(num)(s0)
|
|
mulw a1, a1, s3
|
|
addw a0, a0, a1
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s0)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bgeu a1, s1, .LBB11_54
|
|
.LBB11_55:
|
|
li a0, 0
|
|
lw a1, 24(sp)
|
|
lui a2, %hi(cur_token)
|
|
sw a0, %lo(cur_token)(a2)
|
|
beqz a1, .LBB11_65
|
|
.LBB11_56:
|
|
slli a0, a1, 2
|
|
addi a2, sp, 24
|
|
add a0, a0, a2
|
|
addi a1, a1, -1
|
|
addi a2, sp, 1048
|
|
li a6, 10
|
|
lui a3, %hi(.LJTI11_1)
|
|
addi a7, a3, %lo(.LJTI11_1)
|
|
j .LBB11_59
|
|
.LBB11_57:
|
|
remw s1, a3, s0
|
|
.LBB11_58:
|
|
sw s1, 0(a5)
|
|
sext.w a3, a1
|
|
addi a0, a0, -4
|
|
addi a1, a1, -1
|
|
beqz a3, .LBB11_65
|
|
.LBB11_59:
|
|
lw a3, 1048(sp)
|
|
li s1, 0
|
|
lw a5, 0(a0)
|
|
slli s0, a3, 2
|
|
add s0, s0, a2
|
|
lw s0, 0(s0)
|
|
addiw a3, a3, -1
|
|
sw a3, 1048(sp)
|
|
slli a4, a3, 2
|
|
addi a3, a5, -37
|
|
add a5, a2, a4
|
|
bltu a6, a3, .LBB11_58
|
|
slli a3, a3, 2
|
|
add a3, a3, a7
|
|
lw a4, 0(a3)
|
|
lw a3, 0(a5)
|
|
jr a4
|
|
.LBB11_61:
|
|
mulw s1, a3, s0
|
|
j .LBB11_58
|
|
.LBB11_62:
|
|
addw s1, a3, s0
|
|
j .LBB11_58
|
|
.LBB11_63:
|
|
subw s1, a3, s0
|
|
j .LBB11_58
|
|
.LBB11_64:
|
|
divw s1, a3, s0
|
|
j .LBB11_58
|
|
.LBB11_65:
|
|
lw a0, 1048(sp)
|
|
slli a0, a0, 2
|
|
addi a1, sp, 1048
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
.LBB11_66:
|
|
sext.w a0, a0
|
|
addi sp, sp, 144
|
|
ld ra, 2024(sp)
|
|
ld s0, 2016(sp)
|
|
ld s1, 2008(sp)
|
|
ld s2, 2000(sp)
|
|
ld s3, 1992(sp)
|
|
ld s4, 1984(sp)
|
|
ld s5, 1976(sp)
|
|
ld s6, 1968(sp)
|
|
ld s7, 1960(sp)
|
|
ld s8, 1952(sp)
|
|
ld s9, 1944(sp)
|
|
ld s10, 1936(sp)
|
|
ld s11, 1928(sp)
|
|
addi sp, sp, 2032
|
|
ret
|
|
.Lfunc_end11:
|
|
.size eval, .Lfunc_end11-eval
|
|
.section .rodata,"a",@progbits
|
|
.p2align 2
|
|
.LJTI11_0:
|
|
.word .LBB11_18
|
|
.word .LBB11_19
|
|
.word .LBB11_19
|
|
.word .LBB11_19
|
|
.word .LBB11_19
|
|
.word .LBB11_27
|
|
.word .LBB11_28
|
|
.word .LBB11_19
|
|
.word .LBB11_29
|
|
.word .LBB11_19
|
|
.word .LBB11_30
|
|
.LJTI11_1:
|
|
.word .LBB11_57
|
|
.word .LBB11_58
|
|
.word .LBB11_58
|
|
.word .LBB11_58
|
|
.word .LBB11_58
|
|
.word .LBB11_61
|
|
.word .LBB11_62
|
|
.word .LBB11_58
|
|
.word .LBB11_63
|
|
.word .LBB11_58
|
|
.word .LBB11_64
|
|
|
|
.text
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -48
|
|
sd ra, 40(sp)
|
|
sd s0, 32(sp)
|
|
sd s1, 24(sp)
|
|
sd s2, 16(sp)
|
|
sd s3, 8(sp)
|
|
sd s4, 0(sp)
|
|
call getint
|
|
mv s0, a0
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
lw a0, %lo(last_char)(s2)
|
|
li s1, 32
|
|
li s3, 10
|
|
j .LBB12_2
|
|
.LBB12_1:
|
|
call getch
|
|
sw a0, %lo(last_char)(s2)
|
|
.LBB12_2:
|
|
sext.w a1, a0
|
|
beq a1, s1, .LBB12_1
|
|
beq a1, s3, .LBB12_1
|
|
addiw a1, a0, -58
|
|
li s3, -10
|
|
bgeu a1, s3, .LBB12_8
|
|
lui a1, %hi(other)
|
|
sw a0, %lo(other)(a1)
|
|
call getch
|
|
lui a1, %hi(last_char)
|
|
sw a0, %lo(last_char)(a1)
|
|
li a0, 1
|
|
lui a1, %hi(cur_token)
|
|
sw a0, %lo(cur_token)(a1)
|
|
beqz s0, .LBB12_7
|
|
.LBB12_6:
|
|
call eval
|
|
call putint
|
|
li a0, 10
|
|
call putch
|
|
addiw s0, s0, -1
|
|
bnez s0, .LBB12_6
|
|
.LBB12_7:
|
|
li a0, 0
|
|
ld ra, 40(sp)
|
|
ld s0, 32(sp)
|
|
ld s1, 24(sp)
|
|
ld s2, 16(sp)
|
|
ld s3, 8(sp)
|
|
ld s4, 0(sp)
|
|
addi sp, sp, 48
|
|
ret
|
|
.LBB12_8:
|
|
addiw a0, a0, -48
|
|
lui s1, %hi(num)
|
|
sw a0, %lo(num)(s1)
|
|
call getch
|
|
lui s2, %hi(last_char)
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bltu a1, s3, .LBB12_11
|
|
li s3, 10
|
|
li s4, -10
|
|
.LBB12_10:
|
|
lw a1, %lo(num)(s1)
|
|
mulw a1, a1, s3
|
|
addw a0, a0, a1
|
|
addiw a0, a0, -48
|
|
sw a0, %lo(num)(s1)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
sw a0, %lo(last_char)(s2)
|
|
bgeu a1, s4, .LBB12_10
|
|
.LBB12_11:
|
|
li a0, 0
|
|
lui a1, %hi(cur_token)
|
|
sw a0, %lo(cur_token)(a1)
|
|
bnez s0, .LBB12_6
|
|
j .LBB12_7
|
|
.Lfunc_end12:
|
|
.size main, .Lfunc_end12-main
|
|
|
|
.type TOKEN_NUM,@object
|
|
.section .rodata,"a",@progbits
|
|
.globl TOKEN_NUM
|
|
.p2align 2
|
|
TOKEN_NUM:
|
|
.word 0
|
|
.size TOKEN_NUM, 4
|
|
|
|
.type TOKEN_OTHER,@object
|
|
.globl TOKEN_OTHER
|
|
.p2align 2
|
|
TOKEN_OTHER:
|
|
.word 1
|
|
.size TOKEN_OTHER, 4
|
|
|
|
.type last_char,@object
|
|
.section .sdata,"aw",@progbits
|
|
.globl last_char
|
|
.p2align 2
|
|
last_char:
|
|
.word 32
|
|
.size last_char, 4
|
|
|
|
.type num,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl num
|
|
.p2align 2
|
|
num:
|
|
.word 0
|
|
.size num, 4
|
|
|
|
.type cur_token,@object
|
|
.globl cur_token
|
|
.p2align 2
|
|
cur_token:
|
|
.word 0
|
|
.size cur_token, 4
|
|
|
|
.type other,@object
|
|
.globl other
|
|
.p2align 2
|
|
other:
|
|
.word 0
|
|
.size other, 4
|
|
|
|
.type _sysy_start,@object
|
|
.bss
|
|
.globl _sysy_start
|
|
.p2align 3
|
|
_sysy_start:
|
|
.zero 16
|
|
.size _sysy_start, 16
|
|
|
|
.type _sysy_end,@object
|
|
.globl _sysy_end
|
|
.p2align 3
|
|
_sysy_end:
|
|
.zero 16
|
|
.size _sysy_end, 16
|
|
|
|
.type _sysy_l1,@object
|
|
.globl _sysy_l1
|
|
.p2align 2
|
|
_sysy_l1:
|
|
.zero 4096
|
|
.size _sysy_l1, 4096
|
|
|
|
.type _sysy_l2,@object
|
|
.globl _sysy_l2
|
|
.p2align 2
|
|
_sysy_l2:
|
|
.zero 4096
|
|
.size _sysy_l2, 4096
|
|
|
|
.type _sysy_h,@object
|
|
.globl _sysy_h
|
|
.p2align 2
|
|
_sysy_h:
|
|
.zero 4096
|
|
.size _sysy_h, 4096
|
|
|
|
.type _sysy_m,@object
|
|
.globl _sysy_m
|
|
.p2align 2
|
|
_sysy_m:
|
|
.zero 4096
|
|
.size _sysy_m, 4096
|
|
|
|
.type _sysy_s,@object
|
|
.globl _sysy_s
|
|
.p2align 2
|
|
_sysy_s:
|
|
.zero 4096
|
|
.size _sysy_s, 4096
|
|
|
|
.type _sysy_us,@object
|
|
.globl _sysy_us
|
|
.p2align 2
|
|
_sysy_us:
|
|
.zero 4096
|
|
.size _sysy_us, 4096
|
|
|
|
.type _sysy_idx,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl _sysy_idx
|
|
.p2align 2
|
|
_sysy_idx:
|
|
.word 0
|
|
.size _sysy_idx, 4
|
|
|
|
.type .Lswitch.table.eval.1,@object
|
|
.section .rodata,"a",@progbits
|
|
.p2align 2
|
|
.Lswitch.table.eval.1:
|
|
.word 20
|
|
.word 0
|
|
.word 0
|
|
.word 0
|
|
.word 0
|
|
.word 20
|
|
.word 10
|
|
.word 0
|
|
.word 10
|
|
.word 0
|
|
.word 20
|
|
.size .Lswitch.table.eval.1, 44
|
|
|
|
.ident "Debian clang version 14.0.6"
|
|
.section ".note.GNU-stack","",@progbits
|
|
.addrsig
|