From 3c7db0d06bee69140a6898ab78c84952ea73a4f7 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 1 Feb 2005 15:55:00 +0000 Subject: [project @ 2005-02-01 15:55:00 by simonmar] Generate some sensible code when presented with the output from gcc -O2 --- ghc/driver/mangler/ghc-asm.lprl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ghc') diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index 06446e49a0..e616a6cf72 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -146,7 +146,7 @@ sub init_TARGET_STUFF { $T_X86_PRE_LLBL = 'L'; $T_X86_BADJMP = '^\tjmp [^L\*]'; - $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,0x90)?|\.globl\s+\S+|\.text|\.data|\.stab[^n].*|\.type\s+.*|\.size\s+.*|\.lcomm.*)\n)'; + $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s.*|\.globl\s+\S+|\.text|\.data|\.stab[^n].*|\.type\s+.*|\.size\s+.*|\.lcomm.*)\n)'; $T_COPY_DIRVS = '\.(globl|stab|lcomm)'; $T_DOT_WORD = '\.(long|word|value|byte|space)'; $T_DOT_GLOBAL = '\.globl'; @@ -172,7 +172,7 @@ sub init_TARGET_STUFF { $T_X86_PRE_LLBL = '.L'; $T_X86_BADJMP = '^\tjmp\s+[^\.\*]'; - $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,\s*0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.size\s+\S+\s*,\s*\d+|\.ident.*|\.local.*)\n)'; + $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s.*|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.size\s+\S+\s*,\s*\d+|\.ident.*|\.local.*)\n)'; $T_COPY_DIRVS = '^\s*\.(globl|type|size|local)'; $T_DOT_WORD = '\.(long|value|word|byte|zero)'; @@ -1362,8 +1362,16 @@ sub print_doctored { # movl $_blah, # jmp * # + s/^\tmovl\s+\$${T_US}(.*),\s*(\%e[acd]x)\n\tjmp\s+\*\2/\tjmp $T_US$1/g; - s/^\tmovl\s+\$${T_US}(.*),\s*(\%e[abcd]x)\n\tjmp\s+\*\2/\tjmp $T_US$1/g; + # Catch things like + # + # movl -4(%ebx), %eax + # jmp *%eax + # + # and optimise: + # + s/^\tmovl\s+(-?\d*\(\%e(bx|si)\)),\s*(\%e[acd]x)\n\tjmp\s+\*\3/\tjmp\t\*$1/g; if ($StolenX86Regs <= 2 ) { # YURGH! spurious uses of esi? s/^\tmovl\s+(.*),\s*\%esi\n\tjmp\s+\*%esi\n/\tmovl $1,\%eax\n\tjmp \*\%eax\n/g; -- cgit v1.2.1