commit 68110be23b512b45ad9c4e9192070b123625e03a
parent 0f2e0aed1d90bfad71800710bed44fc3943bc36a
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Thu, 3 Feb 2022 14:09:58 -0600
ir: pull variable into scope where it's used
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ir.c b/ir.c
@@ -163,7 +163,7 @@ static int
genexpr(struct iproc *const out, const size_t expri, uint64_t *const val)
{
struct expr *expr = &exprs.data[expri];
- uint64_t temp2 = 0;
+
switch (expr->kind) {
case EXPR_LIT:
switch (expr->class) {
@@ -181,14 +181,14 @@ genexpr(struct iproc *const out, const size_t expri, uint64_t *const val)
die("genexpr: EXPR_IDENT: decl is null");
struct type *type = &types.data[decl->type];
if (decl->toplevel) {
- temp2 = immediate(out, PTRSIZE, decl->w.addr);
+ uint64_t addr = immediate(out, PTRSIZE, decl->w.addr);
switch (type->size) {
case 1:
case 2:
case 4:
case 8:
- *val = load(out, type->size, temp2);
+ *val = load(out, type->size, addr);
break;
default:
die("genexpr: unknown size");