diff options
author | David Terei <davidterei@gmail.com> | 2012-01-12 14:20:25 -0800 |
---|---|---|
committer | David Terei <davidterei@gmail.com> | 2012-01-12 16:42:07 -0800 |
commit | ba52053b95ccb417ca7ce08e85a45e49b5f49b0a (patch) | |
tree | cf3b669a01ee18c36d7dd5ccad51482259f194a8 | |
parent | c55bb6036af6437aee35db42e45eb23ef0c17567 (diff) | |
download | haskell-ba52053b95ccb417ca7ce08e85a45e49b5f49b0a.tar.gz |
Add '-fllvm-tbaa' flag for controlling LLVM TBAA opt.
-rw-r--r-- | compiler/main/DriverPipeline.hs | 27 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 3 | ||||
-rw-r--r-- | docs/users_guide/flags.xml | 9 |
3 files changed, 29 insertions, 10 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 0e8990777b..5c0d1b7d8c 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1306,15 +1306,18 @@ runPhase SplitAs _input_fn dflags runPhase LlvmOpt input_fn dflags = do - let lo_opts = getOpts dflags opt_lo - let opt_lvl = max 0 (min 2 $ optLevel dflags) - -- don't specify anything if user has specified commands. We do this for - -- opt but not llc since opt is very specifically for optimisation passes - -- only, so if the user is passing us extra options we assume they know - -- what they are doing and don't get in the way. - let optFlag = if null lo_opts - then [SysTools.Option (llvmOpts !! opt_lvl)] - else [] + let lo_opts = getOpts dflags opt_lo + opt_lvl = max 0 (min 2 $ optLevel dflags) + -- don't specify anything if user has specified commands. We do this + -- for opt but not llc since opt is very specifically for optimisation + -- passes only, so if the user is passing us extra options we assume + -- they know what they are doing and don't get in the way. + optFlag = if null lo_opts + then [SysTools.Option (llvmOpts !! opt_lvl)] + else [] + tbaa | dopt Opt_LlvmTBAA dflags = "--enable-tbaa=true" + | otherwise = "--enable-tbaa=false" + output_fn <- phaseOutputFilename LlvmLlc @@ -1323,6 +1326,7 @@ runPhase LlvmOpt input_fn dflags SysTools.Option "-o", SysTools.FileOption "" output_fn] ++ optFlag + ++ [SysTools.Option tbaa] ++ map SysTools.Option lo_opts) return (LlvmLlc, output_fn) @@ -1341,6 +1345,8 @@ runPhase LlvmLlc input_fn dflags rmodel | opt_PIC = "pic" | not opt_Static = "dynamic-no-pic" | otherwise = "static" + tbaa | dopt Opt_LlvmTBAA dflags = "--enable-tbaa=true" + | otherwise = "--enable-tbaa=false" -- hidden debugging flag '-dno-llvm-mangler' to skip mangling let next_phase = case dopt Opt_NoLlvmMangler dflags of @@ -1356,6 +1362,7 @@ runPhase LlvmLlc input_fn dflags SysTools.FileOption "" input_fn, SysTools.Option "-o", SysTools.FileOption "" output_fn] ++ map SysTools.Option lc_opts + ++ [SysTools.Option tbaa] ++ map SysTools.Option fpOpts) return (next_phase, output_fn) @@ -1373,7 +1380,7 @@ runPhase LlvmLlc input_fn dflags else if (elem VFPv3D16 ext) then ["-mattr=+v7,+vfp3,+d16"] else [] - _ -> [] + _ -> [] ----------------------------------------------------------------------------- -- LlvmMangle phase diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 48830e1b99..47134bb7de 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -250,6 +250,7 @@ data DynFlag | Opt_RegsGraph -- do graph coloring register allocation | Opt_RegsIterative -- do iterative coalescing graph coloring register allocation | Opt_PedanticBottoms -- Be picky about how we treat bottom + | Opt_LlvmTBAA -- Use LLVM TBAA infastructure for improving AA -- Interface files | Opt_IgnoreInterfacePragmas @@ -1823,6 +1824,7 @@ fFlags = [ ( "vectorise", Opt_Vectorise, nop ), ( "regs-graph", Opt_RegsGraph, nop ), ( "regs-iterative", Opt_RegsIterative, nop ), + ( "llvm-tbaa", Opt_LlvmTBAA, nop), ( "gen-manifest", Opt_GenManifest, nop ), ( "embed-manifest", Opt_EmbedManifest, nop ), ( "ext-core", Opt_EmitExternalCore, nop ), @@ -2071,6 +2073,7 @@ optLevelFlags , ([2], Opt_LiberateCase) , ([2], Opt_SpecConstr) , ([2], Opt_RegsGraph) + , ([0,1,2], Opt_LlvmTBAA) -- , ([2], Opt_StaticArgumentTransformation) -- Max writes: I think it's probably best not to enable SAT with -O2 for the diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index ecce941082..be262a5e67 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -1546,6 +1546,15 @@ </row> <row> + <entry><option>-fllvm-tbaa</replaceable></entry> + <entry>Turn on Typed Based Alias Analysis information in the LLVM + backend. This enables more accurate and alias information in the LLVM + backend for better optimisation. (default: Enabled)</entry> + <entry>dynamic</entry> + <entry><option>-fno-llvm-tbaa</option></entry> + </row> + + <row> <entry><option>-fmax-simplifier-iterations</option></entry> <entry>Set the max iterations for the simplifier</entry> <entry>dynamic</entry> |