[Git][ghc/ghc][master] compiler: remove unused OtherSection logic
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 9a9c2f03 by Cheng Shao at 2025-12-18T13:24:39-05:00 compiler: remove unused OtherSection logic This patch removes the OtherSection logic in Cmm, given it's never actually used by any of our backends. - - - - - 9 changed files: - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/Parser.y - compiler/GHC/CmmToAsm/AArch64/Ppr.hs - compiler/GHC/CmmToAsm/LA64/Ppr.hs - compiler/GHC/CmmToAsm/PPC/Ppr.hs - compiler/GHC/CmmToAsm/Ppr.hs - compiler/GHC/CmmToAsm/RV64/Ppr.hs - compiler/GHC/CmmToAsm/X86/Ppr.hs - compiler/GHC/CmmToLlvm/Data.hs Changes: ===================================== compiler/GHC/Cmm.hs ===================================== @@ -269,7 +269,6 @@ data SectionType | FiniArray -- .fini_array on ELF, .dtor on Windows | CString | IPE - | OtherSection String deriving (Show) data SectionProtection @@ -290,7 +289,6 @@ sectionProtection (Section t _) = case t of Data -> ReadWriteSection UninitialisedData -> ReadWriteSection IPE -> ReadWriteSection - (OtherSection _) -> ReadWriteSection {- Note [Relocatable Read-Only Data] @@ -550,4 +548,3 @@ pprSectionType s = doubleQuotes $ case s of FiniArray -> text "finiarray" CString -> text "cstring" IPE -> text "ipe" - OtherSection s' -> text s' ===================================== compiler/GHC/Cmm/Parser.y ===================================== @@ -978,7 +978,7 @@ section "data" = Data section "rodata" = ReadOnlyData section "relrodata" = RelocatableReadOnlyData section "bss" = UninitialisedData -section s = OtherSection s +section s = panic ("CmmParse: unknown section type: " ++ s) mkString :: String -> CmmStatic mkString s = CmmString (BS8.pack s) ===================================== compiler/GHC/CmmToAsm/AArch64/Ppr.hs ===================================== @@ -91,8 +91,6 @@ pprAlignForSection _platform _seg -- .balign 8 -- pprSectionAlign :: IsDoc doc => NCGConfig -> Section -> doc -pprSectionAlign _config (Section (OtherSection _) _) = - panic "AArch64.Ppr.pprSectionAlign: unknown section" pprSectionAlign config sec@(Section seg _) = line (pprSectionHeader config sec) $$ pprAlignForSection (ncgPlatform config) seg ===================================== compiler/GHC/CmmToAsm/LA64/Ppr.hs ===================================== @@ -108,8 +108,6 @@ pprAlignForSection _seg = pprAlign . mkAlignment $ 8 -- .balign 8 -- pprSectionAlign :: IsDoc doc => NCGConfig -> Section -> doc -pprSectionAlign _config (Section (OtherSection _) _) = - panic "LA64.Ppr.pprSectionAlign: unknown section" pprSectionAlign config sec@(Section seg _) = line (pprSectionHeader config sec) $$ pprAlignForSection seg ===================================== compiler/GHC/CmmToAsm/PPC/Ppr.hs ===================================== @@ -302,7 +302,6 @@ pprAlignForSection platform seg = line $ CString | ppc64 -> text ".align 3" | otherwise -> text ".align 2" - OtherSection _ -> panic "PprMach.pprSectionAlign: unknown section" pprDataItem :: IsDoc doc => Platform -> CmmLit -> doc pprDataItem platform lit ===================================== compiler/GHC/CmmToAsm/Ppr.hs ===================================== @@ -240,8 +240,6 @@ pprGNUSectionHeader config t suffix = | OSMinGW32 <- platformOS platform -> text ".rdata" | otherwise -> text ".ipe" - OtherSection _ -> - panic "PprBase.pprGNUSectionHeader: unknown section type" flags = case t of Text | OSMinGW32 <- platformOS platform, splitSections @@ -286,6 +284,5 @@ pprDarwinSectionHeader t = case t of FiniArray -> panic "pprDarwinSectionHeader: fini not supported" CString -> text ".section\t__TEXT,__cstring,cstring_literals" IPE -> text ".const" - OtherSection _ -> panic "pprDarwinSectionHeader: unknown section type" {-# SPECIALIZE pprDarwinSectionHeader :: SectionType -> SDoc #-} {-# SPECIALIZE pprDarwinSectionHeader :: SectionType -> HLine #-} -- see Note [SPECIALIZE to HDoc] in GHC.Utils.Outputable ===================================== compiler/GHC/CmmToAsm/RV64/Ppr.hs ===================================== @@ -99,8 +99,6 @@ pprAlignForSection _seg = pprAlign . mkAlignment $ 8 -- .section .text -- .balign 8 pprSectionAlign :: (IsDoc doc) => NCGConfig -> Section -> doc -pprSectionAlign _config (Section (OtherSection _) _) = - panic "RV64.Ppr.pprSectionAlign: unknown section" pprSectionAlign config sec@(Section seg _) = line (pprSectionHeader config sec) $$ pprAlignForSection seg ===================================== compiler/GHC/CmmToAsm/X86/Ppr.hs ===================================== @@ -526,8 +526,6 @@ pprAddr platform (AddrBaseIndex base index displacement) -- | Print section header and appropriate alignment for that section. pprSectionAlign :: IsDoc doc => NCGConfig -> Section -> doc -pprSectionAlign _config (Section (OtherSection _) _) = - panic "X86.Ppr.pprSectionAlign: unknown section" pprSectionAlign config sec@(Section seg _) = line (pprSectionHeader config sec) $$ pprAlignForSection (ncgPlatform config) seg ===================================== compiler/GHC/CmmToLlvm/Data.hs ===================================== @@ -148,7 +148,6 @@ llvmSectionType p t = case t of IPE -> fsLit ".ipe" InitArray -> panic "llvmSectionType: InitArray" FiniArray -> panic "llvmSectionType: FiniArray" - OtherSection _ -> panic "llvmSectionType: unknown section type" -- | Format a Cmm Section into a LLVM section name llvmSection :: Section -> LlvmM LMSection View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9a9c2f031abba5efdad19efc54e0e57d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9a9c2f031abba5efdad19efc54e0e57d... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)