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

git at git.haskell.org git at git.haskell.org
Fri Dec 8 05:22:30 UTC 2017


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

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

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

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


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

ce8c529a89565d37ff7364552ae6311371eac745
 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