Reduced the size of the cycles accumulate code.

This commit is contained in:
OBattler
2022-10-17 04:13:19 +02:00
parent 6311f4bdc5
commit 96ec40d794
2 changed files with 16 additions and 12 deletions

View File

@@ -45,9 +45,13 @@ void codegen_accumulate(int acc_reg, int delta)
void codegen_accumulate_flush(void)
{
if (acc_regs[0].count) {
addbyte(0x81); /*ADD $acc_regs[0].count,acc_regs[0].dest*/
addbyte(0x05);
addlong((uint32_t) acc_regs[0].dest_reg);
/* To reduce the size of the generated code, we take advantage of
the fact that the target offset points to _cycles within cpu_state,
so we can just use our existing infrastracture for variables
relative to cpu_state. */
addbyte(0x81); /*MOVL $acc_regs[0].count,(_cycles)*/
addbyte(0x45);
addbyte((uint8_t)cpu_state_offset(_cycles));
addlong(acc_regs[0].count);
}