Add constant folding rulues for ADDR

This commit is contained in:
Dmitry Stogov 2022-12-05 16:44:10 +03:00
parent 9a9c6f2aaf
commit 9dda4e7553

View File

@ -278,6 +278,7 @@ IR_FOLD(ADD(C_U8, C_U8))
IR_FOLD(ADD(C_U16, C_U16))
IR_FOLD(ADD(C_U32, C_U32))
IR_FOLD(ADD(C_U64, C_U64))
IR_FOLD(ADD(C_ADDR, C_ADDR))
{
IR_ASSERT(IR_OPT_TYPE(opt) == op1_insn->type);
IR_FOLD_CONST_U(op1_insn->val.u64 + op2_insn->val.u64);
@ -308,6 +309,7 @@ IR_FOLD(SUB(C_U8, C_U8))
IR_FOLD(SUB(C_U16, C_U16))
IR_FOLD(SUB(C_U32, C_U32))
IR_FOLD(SUB(C_U64, C_U64))
IR_FOLD(SUB(C_ADDR, C_ADDR))
{
IR_ASSERT(IR_OPT_TYPE(opt) == op1_insn->type);
IR_FOLD_CONST_U(op1_insn->val.u64 - op2_insn->val.u64);