From 902e0fbfc54a6ef4dcec480a7902263709251970 Mon Sep 17 00:00:00 2001 From: Yu-En Hsiao Date: Sun, 24 Nov 2024 09:18:04 +0800 Subject: [PATCH] rename local variable --- src/arm-codegen.c | 20 ++++++++++---------- src/riscv-codegen.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/arm-codegen.c b/src/arm-codegen.c index 2200147..808eb6e 100644 --- a/src/arm-codegen.c +++ b/src/arm-codegen.c @@ -198,7 +198,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) * 1. division and modulo. * 2. load and store operations. */ - arm_reg helper_reg; + arm_reg interm; switch (ph2_ir->op) { case OP_define: @@ -239,25 +239,25 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) return; case OP_load: case OP_global_load: - helper_reg = ph2_ir->op == OP_load ? __sp : __r12; + interm = ph2_ir->op == OP_load ? __sp : __r12; if (ph2_ir->src0 > 4095) { emit(__movw(__AL, __r8, ph2_ir->src0)); emit(__movt(__AL, __r8, ph2_ir->src0)); - emit(__add_r(__AL, __r8, helper_reg, __r8)); + emit(__add_r(__AL, __r8, interm, __r8)); emit(__lw(__AL, rd, __r8, 0)); } else - emit(__lw(__AL, rd, helper_reg, ph2_ir->src0)); + emit(__lw(__AL, rd, interm, ph2_ir->src0)); return; case OP_store: case OP_global_store: - helper_reg = ph2_ir->op == OP_store ? __sp : __r12; + interm = ph2_ir->op == OP_store ? __sp : __r12; if (ph2_ir->src1 > 4095) { emit(__movw(__AL, __r8, ph2_ir->src1)); emit(__movt(__AL, __r8, ph2_ir->src1)); - emit(__add_r(__AL, __r8, helper_reg, __r8)); + emit(__add_r(__AL, __r8, interm, __r8)); emit(__sw(__AL, rn, __r8, 0)); } else - emit(__sw(__AL, rn, helper_reg, ph2_ir->src1)); + emit(__sw(__AL, rn, interm, ph2_ir->src1)); return; case OP_read: if (ph2_ir->src1 == 1) @@ -339,7 +339,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) } return; } - helper_reg = __r8; + interm = __r8; /* div/mod emulation */ /* Preserve the values of the dividend and divisor */ emit(__stmdb(__AL, 1, __sp, (1 << rn) | (1 << rm))); @@ -357,7 +357,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) * in __r9. The sign of the divisor is irrelevant for determining * the result's sign. */ - helper_reg = __r9; + interm = __r9; emit(__mov_r(__AL, __r10, __r8)); } /* Unsigned integer division */ @@ -388,7 +388,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) */ emit(__mov_r(__AL, __r9, rn)); emit(__ldm(__AL, 1, __sp, (1 << rn) | (1 << rm))); - emit(__mov_r(__AL, rd, helper_reg)); + emit(__mov_r(__AL, rd, interm)); /* Handle the correct sign for the quotient or remainder */ emit(__cmp_i(__AL, __r10, 0)); emit(__rsb_i(__NE, rd, 0, rd)); diff --git a/src/riscv-codegen.c b/src/riscv-codegen.c index b0fa0c7..ad3db9f 100644 --- a/src/riscv-codegen.c +++ b/src/riscv-codegen.c @@ -162,7 +162,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) * 1. division and modulo. * 2. load and store operations. */ - rv_reg helper_reg, divisor_mask = __t1; + rv_reg interm, divisor_mask = __t1; switch (ph2_ir->op) { case OP_define: @@ -200,25 +200,25 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) return; case OP_load: case OP_global_load: - helper_reg = ph2_ir->op == OP_load ? __sp : __gp; + interm = ph2_ir->op == OP_load ? __sp : __gp; if (ph2_ir->src0 < -2048 || ph2_ir->src0 > 2047) { emit(__lui(__t0, rv_hi(ph2_ir->src0))); emit(__addi(__t0, __t0, rv_lo(ph2_ir->src0))); - emit(__add(__t0, helper_reg, __t0)); + emit(__add(__t0, interm, __t0)); emit(__lw(rd, __t0, 0)); } else - emit(__lw(rd, helper_reg, ph2_ir->src0)); + emit(__lw(rd, interm, ph2_ir->src0)); return; case OP_store: case OP_global_store: - helper_reg = ph2_ir->op == OP_store ? __sp : __gp; + interm = ph2_ir->op == OP_store ? __sp : __gp; if (ph2_ir->src1 < -2048 || ph2_ir->src1 > 2047) { emit(__lui(__t0, rv_hi(ph2_ir->src1))); emit(__addi(__t0, __t0, rv_lo(ph2_ir->src1))); - emit(__add(__t0, helper_reg, __t0)); + emit(__add(__t0, interm, __t0)); emit(__sw(rs1, __t0, 0)); } else - emit(__sw(rs1, helper_reg, ph2_ir->src1)); + emit(__sw(rs1, interm, ph2_ir->src1)); return; case OP_read: if (ph2_ir->src1 == 1) @@ -313,14 +313,14 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) emit(__mod(rd, rs1, rs2)); return; } - helper_reg = __t0; + interm = __t0; /* div/mod emulation */ if (ph2_ir->op == OP_mod) { /* If the requested operation is modulo, the result will be stored * in __t2. The sign of the divisor is irrelevant for determining * the result's sign. */ - helper_reg = __t2; + interm = __t2; divisor_mask = __zero; } /* Obtain absolute values of the dividend and divisor */ @@ -348,7 +348,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir) emit(__srli(__t1, __t1, 1)); emit(__srli(__t3, __t3, 1)); emit(__bne(__t1, __zero, -20)); - emit(__addi(rd, helper_reg, 0)); + emit(__addi(rd, interm, 0)); /* Handle the correct sign for the quotient or remainder */ emit(__beq(__t5, __zero, 8)); emit(__sub(rd, __zero, rd));