History

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.

bobbl committed 16 years ago

Commit c0620c81 parent b5730721 file · +7 −7Browse files

Unified · Split

tccgen.c+7−7
@@ -2019,6 +2019,12 @@ void vstore(void) · 2018 unmodified lines
20192019 if (!nocode_wanted) {
20202020 size = type_size(&vtop->type, &align);
20212021
2022+ /* destination */
2023+ vswap();
2024+ vtop->type.t = VT_PTR;
2025+ gaddrof();
2026+
2027+ /* address of memcpy() */
20222028 #ifdef TCC_ARM_EABI
20232029 if(!(align & 7))
20242030 vpush_global_sym(&func_old_type, TOK_memcpy8);
@@ -2028,10 +2034,7 @@ void vstore(void) · 3 unmodified lines
20282034 #endif
20292035 vpush_global_sym(&func_old_type, TOK_memcpy);
20302036
2031− /* destination */
2032− vpushv(vtop - 2);
2033− vtop->type.t = VT_PTR;
2034− gaddrof();
2037+ vswap();
20352038 /* source */
20362039 vpushv(vtop - 2);
20372040 vtop->type.t = VT_PTR;
@@ -2039,9 +2042,6 @@ void vstore(void) · 1 unmodified line
20392042 /* type size */
20402043 vpushi(size);
20412044 gfunc_call(3);
2042−
2043− vswap();
2044− vpop();
20452045 } else {
20462046 vswap();
20472047 vpop();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t