Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/6a43ff84b303b5b874ff5850604458bcb2bab712

>---------------------------------------------------------------

commit 6a43ff84b303b5b874ff5850604458bcb2bab712
Author: Ian Lynagh <[email protected]>
Date:   Tue Aug 28 21:27:02 2012 +0100

    Remove some CPP from llvmGen/LlvmCodeGen/Ppr.hs
    
    I changed the behaviour slightly, e.g. i386/FreeBSD will no longer
    fall through and use the Linux "i386-pc-linux-gnu", but will get the
    final empty case instead. I assume that that's the right thing to do.

>---------------------------------------------------------------

 compiler/llvmGen/LlvmCodeGen/Ppr.hs |   59 ++++++++++++++--------------------
 1 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/compiler/llvmGen/LlvmCodeGen/Ppr.hs 
b/compiler/llvmGen/LlvmCodeGen/Ppr.hs
index 1c71598..cf78b37 100644
--- a/compiler/llvmGen/LlvmCodeGen/Ppr.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Ppr.hs
@@ -15,6 +15,7 @@ import LlvmCodeGen.Regs
 
 import CLabel
 import OldCmm
+import Platform
 
 import FastString
 import Outputable
@@ -37,41 +38,29 @@ pprLlvmHeader =
 
 -- | LLVM module layout description for the host target
 moduleLayout :: SDoc
-moduleLayout =
-#if i386_TARGET_ARCH
-
-#if darwin_TARGET_OS
-    text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32\""
-    $+$ text "target triple = \"i386-apple-darwin9.8\""
-#elif mingw32_TARGET_OS
-    text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32\""
-    $+$ text "target triple = \"i686-pc-win32\""
-#else /* Linux */
-    text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32\""
-    $+$ text "target triple = \"i386-pc-linux-gnu\""
-#endif
-
-#elif x86_64_TARGET_ARCH
-
-#if darwin_TARGET_OS
-    text "target datalayout = 
\"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
-    $+$ text "target triple = \"x86_64-apple-darwin10.0.0\""
-#else /* Linux */
-    text "target datalayout = 
\"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
-    $+$ text "target triple = \"x86_64-linux-gnu\""
-#endif
-
-#elif defined (arm_TARGET_ARCH)
-
-#if linux_TARGET_OS
-    text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\""
-    $+$ text "target triple = \"arm-unknown-linux-gnueabi\""
-#endif
-
-#else
-    -- FIX: Other targets
-    empty
-#endif
+moduleLayout = sdocWithPlatform $ \platform ->
+    case platform of
+    Platform { platformArch = ArchX86, platformOS = OSDarwin } ->
+        text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32\""
+        $+$ text "target triple = \"i386-apple-darwin9.8\""
+    Platform { platformArch = ArchX86, platformOS = OSMinGW32 } ->
+        text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32\""
+        $+$ text "target triple = \"i686-pc-win32\""
+    Platform { platformArch = ArchX86, platformOS = OSLinux } ->
+        text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32\""
+        $+$ text "target triple = \"i386-pc-linux-gnu\""
+    Platform { platformArch = ArchX86_64, platformOS = OSDarwin } ->
+        text "target datalayout = 
\"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
+        $+$ text "target triple = \"x86_64-apple-darwin10.0.0\""
+    Platform { platformArch = ArchX86_64, platformOS = OSLinux } ->
+        text "target datalayout = 
\"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
+        $+$ text "target triple = \"x86_64-linux-gnu\""
+    Platform { platformArch = ArchARM {}, platformOS = OSLinux } ->
+        text "target datalayout = 
\"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\""
+        $+$ text "target triple = \"arm-unknown-linux-gnueabi\""
+    _ ->
+        -- FIX: Other targets
+        empty
 
 
 -- | Pretty print LLVM data code



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to