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

git at git.haskell.org git at git.haskell.org
Mon Dec 4 02:42:50 UTC 2017


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

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

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

commit 9d5a74227153da84c9c06f72e8c746dd3e89c9e5
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.


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

9d5a74227153da84c9c06f72e8c746dd3e89c9e5
 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 fd439b0..0f02df2 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