Reduced the size of the cycles accumulate code.
This commit is contained in:
@@ -47,17 +47,17 @@ void codegen_accumulate(int acc_reg, int delta)
|
|||||||
|
|
||||||
void codegen_accumulate_flush(void)
|
void codegen_accumulate_flush(void)
|
||||||
{
|
{
|
||||||
|
intptr_t rip;
|
||||||
|
|
||||||
if (acc_regs[0].count) {
|
if (acc_regs[0].count) {
|
||||||
addbyte(0x55); /*push rbp*/
|
/* To reduce the size of the generated code, we take advantage of
|
||||||
addbyte(0x48); /*mov rbp,val*/
|
the fact that the target offset points to _cycles within cpu_state,
|
||||||
addbyte(0xbd);
|
so we can just use our existing infrastracture for variables
|
||||||
addlong((uint32_t) (acc_regs[0].dest_reg & 0xffffffffULL));
|
relative to cpu_state. */
|
||||||
addlong((uint32_t) (acc_regs[0].dest_reg >> 32ULL));
|
addbyte(0x81); /*ADDL $acc_regs[0].count,(_cycles)*/
|
||||||
addbyte(0x81); /* add d,[rbp][0],val */
|
addbyte(0x45);
|
||||||
addbyte(0x45);
|
addbyte((uint8_t)cpu_state_offset(_cycles));
|
||||||
addbyte(0x00);
|
|
||||||
addlong(acc_regs[0].count);
|
addlong(acc_regs[0].count);
|
||||||
addbyte(0x5d); /*pop rbp*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_regs[0].count = 0;
|
acc_regs[0].count = 0;
|
||||||
|
@@ -45,9 +45,13 @@ void codegen_accumulate(int acc_reg, int delta)
|
|||||||
void codegen_accumulate_flush(void)
|
void codegen_accumulate_flush(void)
|
||||||
{
|
{
|
||||||
if (acc_regs[0].count) {
|
if (acc_regs[0].count) {
|
||||||
addbyte(0x81); /*ADD $acc_regs[0].count,acc_regs[0].dest*/
|
/* To reduce the size of the generated code, we take advantage of
|
||||||
addbyte(0x05);
|
the fact that the target offset points to _cycles within cpu_state,
|
||||||
addlong((uint32_t) acc_regs[0].dest_reg);
|
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);
|
addlong(acc_regs[0].count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user