History

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.

Pursuer committed 7 years ago

Commit 3f05d881 parent b3b685d4 files · +3 −4Browse files

Unified · Split

4 files
  1. arm-gen.c +1 −1
  2. arm64-gen.c +1 −1
  3. i386-gen.c +1 −1
  4. x86_64-gen.c +0 −1
arm-gen.c+1−1
@@ -1187,7 +1187,7 @@ again: · 1186 unmodified lines
11871187
11881188 /* Manually free remaining registers since next parameters are loaded
11891189 * manually, without the help of gv(int). */
1190− save_regs(nb_args);
1190+ save_regs(nb_args+1);
11911191
11921192 if(todo) {
11931193 o(0xE8BD0000|todo); /* pop {todo} */
arm64-gen.c+1−1
@@ -948,7 +948,7 @@ ST_FUNC void gfunc_call(int nb_args) · 947 unmodified lines
948948 vswap();
949949 }
950950
951− save_regs(0);
951+ save_regs(1);
952952 arm64_gen_bl_or_b(0);
953953 --vtop;
954954 if (stack)
i386-gen.c+1−1
@@ -475,7 +475,7 @@ ST_FUNC void gfunc_call(int nb_args) · 474 unmodified lines
475475 }
476476 vtop--;
477477 }
478− save_regs(0); /* save used temporary registers */
478+ save_regs(1); /* save used temporary registers */
479479 func_sym = vtop->type.ref;
480480 func_call = func_sym->f.func_call;
481481 /* fast call case */
x86_64-gen.c+0−1
@@ -903,7 +903,6 @@ void gfunc_call(int nb_args) · 902 unmodified lines
903903 vtop--;
904904 }
905905 save_regs(0);
906−
907906 /* Copy R10 and R11 into RCX and RDX, respectively */
908907 if (nb_args > 0) {
909908 o(0xd1894c); /* mov %r10, %rcx */

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