From 085a9ce77c7c1b42941af23b2f41c910a4a35720 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 31 Oct 2005 11:17:53 +0000 Subject: [PATCH] [project @ 2005-10-31 11:17:53 by simonmar] x86_64: catch and fix one kind of crappy code generated by gcc # movq -4(%rbp), %rax # jmp *%rax ==> # jmp *-4(%rbp) --- ghc/driver/mangler/ghc-asm.lprl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index 8a66422..63b753f 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -1430,12 +1430,24 @@ sub hppa_mash_prologue { # OK, epilogue, too sub print_doctored { local($_, $need_fallthru_patch) = @_; + if ( $TargetPlatform =~ /^x86_64-/ ) { + # Catch things like + # + # movq -4(%ebp), %rax + # jmp *%rax + # + # and optimise: + # + s/^\tmovq\s+(-?\d*\(\%r(bx|bp)\)),\s*(\%r(ax|cx|dx|10|11))\n\tjmp\s+\*\3/\tjmp\t\*$1/g; + } + if ( $TargetPlatform !~ /^i386-/ || ! /^\t[a-z]/ # no instructions in here, apparently || /^${T_US}__stginit_[A-Za-z0-9_]+${T_POST_LBL}/) { print OUTASM $_; return; } + # OK, must do some x86 **HACKING** local($entry_patch) = ''; -- 1.7.10.4