[commit: ghc] wip/angerman/llvmng: Use packed structs. (d91524d)

git at git.haskell.org git at git.haskell.org
Wed Feb 7 06:40:09 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/angerman/llvmng
Link       : http://ghc.haskell.org/trac/ghc/changeset/d91524debd11e5bfeecabc454e356934f1847a89/ghc

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

commit d91524debd11e5bfeecabc454e356934f1847a89
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sun Dec 3 20:28:55 2017 +0800

    Use packed structs.
    
    GHC computes offsets into structs, and we do not use getElementPointer.
    If we had used gep, we could use unpacked structs as well.


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

d91524debd11e5bfeecabc454e356934f1847a89
 compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs b/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs
index c1c9e8c..09ffd99 100644
--- a/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs
+++ b/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs
@@ -299,7 +299,7 @@ llvmCodeGen' prc@(CmmProc{}) = Right $ do
     case mb_info of
       Nothing -> EDSL.ghcdefT (pure link) lbl sig body
       Just (Statics _ statics)
-        -> do prefixData <- EDSL.struct =<< mapM genData statics
+        -> do prefixData <- EDSL.packedStruct =<< mapM genData statics
               EDSL.ghcdefT (pure $ EDSL.withPrefixData prefixData . link) lbl sig body
 
 -- llvmCodeGen' _ = panic "LlvmCodeGen': unhandled raw cmm group"
@@ -427,7 +427,7 @@ genStatics s@(Statics l statics) = do
   let link | externallyVisibleCLabel l = Val.external -- External
            | otherwise                 = Val.private  -- Internal
 
-  struct <- EDSL.struct body
+  struct <- EDSL.packedStruct body
   -- make statics mutable.
   -- E.g.
   --  x :: T



More information about the ghc-commits mailing list