aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobbl <bobbl@gmx.de>2009-11-30 19:33:44 +0100
committergrischka <grischka>2009-12-01 17:59:30 +0100
commitc0620c8a00f760765da802dc11e4863193e357e8 (patch)
tree017f9a3cb68f4399044d485a74f506abcaead5a5
parentb573072300e4d49dbd6fa883859e8dcaee594557 (diff)
downloadtinycc-c0620c8a00f760765da802dc11e4863193e357e8.tar.gz
tinycc-c0620c8a00f760765da802dc11e4863193e357e8.tar.bz2
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.
-rw-r--r--tccgen.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tccgen.c b/tccgen.c
index 78a5161..38b0912 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2019,6 +2019,12 @@ void vstore(void)
if (!nocode_wanted) {
size = type_size(&vtop->type, &align);
+ /* destination */
+ vswap();
+ vtop->type.t = VT_PTR;
+ gaddrof();
+
+ /* address of memcpy() */
#ifdef TCC_ARM_EABI
if(!(align & 7))
vpush_global_sym(&func_old_type, TOK_memcpy8);
@@ -2028,10 +2034,7 @@ void vstore(void)
#endif
vpush_global_sym(&func_old_type, TOK_memcpy);
- /* destination */
- vpushv(vtop - 2);
- vtop->type.t = VT_PTR;
- gaddrof();
+ vswap();
/* source */
vpushv(vtop - 2);
vtop->type.t = VT_PTR;
@@ -2039,9 +2042,6 @@ void vstore(void)
/* type size */
vpushi(size);
gfunc_call(3);
-
- vswap();
- vpop();
} else {
vswap();
vpop();