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
2019 if (!nocode_wanted) {2019 if (!nocode_wanted) {
2020 size = type_size(&vtop->type, &align);2020 size = type_size(&vtop->type, &align);
2021 2021
2022 /* destination */
2023 vswap();
2024 vtop->type.t = VT_PTR;
2025 gaddrof();
2026
2027 /* address of memcpy() */
2022#ifdef TCC_ARM_EABI2028#ifdef TCC_ARM_EABI
2023 if(!(align & 7))2029 if(!(align & 7))
2024 vpush_global_sym(&func_old_type, TOK_memcpy8);2030 vpush_global_sym(&func_old_type, TOK_memcpy8);
@@ -2028,10 +2034,7 @@ void vstore(void) · 3 unmodified lines
2028#endif2034#endif
2029 vpush_global_sym(&func_old_type, TOK_memcpy);2035 vpush_global_sym(&func_old_type, TOK_memcpy);
2030 2036
2031 /* destination */2037 vswap();
2032 vpushv(vtop - 2);
2033 vtop->type.t = VT_PTR;
2034 gaddrof();
2035 /* source */2038 /* source */
2036 vpushv(vtop - 2);2039 vpushv(vtop - 2);
2037 vtop->type.t = VT_PTR;2040 vtop->type.t = VT_PTR;
@@ -2039,9 +2042,6 @@ void vstore(void) · 1 unmodified line
2039 /* type size */2042 /* type size */
2040 vpushi(size);2043 vpushi(size);
2041 gfunc_call(3);2044 gfunc_call(3);
2042
2043 vswap();
2044 vpop();
2045 } else {2045 } else {
2046 vswap();2046 vswap();
2047 vpop();2047 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