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

git at git.haskell.org git at git.haskell.org
Tue Jan 9 02:40:13 UTC 2018


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

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

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

commit b4fbdb70048e9e3cd93c78939ffdf297e69f79ae
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.


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

b4fbdb70048e9e3cd93c78939ffdf297e69f79ae
 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