diff options
author | Cheng Shao <astrohavoc@gmail.com> | 2022-10-04 17:36:29 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-10-11 12:51:19 -0400 |
commit | dce9f320ce7275fa97f49abef604abbc3b0f9a9c (patch) | |
tree | 29ab6497c80f83915e62330beca4ce45cf5d9fa9 | |
parent | 7f0decd5063a853fc8f38a8944b2c91995cd5e48 (diff) | |
download | haskell-dce9f320ce7275fa97f49abef604abbc3b0f9a9c.tar.gz |
CLabel: fix isInfoTableLabel
isInfoTableLabel does not take Cmm info table into account. This patch is required for data section layout of wasm32 NCG to work.
-rw-r--r-- | compiler/GHC/Cmm/CLabel.hs | 7 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/AArch64/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Ppr.hs | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs index cf004d02cb..5f2b0eca59 100644 --- a/compiler/GHC/Cmm/CLabel.hs +++ b/compiler/GHC/Cmm/CLabel.hs @@ -108,6 +108,7 @@ module GHC.Cmm.CLabel ( isLocalCLabel, mayRedirectTo, isInfoTableLabel, + isCmmInfoTableLabel, isConInfoTableLabel, isIdLabel, isTickyLabel, @@ -794,8 +795,14 @@ isInfoTableLabel (IdLabel _ _ InfoTable) = True isInfoTableLabel (IdLabel _ _ LocalInfoTable) = True isInfoTableLabel (IdLabel _ _ ConInfoTable {}) = True isInfoTableLabel (IdLabel _ _ BlockInfoTable) = True +isInfoTableLabel (CmmLabel _ _ _ CmmInfo) = True isInfoTableLabel _ = False +-- | Whether label points to an info table defined in Cmm +isCmmInfoTableLabel :: CLabel -> Bool +isCmmInfoTableLabel (CmmLabel _ _ _ CmmInfo) = True +isCmmInfoTableLabel _ = False + -- | Whether label is points to constructor info table isConInfoTableLabel :: CLabel -> Bool isConInfoTableLabel (IdLabel _ _ ConInfoTable {}) = True diff --git a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs index b178608326..5ca443f08e 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs @@ -195,7 +195,7 @@ pprLabelType' platform lbl = text "@object" where functionOkInfoTable = platformTablesNextToCode platform && - isInfoTableLabel lbl && not (isConInfoTableLabel lbl) + isInfoTableLabel lbl && not (isCmmInfoTableLabel lbl) && not (isConInfoTableLabel lbl) -- this is called pprTypeAndSizeDecl in PPC.Ppr pprTypeDecl :: Platform -> CLabel -> SDoc diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs index cad3ab7163..0b19665857 100644 --- a/compiler/GHC/CmmToAsm/X86/Ppr.hs +++ b/compiler/GHC/CmmToAsm/X86/Ppr.hs @@ -254,7 +254,7 @@ pprLabelType' platform lbl = but mess up with the relocation. https://phabricator.haskell.org/D4730 -} functionOkInfoTable = platformTablesNextToCode platform && - isInfoTableLabel lbl && not (isConInfoTableLabel lbl) + isInfoTableLabel lbl && not (isCmmInfoTableLabel lbl) && not (isConInfoTableLabel lbl) pprTypeDecl :: Platform -> CLabel -> SDoc |