Skip to content

Commit e6ef414

Browse files
committed
Add TY_short handling in register allocation
- Include TY_short in global variable stack allocation logic - Include TY_short in local variable register optimization check - Ensure short types receive same treatment as int/char/bool
1 parent b715d16 commit e6ef414

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/reg-alloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ void reg_alloc(void)
432432
if (global_insn->rd->ptr_level)
433433
GLOBAL_FUNC->stack_size += PTR_SIZE;
434434
else if (global_insn->rd->type != TY_int &&
435+
global_insn->rd->type != TY_short &&
435436
global_insn->rd->type != TY_char &&
436437
global_insn->rd->type != TY_bool) {
437438
GLOBAL_FUNC->stack_size +=
@@ -585,6 +586,7 @@ void reg_alloc(void)
585586
case OP_allocat:
586587
if ((insn->rd->type == TY_void ||
587588
insn->rd->type == TY_int ||
589+
insn->rd->type == TY_short ||
588590
insn->rd->type == TY_char ||
589591
insn->rd->type == TY_bool) &&
590592
insn->rd->array_size == 0)

0 commit comments

Comments
 (0)