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
1187 1187
1188 /* Manually free remaining registers since next parameters are loaded1188 /* Manually free remaining registers since next parameters are loaded
1189 * manually, without the help of gv(int). */1189 * manually, without the help of gv(int). */
1190 save_regs(nb_args);1190 save_regs(nb_args+1);
1191 1191
1192 if(todo) {1192 if(todo) {
1193 o(0xE8BD0000|todo); /* pop {todo} */1193 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
948 vswap();948 vswap();
949 }949 }
950 950
951 save_regs(0);951 save_regs(1);
952 arm64_gen_bl_or_b(0);952 arm64_gen_bl_or_b(0);
953 --vtop;953 --vtop;
954 if (stack)954 if (stack)
i386-gen.c+1−1
@@ -475,7 +475,7 @@ ST_FUNC void gfunc_call(int nb_args) · 474 unmodified lines
475 }475 }
476 vtop--;476 vtop--;
477 }477 }
478 save_regs(0); /* save used temporary registers */478 save_regs(1); /* save used temporary registers */
479 func_sym = vtop->type.ref;479 func_sym = vtop->type.ref;
480 func_call = func_sym->f.func_call;480 func_call = func_sym->f.func_call;
481 /* fast call case */481 /* fast call case */
x86_64-gen.c+0−1
@@ -903,7 +903,6 @@ void gfunc_call(int nb_args) · 902 unmodified lines
903 vtop--;903 vtop--;
904 }904 }
905 save_regs(0);905 save_regs(0);
906
907 /* Copy R10 and R11 into RCX and RDX, respectively */906 /* Copy R10 and R11 into RCX and RDX, respectively */
908 if (nb_args > 0) {907 if (nb_args > 0) {
909 o(0xd1894c); /* mov %r10, %rcx */908 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