History

i386: We can change 'lea 0(%ebp),r' to 'mov %ebp,r'

Because that mov is 1 byte shorter, look: int *func() { return __builtin_frame_address(0); } before patch: 00000000 <func>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 81 ec 00 00 00 00 sub $0x0,%esp 9: 8d 45 00 lea 0x0(%ebp),%eax // <- here c: e9 00 00 00 00 jmp 11 <func+0x11> 11: c9 leave 12: c3 ret after patch: 00000000 <func>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 81 ec 00 00 00 00 sub $0x0,%esp 9: 89 e8 mov %ebp,%eax // <- here b: e9 00 00 00 00 jmp 10 <func+0x10> 10: c9 leave 11: c3 ret

Kirill Smelkov committed 14 years ago

Commit ab24aae1 parent b2a02961 file · +7 −2Browse files

Unified · Split

i386-gen.c+7−2
@@ -260,8 +260,13 @@ ST_FUNC void load(int r, SValue *sv) · 259 unmodified lines
260 o(0xb8 + r); /* mov $xx, r */260 o(0xb8 + r); /* mov $xx, r */
261 gen_addr32(fr, sv->sym, fc);261 gen_addr32(fr, sv->sym, fc);
262 } else if (v == VT_LOCAL) {262 } else if (v == VT_LOCAL) {
263 o(0x8d); /* lea xxx(%ebp), r */263 if (fc) {
264 gen_modrm(r, VT_LOCAL, sv->sym, fc);264 o(0x8d); /* lea xxx(%ebp), r */
265 gen_modrm(r, VT_LOCAL, sv->sym, fc);
266 } else {
267 o(0x89);
268 o(0xe8 + r); /* mov %ebp, r */
269 }
265 } else if (v == VT_CMP) {270 } else if (v == VT_CMP) {
266 oad(0xb8 + r, 0); /* mov $0, r */271 oad(0xb8 + r, 0); /* mov $0, r */
267 o(0x0f); /* setxx %br */272 o(0x0f); /* setxx %br */

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