diff options
author | Kavon Farvardin <kavon@farvard.in> | 2018-05-27 11:49:25 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-05-30 10:02:10 -0400 |
commit | a4ae199cf810a63444a4ef24a44b33329023cd93 (patch) | |
tree | 8ecbb42f89140f02ac808b72737a1a735f478461 /ghc | |
parent | 9aac442f70b0b58decd56fb52dd4ec2289b03759 (diff) | |
download | haskell-a4ae199cf810a63444a4ef24a44b33329023cd93.tar.gz |
Extract hard-coded LLVM opt flags into a file
To resolve ticket #11295, I think it makes sense to stop hard-coding
the pass sequences used by GHC when compiling with LLVM into the
compiler
itself.
This patchset introduces a companion to the existing `llvm-targets` file
called `llvm-passes`. The passes file is a simple association list that
holds the default LLVM `opt` pass sequence used by GHC. This allows end
users to easily save their favorite optimization flags when compiling
with LLVM.
The main benefit for ticket #11295 is that when adding a custom pass
sequence, it tends to be an extremely long string that would be
unsightly in the code.
This is essentially part 1 of 2 for ticket #11295.
Test Plan: ./validate
Reviewers: bgamari, angerman
Reviewed By: angerman
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4695
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/GHCi/UI.hs | 8 | ||||
-rw-r--r-- | ghc/ghc.mk | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index d449b3ca83..67f2cbb147 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -2568,7 +2568,9 @@ showDynFlags show_all dflags = do is_on = test f dflags quiet = not show_all && test f default_dflags == is_on - default_dflags = defaultDynFlags (settings dflags) (llvmTargets dflags) + llvmConfig = (llvmTargets dflags, llvmPasses dflags) + + default_dflags = defaultDynFlags (settings dflags) llvmConfig (ghciFlags,others) = partition (\f -> flagSpecFlag f `elem` flgs) DynFlags.fFlags @@ -2979,8 +2981,10 @@ showLanguages' show_all dflags = is_on = test f dflags quiet = not show_all && test f default_dflags == is_on + llvmConfig = (llvmTargets dflags, llvmPasses dflags) + default_dflags = - defaultDynFlags (settings dflags) (llvmTargets dflags) `lang_set` + defaultDynFlags (settings dflags) llvmConfig `lang_set` case language dflags of Nothing -> Just Haskell2010 other -> other diff --git a/ghc/ghc.mk b/ghc/ghc.mk index 20fa142df5..6e329352ef 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -135,6 +135,9 @@ $(INPLACE_LIB)/settings : settings $(INPLACE_LIB)/llvm-targets : llvm-targets "$(CP)" $< $@ +$(INPLACE_LIB)/llvm-passes : llvm-passes + "$(CP)" $< $@ + $(INPLACE_LIB)/platformConstants: $(includes_GHCCONSTANTS_HASKELL_VALUE) "$(CP)" $< $@ @@ -144,6 +147,7 @@ $(INPLACE_LIB)/platformConstants: $(includes_GHCCONSTANTS_HASKELL_VALUE) GHC_DEPENDENCIES += $$(unlit_INPLACE) GHC_DEPENDENCIES += $(INPLACE_LIB)/settings GHC_DEPENDENCIES += $(INPLACE_LIB)/llvm-targets +GHC_DEPENDENCIES += $(INPLACE_LIB)/llvm-passes GHC_DEPENDENCIES += $(INPLACE_LIB)/platformConstants $(GHC_STAGE1) : | $(GHC_DEPENDENCIES) @@ -172,11 +176,12 @@ endif INSTALL_LIBS += settings INSTALL_LIBS += llvm-targets +INSTALL_LIBS += llvm-passes ifeq "$(Windows_Host)" "NO" install: install_ghc_link .PHONY: install_ghc_link -install_ghc_link: +install_ghc_link: $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc") $(LN_S) $(CrossCompilePrefix)ghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc" else @@ -188,4 +193,3 @@ install_ghc_post: install_bins $(call removeFiles,"$(DESTDIR)$(bindir)/ghc.exe") "$(MV)" -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc.exe endif - |