diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-10-15 22:51:59 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-10-19 11:41:00 -0700 |
commit | 5b9fe33d8a85c2e2105844b65da417c7358187ab (patch) | |
tree | 8b4f3ad1604e2e3e1c7535a78e68437ca900254d | |
parent | b5930f8b8030350eff306bf56ba7607098ada61e (diff) | |
download | haskell-5b9fe33d8a85c2e2105844b65da417c7358187ab.tar.gz |
Indentation and non-semantic changes only.
Summary:
Get these lines fitting in 80 columns, and replace ptext (sLit ...) with text
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonmar, austin
Subscribers: thomie, carter, ezyang, simonmar
Differential Revision: https://phabricator.haskell.org/D342
-rw-r--r-- | compiler/cmm/PprCmmDecl.hs | 14 | ||||
-rw-r--r-- | compiler/main/DriverPipeline.hs | 40 | ||||
-rw-r--r-- | compiler/nativeGen/PPC/Ppr.hs | 42 | ||||
-rw-r--r-- | compiler/nativeGen/SPARC/Ppr.hs | 20 | ||||
-rw-r--r-- | compiler/nativeGen/X86/Ppr.hs | 94 |
5 files changed, 107 insertions, 103 deletions
diff --git a/compiler/cmm/PprCmmDecl.hs b/compiler/cmm/PprCmmDecl.hs index 417f90d360..c9bbc8b8f7 100644 --- a/compiler/cmm/PprCmmDecl.hs +++ b/compiler/cmm/PprCmmDecl.hs @@ -155,14 +155,14 @@ pprStatic s = case s of -- pprSection :: Section -> SDoc pprSection s = case s of - Text -> section <+> doubleQuotes (ptext (sLit "text")) - Data -> section <+> doubleQuotes (ptext (sLit "data")) - ReadOnlyData -> section <+> doubleQuotes (ptext (sLit "readonly")) - ReadOnlyData16 -> section <+> doubleQuotes (ptext (sLit "readonly16")) + Text -> section <+> doubleQuotes (text "text") + Data -> section <+> doubleQuotes (text "data") + ReadOnlyData -> section <+> doubleQuotes (text "readonly") + ReadOnlyData16 -> section <+> doubleQuotes (text "readonly16") RelocatableReadOnlyData - -> section <+> doubleQuotes (ptext (sLit "relreadonly")) - UninitialisedData -> section <+> doubleQuotes (ptext (sLit "uninitialised")) - StaticClosures -> section <+> doubleQuotes (ptext (sLit "staticclosures")) + -> section <+> doubleQuotes (text "relreadonly") + UninitialisedData -> section <+> doubleQuotes (text "uninitialised") + StaticClosures -> section <+> doubleQuotes (text "staticclosures") OtherSection s' -> section <+> doubleQuotes (text s') where section = ptext (sLit "section") diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 562c7d74be..1977f0edcf 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1595,26 +1595,26 @@ mkExtraObjToLinkIntoBinary dflags = do mkExtraObj dflags "c" (showSDoc dflags main) - where - main - | gopt Opt_NoHsMain dflags = Outputable.empty - | otherwise = vcat [ - ptext (sLit "#include \"Rts.h\""), - ptext (sLit "extern StgClosure ZCMain_main_static_closure;"), - ptext (sLit "int main(int argc, char *argv[])"), - char '{', - ptext (sLit " RtsConfig __conf = defaultRtsConfig;"), - ptext (sLit " __conf.rts_opts_enabled = ") - <> text (show (rtsOptsEnabled dflags)) <> semi, - case rtsOpts dflags of - Nothing -> Outputable.empty - Just opts -> ptext (sLit " __conf.rts_opts= ") <> - text (show opts) <> semi, - ptext (sLit " __conf.rts_hs_main = rtsTrue;"), - ptext (sLit " return hs_main(argc, argv, &ZCMain_main_static_closure,__conf);"), - char '}', - char '\n' -- final newline, to keep gcc happy - ] + where + main + | gopt Opt_NoHsMain dflags = Outputable.empty + | otherwise = vcat [ + text "#include \"Rts.h\"", + text "extern StgClosure ZCMain_main_static_closure;", + text "int main(int argc, char *argv[])", + char '{', + text " RtsConfig __conf = defaultRtsConfig;", + text " __conf.rts_opts_enabled = " + <> text (show (rtsOptsEnabled dflags)) <> semi, + case rtsOpts dflags of + Nothing -> Outputable.empty + Just opts -> ptext (sLit " __conf.rts_opts= ") <> + text (show opts) <> semi, + text " __conf.rts_hs_main = rtsTrue;", + text " return hs_main(argc,argv,&ZCMain_main_static_closure,__conf);", + char '}', + char '\n' -- final newline, to keep gcc happy + ] -- Write out the link info section into a new assembly file. Previously -- this was included as inline assembly in the main.c file but this diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 4f297fa15a..36db75a646 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -273,27 +273,27 @@ pprAddr (AddrRegImm r1 imm) = hcat [ pprImm imm, char '(', pprReg r1, char ')' ] pprSectionHeader :: Section -> SDoc -pprSectionHeader seg - = sdocWithPlatform $ \platform -> - let osDarwin = platformOS platform == OSDarwin - in case seg of - Text -> ptext (sLit ".text\n.align 2") - Data -> ptext (sLit ".data\n.align 2") - ReadOnlyData - | osDarwin -> ptext (sLit ".const\n.align 2") - | otherwise -> ptext (sLit ".section .rodata\n\t.align 2") - RelocatableReadOnlyData - | osDarwin -> ptext (sLit ".const_data\n.align 2") - | otherwise -> ptext (sLit ".data\n\t.align 2") - UninitialisedData - | osDarwin -> ptext (sLit ".const_data\n.align 2") - | otherwise -> ptext (sLit ".section .bss\n\t.align 2") - ReadOnlyData16 - | osDarwin -> ptext (sLit ".const\n.align 4") - | otherwise -> ptext (sLit ".section .rodata\n\t.align 4") - StaticClosures -> ptext (sLit ".section staticclosures,\"aw\"\n\t.align 2") - OtherSection _ -> - panic "PprMach.pprSectionHeader: unknown section" +pprSectionHeader seg = + sdocWithPlatform $ \platform -> + let osDarwin = platformOS platform == OSDarwin in + case seg of + Text -> text ".text\n\t.align 2" + Data -> text ".data\n\t.align 2" + ReadOnlyData + | osDarwin -> text ".const\n\t.align 2" + | otherwise -> text ".section .rodata\n\t.align 2" + RelocatableReadOnlyData + | osDarwin -> text ".const_data\n\t.align 2" + | otherwise -> text ".data\n\t.align 2" + UninitialisedData + | osDarwin -> text ".const_data\n\t.align 2" + | otherwise -> text ".section .bss\n\t.align 2" + ReadOnlyData16 + | osDarwin -> text ".const\n\t.align 4" + | otherwise -> text ".section .rodata\n\t.align 4" + StaticClosures -> text ".section staticclosures,\"aw\"\n\t.align 2" + OtherSection _ -> + panic "PprMach.pprSectionHeader: unknown section" pprDataItem :: CmmLit -> SDoc diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs index e33c97e71c..c0ae9c10d8 100644 --- a/compiler/nativeGen/SPARC/Ppr.hs +++ b/compiler/nativeGen/SPARC/Ppr.hs @@ -326,16 +326,16 @@ pprImm imm -- incase we store doubles in them. -- pprSectionHeader :: Section -> SDoc -pprSectionHeader seg - = case seg of - Text -> ptext (sLit ".text\n\t.align 4") - Data -> ptext (sLit ".data\n\t.align 8") - ReadOnlyData -> ptext (sLit ".text\n\t.align 8") - RelocatableReadOnlyData -> ptext (sLit ".text\n\t.align 8") - UninitialisedData -> ptext (sLit ".bss\n\t.align 8") - ReadOnlyData16 -> ptext (sLit ".data\n\t.align 16") - StaticClosures -> ptext (sLit ".section staticclosures,\"aw\"\n\t.align 8") - OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" +pprSectionHeader seg = case seg of + Text -> text ".text\n\t.align 4" + Data -> text ".data\n\t.align 8" + ReadOnlyData -> text ".text\n\t.align 8" + RelocatableReadOnlyData + -> text ".text\n\t.align 8" + UninitialisedData -> text ".bss\n\t.align 8" + ReadOnlyData16 -> text ".data\n\t.align 16" + StaticClosures -> text ".section staticclosures,\"aw\"\n\t.align 8" + OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" -- | Pretty print a data item. diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index fcefce35ec..6449d8e5e7 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -376,51 +376,55 @@ pprAddr (AddrBaseIndex base index displacement) pprSectionHeader :: Section -> SDoc -pprSectionHeader seg - = sdocWithPlatform $ \platform -> - case platformOS platform of - OSDarwin - | target32Bit platform -> - case seg of - Text -> ptext (sLit ".text\n\t.align 2") - Data -> ptext (sLit ".data\n\t.align 2") - ReadOnlyData -> ptext (sLit ".const\n.align 2") - RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 2") - UninitialisedData -> ptext (sLit ".data\n\t.align 2") - ReadOnlyData16 -> ptext (sLit ".const\n.align 4") - StaticClosures -> ptext (sLit ".section staticclosures,\"aw\"\n\t.align 2") - OtherSection _ -> panic "X86.Ppr.pprSectionHeader: unknown section" - | otherwise -> - case seg of - Text -> ptext (sLit ".text\n.align 3") - Data -> ptext (sLit ".data\n.align 3") - ReadOnlyData -> ptext (sLit ".const\n.align 3") - RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 3") - UninitialisedData -> ptext (sLit ".data\n\t.align 3") - ReadOnlyData16 -> ptext (sLit ".const\n.align 4") - StaticClosures -> ptext (sLit ".section staticclosures,\"aw\"\n\t.align 3") - OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" - _ - | target32Bit platform -> - case seg of - Text -> ptext (sLit ".text\n\t.align 4,0x90") - Data -> ptext (sLit ".data\n\t.align 4") - ReadOnlyData -> ptext (sLit ".section .rodata\n\t.align 4") - RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 4") - UninitialisedData -> ptext (sLit ".section .bss\n\t.align 4") - ReadOnlyData16 -> ptext (sLit ".section .rodata\n\t.align 16") - StaticClosures -> ptext (sLit ".section staticclosures,\"aw\"\n\t.align 4") - OtherSection _ -> panic "X86.Ppr.pprSectionHeader: unknown section" - | otherwise -> - case seg of - Text -> ptext (sLit ".text\n\t.align 8") - Data -> ptext (sLit ".data\n\t.align 8") - ReadOnlyData -> ptext (sLit ".section .rodata\n\t.align 8") - RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 8") - UninitialisedData -> ptext (sLit ".section .bss\n\t.align 8") - ReadOnlyData16 -> ptext (sLit ".section .rodata.cst16\n\t.align 16") - StaticClosures -> ptext (sLit ".section staticclosures,\"aw\"\n\t.align 8") - OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" +pprSectionHeader seg = + sdocWithPlatform $ \platform -> + case platformOS platform of + OSDarwin + | target32Bit platform -> + case seg of + Text -> text ".text\n\t.align 2" + Data -> text ".data\n\t.align 2" + ReadOnlyData -> text ".const\n\t.align 2" + RelocatableReadOnlyData + -> text ".const_data\n\t.align 2" + UninitialisedData -> text ".data\n\t.align 2" + ReadOnlyData16 -> text ".const\n\t.align 4" + StaticClosures -> text ".section staticclosures,\"aw\"\n\t.align 2" + OtherSection _ -> panic "X86.Ppr.pprSectionHeader: unknown section" + | otherwise -> + case seg of + Text -> text ".text\n\t.align 3" + Data -> text ".data\n\t.align 3" + ReadOnlyData -> text ".const\n\t.align 3" + RelocatableReadOnlyData + -> text ".const_data\n\t.align 3" + UninitialisedData -> text ".data\n\t.align 3" + ReadOnlyData16 -> text ".const\n\t.align 4" + StaticClosures -> text ".section staticclosures,\"aw\"\n\t.align 3" + OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" + _ + | target32Bit platform -> + case seg of + Text -> text ".text\n\t.align 4,0x90" + Data -> text ".data\n\t.align 4" + ReadOnlyData -> text ".section .rodata\n\t.align 4" + RelocatableReadOnlyData + -> text ".section .data\n\t.align 4" + UninitialisedData -> text ".section .bss\n\t.align 4" + ReadOnlyData16 -> text ".section .rodata\n\t.align 16" + StaticClosures -> text ".section staticclosures,\"aw\"\n\t.align 4" + OtherSection _ -> panic "X86.Ppr.pprSectionHeader: unknown section" + | otherwise -> + case seg of + Text -> text ".text\n\t.align 8" + Data -> text ".data\n\t.align 8" + ReadOnlyData -> text ".section .rodata\n\t.align 8" + RelocatableReadOnlyData + -> text ".section .data\n\t.align 8" + UninitialisedData -> text ".section .bss\n\t.align 8" + ReadOnlyData16 -> text ".section .rodata.cst16\n\t.align 16" + StaticClosures -> text ".section staticclosures,\"aw\"\n\t.align 8" + OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" |