From 8b73c5fe2ba9503c0a2749f37c8691bd05839418 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Mon, 16 Mar 2015 14:13:44 -0400 Subject: [PATCH] reorder stmt: CALLF before reg: CALLF so floating point cleanup code will be preferred, when needed. --- src/x86.md | 7 +++++-- src/x86linux.md | 11 ++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/x86.md b/src/x86.md index 422a7438..2999d420 100755 --- a/src/x86.md +++ b/src/x86.md @@ -576,11 +576,14 @@ reg: CALLI4(addrj) "call %0\nadd esp,%a\n" reg: CALLU4(addrj) "call %0\nadd esp,%a\n" reg: CALLP4(addrj) "call %0\nadd esp,%a\n" stmt: CALLV(addrj) "call %0\nadd esp,%a\n" -reg: CALLF4(addrj) "call %0\nadd esp,%a\n" -reg: CALLF8(addrj) "call %0\nadd esp,%a\n" + stmt: CALLF4(addrj) "call %0\nadd esp,%a\nfstp\n" stmt: CALLF8(addrj) "call %0\nadd esp,%a\nfstp\n" +reg: CALLF4(addrj) "call %0\nadd esp,%a\n" +reg: CALLF8(addrj) "call %0\nadd esp,%a\n" + + stmt: RETI4(reg) "# ret\n" stmt: RETU4(reg) "# ret\n" stmt: RETP4(reg) "# ret\n" diff --git a/src/x86linux.md b/src/x86linux.md index 5546362f..5b448601 100755 --- a/src/x86linux.md +++ b/src/x86linux.md @@ -664,17 +664,18 @@ stmt: CALLV(addrj) "call %0\naddl $%a-4,%%esp\n" hasargs(a) + !isstruct(f stmt: CALLV(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) + isstruct(freturn(a->syms[1]->type)) stmt: CALLV(addrj) "call %0\n" 1 -freg: CALLF4(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) -freg: CALLF4(addrj) "call %0\n" 1 - stmt: CALLF4(addrj) "call %0\naddl $%a,%%esp\nfstp %%st(0)\n" hasargs(a) stmt: CALLF4(addrj) "call %0\nfstp %%st(0)\n" 1 +stmt: CALLF8(addrj) "call %0\naddl $%a,%%esp\nfstp %%st(0)\n" hasargs(a) +stmt: CALLF8(addrj) "call %0\nfstp %%st(0)\n" 1 + +freg: CALLF4(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) +freg: CALLF4(addrj) "call %0\n" 1 + freg: CALLF8(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) freg: CALLF8(addrj) "call %0\n" 1 -stmt: CALLF8(addrj) "call %0\naddl $%a,%%esp\nfstp %%st(0)\n" hasargs(a) -stmt: CALLF8(addrj) "call %0\nfstp %%st(0)\n" 1 stmt: RETI4(reg) "# ret\n" stmt: RETU4(reg) "# ret\n"