1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
Description: Add initial platform support for sparc64
This patch adds initial platform support for sparc64 by mapping
sparc64 to "ArchSPARC64" instead of "ArchUnknown" in aclocal.m4.
Additionally, it adds "ArchSPARC64" to the list of known platforms
in compiler/utils/Platform.hs and various code sections of the
compiler code where the architecture is checked. Finally, it patches
compiler/main/DriverPipeline.hs to explicitly pass "-no-relax" to gcc.
See upstream ticket #11211 and Debian bug #807777.
.
Index: ghc/aclocal.m4
===================================================================
--- ghc.orig/aclocal.m4 2015-12-14 09:08:17.758064860 +0100
+++ ghc/aclocal.m4 2015-12-14 09:08:17.750064755 +0100
@@ -193,6 +193,10 @@
sparc)
test -z "[$]2" || eval "[$]2=ArchSPARC"
;;
+ sparc64)
+ test -z "[$]2" || eval "[$]2=ArchSPARC64"
+ ;;
+
arm)
GET_ARM_ISA()
test -z "[$]2" || eval "[$]2=\"ArchARM {armISA = \$ARM_ISA, armISAExt = \$ARM_ISA_EXT, armABI = \$ARM_ABI}\""
@@ -209,7 +213,7 @@
mipsel)
test -z "[$]2" || eval "[$]2=ArchMipsel"
;;
- hppa|hppa1_1|ia64|m68k|powerpc64le|rs6000|s390|s390x|sh4|sparc64|vax)
+ hppa|hppa1_1|ia64|m68k|powerpc64le|rs6000|s390|s390x|sh4|vax)
test -z "[$]2" || eval "[$]2=ArchUnknown"
;;
*)
Index: ghc/compiler/main/DriverPipeline.hs
===================================================================
--- ghc.orig/compiler/main/DriverPipeline.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/main/DriverPipeline.hs 2015-12-14 09:08:17.750064755 +0100
@@ -2208,6 +2208,7 @@
-- -r and --relax are incompatible for ld, so
-- disable --relax explicitly.
++ (if platformArch (targetPlatform dflags) == ArchSPARC
+ || platformArch (targetPlatform dflags) == ArchSPARC64
&& ldIsGnuLd
then [SysTools.Option "-Wl,-no-relax"]
else [])
Index: ghc/compiler/nativeGen/AsmCodeGen.hs
===================================================================
--- ghc.orig/compiler/nativeGen/AsmCodeGen.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/nativeGen/AsmCodeGen.hs 2015-12-14 09:08:17.754064808 +0100
@@ -171,6 +171,7 @@
ArchX86_64 -> nCG' (x86_64NcgImpl dflags)
ArchPPC -> nCG' (ppcNcgImpl dflags)
ArchSPARC -> nCG' (sparcNcgImpl dflags)
+ ArchSPARC64 -> panic "nativeCodeGen: No NCG for SPARC64"
ArchARM {} -> panic "nativeCodeGen: No NCG for ARM"
ArchARM64 -> panic "nativeCodeGen: No NCG for ARM64"
ArchPPC_64 -> panic "nativeCodeGen: No NCG for PPC 64"
Index: ghc/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
===================================================================
--- ghc.orig/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs 2015-12-14 09:08:17.754064808 +0100
@@ -111,6 +111,7 @@
ArchX86_64 -> 5
ArchPPC -> 16
ArchSPARC -> 14
+ ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
@@ -136,6 +137,7 @@
ArchX86_64 -> 0
ArchPPC -> 0
ArchSPARC -> 22
+ ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
@@ -161,6 +163,7 @@
ArchX86_64 -> 0
ArchPPC -> 26
ArchSPARC -> 11
+ ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
@@ -186,6 +189,7 @@
ArchX86_64 -> 10
ArchPPC -> 0
ArchSPARC -> 0
+ ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
Index: ghc/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
===================================================================
--- ghc.orig/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs 2015-12-14 09:08:17.754064808 +0100
@@ -74,6 +74,7 @@
ArchX86_64 -> X86.Instr.maxSpillSlots dflags
ArchPPC -> PPC.Instr.maxSpillSlots dflags
ArchSPARC -> SPARC.Instr.maxSpillSlots dflags
+ ArchSPARC64 -> panic "maxSpillSlots ArchSPARC64"
ArchARM _ _ _ -> panic "maxSpillSlots ArchARM"
ArchARM64 -> panic "maxSpillSlots ArchARM64"
ArchPPC_64 -> panic "maxSpillSlots ArchPPC_64"
Index: ghc/compiler/nativeGen/RegAlloc/Linear/Main.hs
===================================================================
--- ghc.orig/compiler/nativeGen/RegAlloc/Linear/Main.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/nativeGen/RegAlloc/Linear/Main.hs 2015-12-14 09:08:17.754064808 +0100
@@ -209,6 +209,7 @@
ArchX86_64 -> go $ (frInitFreeRegs platform :: X86_64.FreeRegs)
ArchSPARC -> go $ (frInitFreeRegs platform :: SPARC.FreeRegs)
ArchPPC -> go $ (frInitFreeRegs platform :: PPC.FreeRegs)
+ ArchSPARC64 -> panic "linearRegAlloc ArchSPARC64"
ArchARM _ _ _ -> panic "linearRegAlloc ArchARM"
ArchARM64 -> panic "linearRegAlloc ArchARM64"
ArchPPC_64 -> panic "linearRegAlloc ArchPPC_64"
Index: ghc/compiler/nativeGen/TargetReg.hs
===================================================================
--- ghc.orig/compiler/nativeGen/TargetReg.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/nativeGen/TargetReg.hs 2015-12-14 09:08:17.754064808 +0100
@@ -44,6 +44,7 @@
ArchX86_64 -> X86.virtualRegSqueeze
ArchPPC -> PPC.virtualRegSqueeze
ArchSPARC -> SPARC.virtualRegSqueeze
+ ArchSPARC64 -> panic "targetVirtualRegSqueeze ArchSPARC64"
ArchPPC_64 -> panic "targetVirtualRegSqueeze ArchPPC_64"
ArchARM _ _ _ -> panic "targetVirtualRegSqueeze ArchARM"
ArchARM64 -> panic "targetVirtualRegSqueeze ArchARM64"
@@ -61,6 +62,7 @@
ArchX86_64 -> X86.realRegSqueeze
ArchPPC -> PPC.realRegSqueeze
ArchSPARC -> SPARC.realRegSqueeze
+ ArchSPARC64 -> panic "targetRealRegSqueeze ArchSPARC64"
ArchPPC_64 -> panic "targetRealRegSqueeze ArchPPC_64"
ArchARM _ _ _ -> panic "targetRealRegSqueeze ArchARM"
ArchARM64 -> panic "targetRealRegSqueeze ArchARM64"
@@ -77,6 +79,7 @@
ArchX86_64 -> X86.classOfRealReg platform
ArchPPC -> PPC.classOfRealReg
ArchSPARC -> SPARC.classOfRealReg
+ ArchSPARC64 -> panic "targetClassOfRealReg ArchSPARC64"
ArchPPC_64 -> panic "targetClassOfRealReg ArchPPC_64"
ArchARM _ _ _ -> panic "targetClassOfRealReg ArchARM"
ArchARM64 -> panic "targetClassOfRealReg ArchARM64"
@@ -93,6 +96,7 @@
ArchX86_64 -> X86.mkVirtualReg
ArchPPC -> PPC.mkVirtualReg
ArchSPARC -> SPARC.mkVirtualReg
+ ArchSPARC64 -> panic "targetMkVirtualReg ArchSPARC64"
ArchPPC_64 -> panic "targetMkVirtualReg ArchPPC_64"
ArchARM _ _ _ -> panic "targetMkVirtualReg ArchARM"
ArchARM64 -> panic "targetMkVirtualReg ArchARM64"
@@ -109,6 +113,7 @@
ArchX86_64 -> X86.regDotColor platform
ArchPPC -> PPC.regDotColor
ArchSPARC -> SPARC.regDotColor
+ ArchSPARC64 -> panic "targetRegDotColor ArchSPARC64"
ArchPPC_64 -> panic "targetRegDotColor ArchPPC_64"
ArchARM _ _ _ -> panic "targetRegDotColor ArchARM"
ArchARM64 -> panic "targetRegDotColor ArchARM64"
Index: ghc/compiler/utils/Platform.hs
===================================================================
--- ghc.orig/compiler/utils/Platform.hs 2015-12-14 09:08:17.758064860 +0100
+++ ghc/compiler/utils/Platform.hs 2015-12-14 09:08:17.758064860 +0100
@@ -48,6 +48,7 @@
| ArchPPC
| ArchPPC_64
| ArchSPARC
+ | ArchSPARC64
| ArchARM
{ armISA :: ArmISA
, armISAExt :: [ArmISAExt]
|