mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-28 12:10:05 +08:00
optimize the generated code when save_reg is required (2)
In gfunc_call, regisger will be saved before gcall_or_jmp. The register stored the function will be saved too, though in some generator the SValue of this function will be immediately poped after gcall_or_jmp, and no need to be saved. So I modify some generator to avoid save redundant SValue before gcall_or_jmp.
This commit is contained in:
parent
b3b685d92a
commit
3f05d88d5b
@ -1187,7 +1187,7 @@ again:
|
|||||||
|
|
||||||
/* Manually free remaining registers since next parameters are loaded
|
/* Manually free remaining registers since next parameters are loaded
|
||||||
* manually, without the help of gv(int). */
|
* manually, without the help of gv(int). */
|
||||||
save_regs(nb_args);
|
save_regs(nb_args+1);
|
||||||
|
|
||||||
if(todo) {
|
if(todo) {
|
||||||
o(0xE8BD0000|todo); /* pop {todo} */
|
o(0xE8BD0000|todo); /* pop {todo} */
|
||||||
|
@ -948,7 +948,7 @@ ST_FUNC void gfunc_call(int nb_args)
|
|||||||
vswap();
|
vswap();
|
||||||
}
|
}
|
||||||
|
|
||||||
save_regs(0);
|
save_regs(1);
|
||||||
arm64_gen_bl_or_b(0);
|
arm64_gen_bl_or_b(0);
|
||||||
--vtop;
|
--vtop;
|
||||||
if (stack)
|
if (stack)
|
||||||
|
@ -475,7 +475,7 @@ ST_FUNC void gfunc_call(int nb_args)
|
|||||||
}
|
}
|
||||||
vtop--;
|
vtop--;
|
||||||
}
|
}
|
||||||
save_regs(0); /* save used temporary registers */
|
save_regs(1); /* save used temporary registers */
|
||||||
func_sym = vtop->type.ref;
|
func_sym = vtop->type.ref;
|
||||||
func_call = func_sym->f.func_call;
|
func_call = func_sym->f.func_call;
|
||||||
/* fast call case */
|
/* fast call case */
|
||||||
|
@ -903,7 +903,6 @@ void gfunc_call(int nb_args)
|
|||||||
vtop--;
|
vtop--;
|
||||||
}
|
}
|
||||||
save_regs(0);
|
save_regs(0);
|
||||||
|
|
||||||
/* Copy R10 and R11 into RCX and RDX, respectively */
|
/* Copy R10 and R11 into RCX and RDX, respectively */
|
||||||
if (nb_args > 0) {
|
if (nb_args > 0) {
|
||||||
o(0xd1894c); /* mov %r10, %rcx */
|
o(0xd1894c); /* mov %r10, %rcx */
|
||||||
|
Loading…
Reference in New Issue
Block a user