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

git at git.haskell.org git at git.haskell.org
Fri Dec 8 05:31:27 UTC 2017


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

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

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

commit 773d410caa17d3982a8270e1bf4d7ba49bedf9cc
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.


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

773d410caa17d3982a8270e1bf4d7ba49bedf9cc
 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