diff options
author | klebinger.andreas@gmx.at <klebinger.andreas@gmx.at> | 2018-06-03 00:37:59 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-03 00:38:07 -0400 |
commit | f68c2cb60f881a0a41ae2e8cafc5de193ef9c3fb (patch) | |
tree | 43c63e49469e8e04f0f67338b9b7830298fca2b8 /compiler/nativeGen | |
parent | 9b7eec8614f531e20a34e8dd2f62293ab0fedf8c (diff) | |
download | haskell-f68c2cb60f881a0a41ae2e8cafc5de193ef9c3fb.tar.gz |
Allow aligning of cmm procs at specific boundry
Allows to align CmmProcs at the given boundries.
It makes performance usually worse but can be helpful
to limit the effect of a unrelated function B becoming
faster/slower after changing function A.
Test Plan: ci, using it.
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15148
Differential Revision: https://phabricator.haskell.org/D4706
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r-- | compiler/nativeGen/X86/Ppr.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index c03bf4f14c..c5fbeb544e 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -73,12 +73,17 @@ import Data.Bits -- .subsections_via_symbols and -dead_strip can be found at -- <https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html#//apple_ref/doc/uid/TP30000823-TPXREF101> +pprProcAlignment :: SDoc +pprProcAlignment = sdocWithDynFlags $ \dflags -> + (maybe empty pprAlign . cmmProcAlignment $ dflags) + pprNatCmmDecl :: NatCmmDecl (Alignment, CmmStatics) Instr -> SDoc pprNatCmmDecl (CmmData section dats) = pprSectionAlign section $$ pprDatas dats pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = sdocWithDynFlags $ \dflags -> + pprProcAlignment $$ case topInfoTable proc of Nothing -> case blocks of @@ -86,6 +91,7 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = pprLabel lbl blocks -> -- special case for code without info table: pprSectionAlign (Section Text lbl) $$ + pprProcAlignment $$ pprLabel lbl $$ -- blocks guaranteed not null, so label needed vcat (map (pprBasicBlock top_info) blocks) $$ (if debugLevel dflags > 0 @@ -95,6 +101,7 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = Just (Statics info_lbl _) -> sdocWithPlatform $ \platform -> pprSectionAlign (Section Text info_lbl) $$ + pprProcAlignment $$ (if platformHasSubsectionsViaSymbols platform then ppr (mkDeadStripPreventer info_lbl) <> char ':' else empty) $$ |