[commit: ghc] master: No need to map over all blocks, setting up PIC. (52efb2c)

Gabor Greif ggreif at gmail.com
Sat Apr 13 00:14:51 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/52efb2c8aefbd448e765e62a34c3e53ab7202a11

>---------------------------------------------------------------

commit 52efb2c8aefbd448e765e62a34c3e53ab7202a11
Author: Gabor Greif <ggreif at gmail.com>
Date:   Fri Apr 12 00:20:55 2013 +0200

    No need to map over all blocks, setting up PIC.
    
    Darwin x86 has inconsistent PIC base register, so splitting (which happened before)
    ensures that each cmm procedure only has one entry point (namely the first block).

>---------------------------------------------------------------

 compiler/nativeGen/PIC.hs | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs
index 5fff8cb..e46a823 100644
--- a/compiler/nativeGen/PIC.hs
+++ b/compiler/nativeGen/PIC.hs
@@ -771,19 +771,11 @@ initializePicBase_x86 ArchX86 os picReg
              BasicBlock bID (X86.FETCHGOT picReg : insns)
 
 initializePicBase_x86 ArchX86 OSDarwin picReg
-        (CmmProc info lab live (ListGraph blocks) : statics)
-        = return (CmmProc info lab live (ListGraph blocks') : statics)
-
-    where blocks' = case blocks of
-                     [] -> []
-                     (b:bs) -> fetchPC b : map maybeFetchPC bs
-
-          maybeFetchPC b@(BasicBlock bID _)
-            | bID `mapMember` info = fetchPC b
-            | otherwise            = b
+        (CmmProc info lab live (ListGraph (entry:blocks)) : statics)
+        = return (CmmProc info lab live (ListGraph (block':blocks)) : statics)
 
-          fetchPC (BasicBlock bID insns) =
-             BasicBlock bID (X86.FETCHPC picReg : insns)
+    where BasicBlock bID insns = entry
+          block' = BasicBlock bID (X86.FETCHPC picReg : insns)
 
 initializePicBase_x86 _ _ _ _
         = panic "initializePicBase_x86: not needed"





More information about the ghc-commits mailing list