mirror of
https://github.com/mirror/tinycc.git
synced 2025-04-01 12:30:08 +08:00
avoid needless register save when storing structures
When storing structs with a memcpy call in vstore(), so far a needless entry remaining on the vstack sometimes resulted in an useless store generated by save_regs() in gfunc_call() for the memcpy routine.
This commit is contained in:
parent
b573072300
commit
c0620c8a00
14
tccgen.c
14
tccgen.c
@ -2019,6 +2019,12 @@ void vstore(void)
|
|||||||
if (!nocode_wanted) {
|
if (!nocode_wanted) {
|
||||||
size = type_size(&vtop->type, &align);
|
size = type_size(&vtop->type, &align);
|
||||||
|
|
||||||
|
/* destination */
|
||||||
|
vswap();
|
||||||
|
vtop->type.t = VT_PTR;
|
||||||
|
gaddrof();
|
||||||
|
|
||||||
|
/* address of memcpy() */
|
||||||
#ifdef TCC_ARM_EABI
|
#ifdef TCC_ARM_EABI
|
||||||
if(!(align & 7))
|
if(!(align & 7))
|
||||||
vpush_global_sym(&func_old_type, TOK_memcpy8);
|
vpush_global_sym(&func_old_type, TOK_memcpy8);
|
||||||
@ -2028,10 +2034,7 @@ void vstore(void)
|
|||||||
#endif
|
#endif
|
||||||
vpush_global_sym(&func_old_type, TOK_memcpy);
|
vpush_global_sym(&func_old_type, TOK_memcpy);
|
||||||
|
|
||||||
/* destination */
|
vswap();
|
||||||
vpushv(vtop - 2);
|
|
||||||
vtop->type.t = VT_PTR;
|
|
||||||
gaddrof();
|
|
||||||
/* source */
|
/* source */
|
||||||
vpushv(vtop - 2);
|
vpushv(vtop - 2);
|
||||||
vtop->type.t = VT_PTR;
|
vtop->type.t = VT_PTR;
|
||||||
@ -2039,9 +2042,6 @@ void vstore(void)
|
|||||||
/* type size */
|
/* type size */
|
||||||
vpushi(size);
|
vpushi(size);
|
||||||
gfunc_call(3);
|
gfunc_call(3);
|
||||||
|
|
||||||
vswap();
|
|
||||||
vpop();
|
|
||||||
} else {
|
} else {
|
||||||
vswap();
|
vswap();
|
||||||
vpop();
|
vpop();
|
||||||
|
Loading…
Reference in New Issue
Block a user