Hadrian: add LLVM flavours
authorAlec Theriault <alec.theriault@gmail.com>
Wed, 30 Jan 2019 02:33:20 +0000 (18:33 -0800)
committerAlec Theriault <alec.theriault@gmail.com>
Sun, 10 Feb 2019 14:02:24 +0000 (09:02 -0500)
This adds a handful of LLVM flavours and the accompanying
documentation. These flavours are mostly uninteresting, but
exist in the Make system.

hadrian/doc/flavours.md
hadrian/hadrian.cabal
hadrian/src/Settings.hs
hadrian/src/Settings/Flavours/Llvm.hs [new file with mode: 0644]

index cb864a0..7b89637 100644 (file)
@@ -109,6 +109,39 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH
     <td></td>
     <td>-O0<br>-DDEBUG</td>
   </tr>
+  <tr>
+    <th>quick-llvm</td>
+    <td>-O0<br>-H64m<br>-fllvm</td>
+    <td>-O0<br>-H64m<br>-fllvm</td>
+    <td></td>
+    <td>-O</td>
+    <td>-O</td>
+    <td></td>
+    <td>-O</td>
+    <td></td>
+  </tr>
+  <tr>
+    <th>perf-llvm</td>
+    <td>-O<br>-H64m<br>-fllvm</td>
+    <td>-O<br>-H64m<br>-fllvm</td>
+    <td></td>
+    <td>-O2</td>
+    <td>-O</td>
+    <td>-O2</td>
+    <td>-O</td>
+    <td>-O2</td>
+  </tr>
+  <tr>
+    <th>prof-llvm</td>
+    <td>-O0<br>-H64m<br>-fllvm</td>
+    <td>-O0<br>-H64m<br>-fllvm</td>
+    <td></td>
+    <td>-O</td>
+    <td>-O</td>
+    <td>-O</td>
+    <td>-O</td>
+    <td>-O</td>
+  </tr>
 </table>
 
 ## Ways
@@ -132,7 +165,7 @@ information. The following table lists ways that are built in different flavours
         <th>stage1+</th>
     </tr>
     <tr>
-    <th>default<br>perf<br>prof<br>devel1<br>devel2</td>
+    <th>default<br>perf<br>prof<br>devel1<br>devel2<br>perf-llvm<br>prof-llvm</td>
     <td>vanilla</td>
     <td>vanilla<br>profiling<br>dynamic</td>
     <td>logging<br>debug<br>threaded<br>threadedDebug<br>threadedLogging
@@ -149,7 +182,7 @@ information. The following table lists ways that are built in different flavours
     <td>Only in<br>prof<br>flavour</td>
 </tr>
 <tr>
-    <th>quick</th>
+    <th>quick<br>quick-llvm</th>
     <td>vanilla</td>
     <td>vanilla<br>dynamic</td>
     <td>logging<br>debug<br>threaded<br>threadedDebug<br>threadedLogging
index 669d16c..6a4fff1 100644 (file)
@@ -91,6 +91,7 @@ executable hadrian
                        , Settings.Default
                        , Settings.Flavours.Common
                        , Settings.Flavours.Development
+                       , Settings.Flavours.Llvm
                        , Settings.Flavours.Performance
                        , Settings.Flavours.Profiled
                        , Settings.Flavours.Quick
index 99a58db..519d1fc 100755 (executable)
@@ -12,6 +12,7 @@ import UserSettings (userFlavours, userPackages, userDefaultFlavour)
 
 import {-# SOURCE #-} Settings.Default
 import Settings.Flavours.Development
+import Settings.Flavours.Llvm
 import Settings.Flavours.Performance
 import Settings.Flavours.Profiled
 import Settings.Flavours.Quick
@@ -36,7 +37,8 @@ hadrianFlavours :: [Flavour]
 hadrianFlavours =
     [ defaultFlavour, developmentFlavour Stage1, developmentFlavour Stage2
     , performanceFlavour, profiledFlavour, quickFlavour, quickestFlavour
-    , quickCrossFlavour ]
+    , quickCrossFlavour
+    , performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour ]
 
 flavour :: Action Flavour
 flavour = do
diff --git a/hadrian/src/Settings/Flavours/Llvm.hs b/hadrian/src/Settings/Flavours/Llvm.hs
new file mode 100644 (file)
index 0000000..2752c9e
--- /dev/null
@@ -0,0 +1,26 @@
+module Settings.Flavours.Llvm (
+  performanceLlvmFlavour,
+  profiledLlvmFlavour,
+  quickLlvmFlavour,
+) where
+
+import Expression
+import Flavour
+
+import Settings.Flavours.Performance
+import Settings.Flavours.Profiled
+import Settings.Flavours.Quick
+
+-- Please update doc/flavours.md when changing this file.
+performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour :: Flavour
+performanceLlvmFlavour = mkLlvmFlavour performanceFlavour
+profiledLlvmFlavour    = mkLlvmFlavour profiledFlavour
+quickLlvmFlavour       = mkLlvmFlavour quickFlavour
+
+-- | Turn a flavour into an LLVM flavour
+mkLlvmFlavour :: Flavour -> Flavour
+mkLlvmFlavour flav = flav
+    { name = name flav ++ "-llvm"
+    , args = mconcat [ args flav
+                     , builder Ghc ? arg "-fllvm" ]
+    }