From 1df264ed77a2e45c96af3bb3a9bb57990c94be8f Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Fri, 23 Aug 2024 11:25:33 +0000 Subject: [PATCH] fix many buuuuuuuuuuuuuuuuuuuuuugs --- include/IR/IR_basic.h | 3 +- src/IR/IRBuilder.cpp | 149 +++++++++++++++++--- src/IR/builtin.c | 22 ++- src/IR/builtin.ll | 321 +++++++++++++++++++++++++----------------- src/IR/builtin.s | 286 +++++++++++++++++++++++-------------- 5 files changed, 528 insertions(+), 253 deletions(-) diff --git a/include/IR/IR_basic.h b/include/IR/IR_basic.h index f0ba5a0..9bfcd26 100644 --- a/include/IR/IR_basic.h +++ b/include/IR/IR_basic.h @@ -310,6 +310,7 @@ class CallItem : public ActionItem { }; class PhiItem : public ActionItem { + friend class IRBuilder; std::string result_full; LLVMType ty; std::vector> values; // (val_i_full, label_i_full) @@ -326,7 +327,7 @@ class PhiItem : public ActionItem { } os << " "; for (size_t i = 0; i < values.size(); i++) { - os << " [" << values[i].first << ", " << values[i].second << "]"; + os << " [" << values[i].first << ", %" << values[i].second << "]"; if (i != values.size() - 1) { os << ", "; } diff --git a/src/IR/IRBuilder.cpp b/src/IR/IRBuilder.cpp index 3b5df27..9b69a84 100644 --- a/src/IR/IRBuilder.cpp +++ b/src/IR/IRBuilder.cpp @@ -583,10 +583,12 @@ void IRBuilder::ActuralVisit(AccessExpr_ASTNode *node) { void IRBuilder::ActuralVisit(IndexExpr_ASTNode *node) { node->base->accept(this); std::string cur_val = node->base->IR_result_full; + auto type_of_base = node->base->expr_type_info; + size_t total_dims = std::get(type_of_base).level; std::string cur_addr; for (size_t i = 0; i < node->indices.size(); i++) { LLVMType cur_ty; - if (i + 1 < node->indices.size()) + if (i + 1 < total_dims) cur_ty = LLVMIRPTRType(); else { ArrayType tp = std::get(node->base->expr_type_info); @@ -741,6 +743,20 @@ void IRBuilder::ActuralVisit(MDMExpr_ASTNode *node) { void IRBuilder::ActuralVisit(PMExpr_ASTNode *node) { node->left->accept(this); node->right->accept(this); + ExprTypeInfo string_std = IdentifierType("string"); + if (node->left->expr_type_info == string_std) { + auto act = std::make_shared(); + cur_block->actions.push_back(act); + act->func_name_raw = ".builtin.strcat"; + act->return_type = LLVMIRPTRType(); + act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); + act->args_ty.push_back(LLVMIRPTRType()); + act->args_val_full.push_back(node->left->IR_result_full); + act->args_ty.push_back(LLVMIRPTRType()); + act->args_val_full.push_back(node->right->IR_result_full); + node->IR_result_full = act->result_full; + return; + } auto act = std::make_shared(); cur_block->actions.push_back(act); if (node->op == "+") { @@ -755,7 +771,6 @@ void IRBuilder::ActuralVisit(PMExpr_ASTNode *node) { act->type = LLVMIRIntType(32); act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); node->IR_result_full = act->result_full; - // TODO: support for string concatenation } void IRBuilder::ActuralVisit(RLExpr_ASTNode *node) { @@ -862,35 +877,118 @@ void IRBuilder::ActuralVisit(BOrExpr_ASTNode *node) { void IRBuilder::ActuralVisit(LAndExpr_ASTNode *node) { node->left->accept(this); + // node->right->accept(this); + // auto act = std::make_shared(); + // cur_block->actions.push_back(act); + // act->op = "and"; + // act->operand1_full = node->left->IR_result_full; + // act->operand2_full = node->right->IR_result_full; + // act->type = LLVMIRIntType(1); + // act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); + // node->IR_result_full = act->result_full; + size_t right_cal_block_id = block_counter++; + size_t new_block_id = block_counter++; + auto right_cal_block = std::make_shared(); + auto new_block = std::make_shared(); + right_cal_block->label_full = "label_" + std::to_string(right_cal_block_id); + new_block->label_full = "label_" + std::to_string(new_block_id); + cur_block->exit_action = std::make_shared(); + auto src_block = cur_block; + std::dynamic_pointer_cast(cur_block->exit_action)->true_label_full = right_cal_block->label_full; + std::dynamic_pointer_cast(cur_block->exit_action)->false_label_full = new_block->label_full; + std::dynamic_pointer_cast(cur_block->exit_action)->cond = node->left->IR_result_full; + cur_func->basic_blocks.push_back(right_cal_block); + cur_block = right_cal_block; node->right->accept(this); - auto act = std::make_shared(); - cur_block->actions.push_back(act); - act->op = "and"; - act->operand1_full = node->left->IR_result_full; - act->operand2_full = node->right->IR_result_full; - act->type = LLVMIRIntType(1); - act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); - node->IR_result_full = act->result_full; - // TODO: short-circuit + cur_block->exit_action = std::make_shared(); + auto right_block_end = cur_block; + std::dynamic_pointer_cast(cur_block->exit_action)->label_full = new_block->label_full; + cur_func->basic_blocks.push_back(new_block); + cur_block = new_block; + auto phi_act = std::make_shared(); + phi_act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); + phi_act->ty = LLVMIRIntType(1); + phi_act->values.push_back(std::make_pair("0", src_block->label_full)); + phi_act->values.push_back(std::make_pair(node->right->IR_result_full, right_block_end->label_full)); + cur_block->actions.push_back(phi_act); + node->IR_result_full = phi_act->result_full; } void IRBuilder::ActuralVisit(LOrExpr_ASTNode *node) { node->left->accept(this); + // node->right->accept(this); + // auto act = std::make_shared(); + // cur_block->actions.push_back(act); + // act->op = "or"; + // act->operand1_full = node->left->IR_result_full; + // act->operand2_full = node->right->IR_result_full; + // act->type = LLVMIRIntType(1); + // act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); + // node->IR_result_full = act->result_full; + size_t right_cal_block_id = block_counter++; + size_t new_block_id = block_counter++; + auto right_cal_block = std::make_shared(); + auto new_block = std::make_shared(); + right_cal_block->label_full = "label_" + std::to_string(right_cal_block_id); + new_block->label_full = "label_" + std::to_string(new_block_id); + cur_block->exit_action = std::make_shared(); + auto src_block = cur_block; + std::dynamic_pointer_cast(cur_block->exit_action)->true_label_full = new_block->label_full; + std::dynamic_pointer_cast(cur_block->exit_action)->false_label_full = right_cal_block->label_full; + std::dynamic_pointer_cast(cur_block->exit_action)->cond = node->left->IR_result_full; + cur_func->basic_blocks.push_back(right_cal_block); + cur_block = right_cal_block; node->right->accept(this); - auto act = std::make_shared(); - cur_block->actions.push_back(act); - act->op = "or"; - act->operand1_full = node->left->IR_result_full; - act->operand2_full = node->right->IR_result_full; - act->type = LLVMIRIntType(1); - act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); - node->IR_result_full = act->result_full; - // TODO: short-circuit + cur_block->exit_action = std::make_shared(); + auto right_block_end = cur_block; + std::dynamic_pointer_cast(cur_block->exit_action)->label_full = new_block->label_full; + cur_func->basic_blocks.push_back(new_block); + cur_block = new_block; + auto phi_act = std::make_shared(); + phi_act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); + phi_act->ty = LLVMIRIntType(1); + phi_act->values.push_back(std::make_pair("1", src_block->label_full)); + phi_act->values.push_back(std::make_pair(node->right->IR_result_full, right_block_end->label_full)); + cur_block->actions.push_back(phi_act); + node->IR_result_full = phi_act->result_full; } void IRBuilder::ActuralVisit(TernaryExpr_ASTNode *node) { - // TODO: Implement function body - throw std::runtime_error("ternary operator not supported"); + node->condition->accept(this); + size_t src1_block_id = block_counter++; + size_t src2_block_id = block_counter++; + size_t new_block_id = block_counter++; + auto src1_block = std::make_shared(); + auto src2_block = std::make_shared(); + auto new_block = std::make_shared(); + src1_block->label_full = "label_" + std::to_string(src1_block_id); + src2_block->label_full = "label_" + std::to_string(src2_block_id); + new_block->label_full = "label_" + std::to_string(new_block_id); + cur_block->exit_action = std::make_shared(); + std::dynamic_pointer_cast(cur_block->exit_action)->true_label_full = src1_block->label_full; + std::dynamic_pointer_cast(cur_block->exit_action)->false_label_full = src2_block->label_full; + std::dynamic_pointer_cast(cur_block->exit_action)->cond = node->condition->IR_result_full; + cur_func->basic_blocks.push_back(src1_block); + cur_block = src1_block; + node->src1->accept(this); + cur_block->exit_action = std::make_shared(); + auto src1_end_block = cur_block; + std::dynamic_pointer_cast(cur_block->exit_action)->label_full = new_block->label_full; + cur_func->basic_blocks.push_back(src2_block); + cur_block = src2_block; + node->src2->accept(this); + cur_block->exit_action = std::make_shared(); + auto src2_end_block = cur_block; + std::dynamic_pointer_cast(cur_block->exit_action)->label_full = new_block->label_full; + cur_func->basic_blocks.push_back(new_block); + cur_block = new_block; + auto phi_act = std::make_shared(); + phi_act->result_full = "%.var.tmp." + std::to_string(tmp_var_counter++); + phi_act->ty = Type_AST2LLVM(node->expr_type_info); + phi_act->values.push_back(std::make_pair(node->src1->IR_result_full, src1_end_block->label_full)); + phi_act->values.push_back(std::make_pair(node->src2->IR_result_full, src2_end_block->label_full)); + cur_block->actions.push_back(phi_act); + node->IR_result_full = phi_act->result_full; } void IRBuilder::ActuralVisit(AssignExpr_ASTNode *node) { @@ -1162,6 +1260,13 @@ std::shared_ptr BuildIR(std::shared_ptr src) { tmp->args.push_back(LLVMIRIntType(32)); visitor.prog->function_declares.push_back(tmp); + tmp = std::make_shared(); // char *_builtin_strcat(char *dest, const char *src); + tmp->func_name_raw = ".builtin.strcat"; + tmp->return_type = LLVMIRPTRType(); + tmp->args.push_back(LLVMIRPTRType()); + tmp->args.push_back(LLVMIRPTRType()); + visitor.prog->function_declares.push_back(tmp); + visitor.global_scope = std::dynamic_pointer_cast(src->current_scope); if (!(visitor.global_scope)) throw std::runtime_error("global scope not found"); visitor.visit(src.get()); diff --git a/src/IR/builtin.c b/src/IR/builtin.c index 938b108..b922ac0 100644 --- a/src/IR/builtin.c +++ b/src/IR/builtin.c @@ -3,11 +3,26 @@ #define EOF (-1) // libc function void* malloc(unsigned int size); +unsigned int strlen(const char *s); void free(void* ptr); int printf(const char *pattern, ...); int scanf(const char *format, ...); int sprintf(char *str, const char *pattern, ...); int sscanf(const char *str, const char *pattern, ...); +char *strcat(char *dest, const char *src); +char *_builtin_strcat(char *dest, const char *src) { + int len1=strlen(dest); + int len2=strlen(src); + char* res=(char*)malloc(len1+len2+1); + for(int i=0;iThis Inner Loop Header: Depth=1 + lbu a3, 0(s1) + sb a3, 0(a2) + addi a2, a2, 1 + addi s1, s1, 1 + bne a2, a1, .LBB0_2 +.LBB0_3: + blez s3, .LBB0_6 +# %bb.4: # %.preheader + add s2, s2, a0 + add a1, a0, s4 +.LBB0_5: # =>This Inner Loop Header: Depth=1 + lbu a2, 0(s0) + sb a2, 0(s2) + addi s2, s2, 1 + addi s0, s0, 1 + bne s2, a1, .LBB0_5 +.LBB0_6: + add s4, s4, a0 + sb zero, 0(s4) + lw ra, 28(sp) # 4-byte Folded Reload + lw s0, 24(sp) # 4-byte Folded Reload + lw s1, 20(sp) # 4-byte Folded Reload + lw s2, 16(sp) # 4-byte Folded Reload + lw s3, 12(sp) # 4-byte Folded Reload + lw s4, 8(sp) # 4-byte Folded Reload + addi sp, sp, 32 + ret +.Lfunc_end0: + .size .builtin.strcat, .Lfunc_end0-.builtin.strcat + # -- End function + .option pop + .option push + .option arch, +a, +c .globl string.length # -- Begin function string.length .p2align 1 .type string.length,@function string.length: # @string.length # %bb.0: li a1, 0 -.LBB0_1: # =>This Inner Loop Header: Depth=1 +.LBB1_1: # =>This Inner Loop Header: Depth=1 add a2, a0, a1 lbu a2, 0(a2) addi a1, a1, 1 - bnez a2, .LBB0_1 + bnez a2, .LBB1_1 # %bb.2: addi a0, a1, -1 ret -.Lfunc_end0: - .size string.length, .Lfunc_end0-string.length +.Lfunc_end1: + .size string.length, .Lfunc_end1-string.length # -- End function .option pop .option push @@ -40,17 +100,17 @@ string.substring: # @string.substring addi a0, s1, 1 call malloc add a1, a0, s1 - blez s1, .LBB1_3 + blez s1, .LBB2_3 # %bb.1: # %.preheader add s0, s0, s2 mv a2, a0 -.LBB1_2: # =>This Inner Loop Header: Depth=1 +.LBB2_2: # =>This Inner Loop Header: Depth=1 lbu a3, 0(s0) sb a3, 0(a2) addi a2, a2, 1 addi s0, s0, 1 - bne a2, a1, .LBB1_2 -.LBB1_3: + bne a2, a1, .LBB2_2 +.LBB2_3: sb zero, 0(a1) lw ra, 12(sp) # 4-byte Folded Reload lw s0, 8(sp) # 4-byte Folded Reload @@ -58,8 +118,8 @@ string.substring: # @string.substring lw s2, 0(sp) # 4-byte Folded Reload addi sp, sp, 16 ret -.Lfunc_end1: - .size string.substring, .Lfunc_end1-string.substring +.Lfunc_end2: + .size string.substring, .Lfunc_end2-string.substring # -- End function .option pop .option push @@ -79,8 +139,8 @@ string.parseInt: # @string.parseInt lw ra, 12(sp) # 4-byte Folded Reload addi sp, sp, 16 ret -.Lfunc_end2: - .size string.parseInt, .Lfunc_end2-string.parseInt +.Lfunc_end3: + .size string.parseInt, .Lfunc_end3-string.parseInt # -- End function .option pop .option push @@ -93,8 +153,8 @@ string.ord: # @string.ord add a0, a0, a1 lbu a0, 0(a0) ret -.Lfunc_end3: - .size string.ord, .Lfunc_end3-string.ord +.Lfunc_end4: + .size string.ord, .Lfunc_end4-string.ord # -- End function .option pop .option push @@ -110,8 +170,8 @@ print: # @print mv a0, a1 mv a1, a2 tail printf -.Lfunc_end4: - .size print, .Lfunc_end4-print +.Lfunc_end5: + .size print, .Lfunc_end5-print # -- End function .option pop .option push @@ -127,8 +187,8 @@ println: # @println mv a0, a1 mv a1, a2 tail printf -.Lfunc_end5: - .size println, .Lfunc_end5-println +.Lfunc_end6: + .size println, .Lfunc_end6-println # -- End function .option pop .option push @@ -144,8 +204,8 @@ printInt: # @printInt mv a0, a1 mv a1, a2 tail printf -.Lfunc_end6: - .size printInt, .Lfunc_end6-printInt +.Lfunc_end7: + .size printInt, .Lfunc_end7-printInt # -- End function .option pop .option push @@ -161,8 +221,8 @@ printlnInt: # @printlnInt mv a0, a1 mv a1, a2 tail printf -.Lfunc_end7: - .size printlnInt, .Lfunc_end7-printlnInt +.Lfunc_end8: + .size printlnInt, .Lfunc_end8-printlnInt # -- End function .option pop .option push @@ -191,8 +251,8 @@ toString: # @toString lw s1, 4(sp) # 4-byte Folded Reload addi sp, sp, 16 ret -.Lfunc_end8: - .size toString, .Lfunc_end8-toString +.Lfunc_end9: + .size toString, .Lfunc_end9-toString # -- End function .option pop .option push @@ -213,76 +273,95 @@ getString: # @getString sw s6, 16(sp) # 4-byte Folded Spill sw s7, 12(sp) # 4-byte Folded Spill sw s8, 8(sp) # 4-byte Folded Spill + sw s9, 4(sp) # 4-byte Folded Spill li a0, 11 call malloc - mv s8, a0 + mv s3, a0 lui a0, %hi(.L.str.4) - addi s2, a0, %lo(.L.str.4) - addi a1, sp, 7 - mv a0, s2 + addi s0, a0, %lo(.L.str.4) + addi a1, sp, 3 + mv a0, s0 call scanf - li s3, 1 - bne a0, s3, .LBB9_11 -# %bb.1: # %.preheader1 - li s1, 0 + li s9, 1 + bne a0, s9, .LBB10_15 +# %bb.1: # %.preheader4 + li s6, 0 li s4, 10 li s5, 13 - mv s6, s8 + mv s2, s3 + li a1, 1 li s7, 10 - j .LBB9_4 -.LBB9_2: # in Loop: Header=BB9_4 Depth=1 - mv s8, s6 -.LBB9_3: # in Loop: Header=BB9_4 Depth=1 - addi s0, s1, 1 - add s1, s1, s8 - sb a0, 0(s1) - addi a1, sp, 7 - mv a0, s2 - call scanf - mv s1, s0 - bne a0, s3, .LBB9_13 -.LBB9_4: # =>This Loop Header: Depth=1 - # Child Loop BB9_9 Depth 2 - lbu a0, 7(sp) - beq a0, s4, .LBB9_12 -# %bb.5: # in Loop: Header=BB9_4 Depth=1 - beq a0, s5, .LBB9_12 -# %bb.6: # in Loop: Header=BB9_4 Depth=1 - bne s1, s7, .LBB9_2 -# %bb.7: # in Loop: Header=BB9_4 Depth=1 - slli s7, s1, 1 - addi a0, s7, 1 - call malloc - mv s8, a0 - beqz s1, .LBB9_10 -# %bb.8: # %.preheader - # in Loop: Header=BB9_4 Depth=1 - add a0, s8, s1 - mv a1, s6 - mv a2, s8 -.LBB9_9: # Parent Loop BB9_4 Depth=1 +.LBB10_2: # =>This Loop Header: Depth=1 + # Child Loop BB10_5 Depth 2 + # Child Loop BB10_11 Depth 2 + lbu a0, 3(sp) + beq a0, s5, .LBB10_4 +# %bb.3: # in Loop: Header=BB10_2 Depth=1 + bne a0, s4, .LBB10_8 +.LBB10_4: # in Loop: Header=BB10_2 Depth=1 + andi a1, a1, 1 + beqz a1, .LBB10_16 +.LBB10_5: # Parent Loop BB10_2 Depth=1 # => This Inner Loop Header: Depth=2 - lbu a3, 0(a1) - sb a3, 0(a2) - addi a2, a2, 1 + addi a1, sp, 3 + mv a0, s0 + call scanf + bne a0, s9, .LBB10_16 +# %bb.6: # in Loop: Header=BB10_5 Depth=2 + lbu a0, 3(sp) + beq a0, s5, .LBB10_5 +# %bb.7: # in Loop: Header=BB10_5 Depth=2 + beq a0, s4, .LBB10_5 +.LBB10_8: # in Loop: Header=BB10_2 Depth=1 + bne s6, s7, .LBB10_13 +# %bb.9: # in Loop: Header=BB10_2 Depth=1 + slli s8, s7, 1 + addi a0, s8, 1 + call malloc + mv s3, a0 + blez s7, .LBB10_12 +# %bb.10: # %.preheader + # in Loop: Header=BB10_2 Depth=1 + add s7, s7, s3 + mv a0, s2 + mv a1, s3 +.LBB10_11: # Parent Loop BB10_2 Depth=1 + # => This Inner Loop Header: Depth=2 + lbu a2, 0(a0) + sb a2, 0(a1) addi a1, a1, 1 - bne a2, a0, .LBB9_9 -.LBB9_10: # in Loop: Header=BB9_4 Depth=1 - mv a0, s6 + addi a0, a0, 1 + bne a1, s7, .LBB10_11 +.LBB10_12: # in Loop: Header=BB10_2 Depth=1 + mv a0, s2 call free - lbu a0, 7(sp) - mv s6, s8 - j .LBB9_3 -.LBB9_11: - li s0, 0 - j .LBB9_13 -.LBB9_12: - mv s0, s1 - mv s8, s6 -.LBB9_13: - add s0, s0, s8 - sb zero, 0(s0) - mv a0, s8 + lbu a0, 3(sp) + mv s2, s3 + mv s7, s8 + j .LBB10_14 +.LBB10_13: # in Loop: Header=BB10_2 Depth=1 + mv s3, s2 +.LBB10_14: # in Loop: Header=BB10_2 Depth=1 + addi s1, s6, 1 + add s6, s6, s3 + sb a0, 0(s6) + addi a1, sp, 3 + mv a0, s0 + call scanf + li a1, 0 + mv s6, s1 + beq a0, s9, .LBB10_2 + j .LBB10_17 +.LBB10_15: + li s1, 0 + j .LBB10_17 +.LBB10_16: + mv s1, s6 + mv s3, s2 +.LBB10_17: + add s1, s1, s3 + sb zero, 0(s1) + mv a0, s3 lw ra, 44(sp) # 4-byte Folded Reload lw s0, 40(sp) # 4-byte Folded Reload lw s1, 36(sp) # 4-byte Folded Reload @@ -293,10 +372,11 @@ getString: # @getString lw s6, 16(sp) # 4-byte Folded Reload lw s7, 12(sp) # 4-byte Folded Reload lw s8, 8(sp) # 4-byte Folded Reload + lw s9, 4(sp) # 4-byte Folded Reload addi sp, sp, 48 ret -.Lfunc_end9: - .size getString, .Lfunc_end9-getString +.Lfunc_end10: + .size getString, .Lfunc_end10-getString # -- End function .option pop .option push @@ -316,8 +396,8 @@ getInt: # @getInt lw ra, 12(sp) # 4-byte Folded Reload addi sp, sp, 16 ret -.Lfunc_end10: - .size getInt, .Lfunc_end10-getInt +.Lfunc_end11: + .size getInt, .Lfunc_end11-getInt # -- End function .option pop .option push @@ -328,8 +408,8 @@ getInt: # @getInt .builtin.AllocateClassBody: # @.builtin.AllocateClassBody # %bb.0: tail malloc -.Lfunc_end11: - .size .builtin.AllocateClassBody, .Lfunc_end11-.builtin.AllocateClassBody +.Lfunc_end12: + .size .builtin.AllocateClassBody, .Lfunc_end12-.builtin.AllocateClassBody # -- End function .option pop .option push @@ -350,8 +430,8 @@ getInt: # @getInt or a0, a0, a3 or a0, a0, a1 ret -.Lfunc_end12: - .size .builtin.GetArrayLength, .Lfunc_end12-.builtin.GetArrayLength +.Lfunc_end13: + .size .builtin.GetArrayLength, .Lfunc_end13-.builtin.GetArrayLength # -- End function .option pop .option push @@ -378,7 +458,7 @@ getInt: # @getInt srli s4, s0, 16 li a0, 1 srli s6, s0, 24 - bne s2, a0, .LBB13_2 + bne s2, a0, .LBB14_2 # %bb.1: mul a0, s0, s3 addi a0, a0, 4 @@ -388,8 +468,8 @@ getInt: # @getInt sb s4, 2(a0) sb s6, 3(a0) addi a0, a0, 4 - j .LBB13_6 -.LBB13_2: + j .LBB14_6 +.LBB14_2: mv s7, a2 slli a0, s0, 2 addi a0, a0, 4 @@ -399,14 +479,14 @@ getInt: # @getInt sb s4, 2(a0) sb s6, 3(a0) addi a0, a0, 4 - blez s0, .LBB13_6 + blez s0, .LBB14_6 # %bb.3: li s1, 0 addi s2, s2, -1 addi s5, s7, 4 mv s4, a0 mv s0, a0 -.LBB13_4: # =>This Inner Loop Header: Depth=1 +.LBB14_4: # =>This Inner Loop Header: Depth=1 mv a0, s2 mv a1, s3 mv a2, s5 @@ -415,10 +495,10 @@ getInt: # @getInt sw a0, 0(s0) addi s1, s1, 1 addi s0, s0, 4 - blt s1, a1, .LBB13_4 + blt s1, a1, .LBB14_4 # %bb.5: mv a0, s4 -.LBB13_6: +.LBB14_6: lw ra, 44(sp) # 4-byte Folded Reload lw s0, 40(sp) # 4-byte Folded Reload lw s1, 36(sp) # 4-byte Folded Reload @@ -430,8 +510,8 @@ getInt: # @getInt lw s7, 12(sp) # 4-byte Folded Reload addi sp, sp, 48 ret -.Lfunc_end13: - .size .builtin.RecursiveAllocateArray, .Lfunc_end13-.builtin.RecursiveAllocateArray +.Lfunc_end14: + .size .builtin.RecursiveAllocateArray, .Lfunc_end14-.builtin.RecursiveAllocateArray # -- End function .option pop .option push @@ -461,8 +541,8 @@ getInt: # @getInt lw s0, 8(sp) # 4-byte Folded Reload addi sp, sp, 16 ret -.Lfunc_end14: - .size .builtin.AllocateArray, .Lfunc_end14-.builtin.AllocateArray +.Lfunc_end15: + .size .builtin.AllocateArray, .Lfunc_end15-.builtin.AllocateArray # -- End function .option pop .type .L.str,@object # @.str