summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2020-11-13 02:51:54 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-15 03:36:56 -0500
commit8887102fc4ed8ed1089c1aafd19bab424ad706f3 (patch)
treee1c3dfc5d2262efbc6dc6ccb902b288766566d90 /compiler
parent645444af9eb185684c750c95e4740d301352b2b9 (diff)
downloadhaskell-8887102fc4ed8ed1089c1aafd19bab424ad706f3.tar.gz
AArch64/arm64 adjustments
This addes the necessary logic to support aarch64 on elf, as well as aarch64 on mach-o, which Apple calls arm64. We change architecture name to AArch64, which is the official arm naming scheme.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/CmmToAsm.hs3
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs6
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear.hs2
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs2
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Target.hs10
-rw-r--r--compiler/GHC/CmmToC.hs2
-rw-r--r--compiler/GHC/Driver/Session.hs4
-rw-r--r--compiler/GHC/Linker/Dynamic.hs2
-rw-r--r--compiler/GHC/Linker/Static.hs7
-rw-r--r--compiler/GHC/Platform.hs3
-rw-r--r--compiler/GHC/Platform/AArch64.hs (renamed from compiler/GHC/Platform/ARM64.hs)3
-rw-r--r--compiler/GHC/Platform/Regs.hs64
-rw-r--r--compiler/ghc.cabal.in2
13 files changed, 52 insertions, 58 deletions
diff --git a/compiler/GHC/CmmToAsm.hs b/compiler/GHC/CmmToAsm.hs
index 013ad24554..149ebbd472 100644
--- a/compiler/GHC/CmmToAsm.hs
+++ b/compiler/GHC/CmmToAsm.hs
@@ -166,7 +166,7 @@ nativeCodeGen dflags this_mod modLoc h us cmms
ArchSPARC64 -> panic "nativeCodeGen: No NCG for SPARC64"
ArchS390X -> panic "nativeCodeGen: No NCG for S390X"
ArchARM {} -> panic "nativeCodeGen: No NCG for ARM"
- ArchARM64 -> panic "nativeCodeGen: No NCG for ARM64"
+ ArchAArch64 -> panic "nativeCodeGen: No NCG for AArch64"
ArchAlpha -> panic "nativeCodeGen: No NCG for Alpha"
ArchMipseb -> panic "nativeCodeGen: No NCG for mipseb"
ArchMipsel -> panic "nativeCodeGen: No NCG for mipsel"
@@ -1193,4 +1193,3 @@ initNCGConfig dflags this_mod = NCGConfig
, ncgDwarfStripBlockInfo = debugLevel dflags < 2 -- We strip out block information when running with -g0 or -g1.
, ncgDwarfSourceNotes = debugLevel dflags >= 3 -- We produce GHC-specific source-note DIEs only with -g3
}
-
diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs b/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
index 0370670b21..105e2ebdf9 100644
--- a/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
@@ -115,7 +115,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcInteger conflicts excl
ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 _ -> 15
ArchARM _ _ _ -> panic "trivColorable ArchARM"
- ArchARM64 -> panic "trivColorable ArchARM64"
+ ArchAArch64 -> panic "trivColorable ArchAArch64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
@@ -146,7 +146,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcFloat conflicts exclus
ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 _ -> 0
ArchARM _ _ _ -> panic "trivColorable ArchARM"
- ArchARM64 -> panic "trivColorable ArchARM64"
+ ArchAArch64 -> panic "trivColorable ArchAArch64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
@@ -179,7 +179,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcDouble conflicts exclu
ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 _ -> 20
ArchARM _ _ _ -> panic "trivColorable ArchARM"
- ArchARM64 -> panic "trivColorable ArchARM64"
+ ArchAArch64 -> panic "trivColorable ArchAArch64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear.hs b/compiler/GHC/CmmToAsm/Reg/Linear.hs
index 34e5e71205..849f600465 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear.hs
@@ -223,7 +223,7 @@ linearRegAlloc config entry_ids block_live sccs
ArchSPARC64 -> panic "linearRegAlloc ArchSPARC64"
ArchPPC -> go $ (frInitFreeRegs platform :: PPC.FreeRegs)
ArchARM _ _ _ -> panic "linearRegAlloc ArchARM"
- ArchARM64 -> panic "linearRegAlloc ArchARM64"
+ ArchAArch64 -> panic "linearRegAlloc ArchAArch64"
ArchPPC_64 _ -> go $ (frInitFreeRegs platform :: PPC.FreeRegs)
ArchAlpha -> panic "linearRegAlloc ArchAlpha"
ArchMipseb -> panic "linearRegAlloc ArchMipseb"
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs b/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
index b4fa0f8b76..b89c056a82 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
@@ -78,7 +78,7 @@ maxSpillSlots config = case platformArch (ncgPlatform config) of
ArchSPARC -> SPARC.Instr.maxSpillSlots config
ArchSPARC64 -> panic "maxSpillSlots ArchSPARC64"
ArchARM _ _ _ -> panic "maxSpillSlots ArchARM"
- ArchARM64 -> panic "maxSpillSlots ArchARM64"
+ ArchAArch64 -> panic "maxSpillSlots ArchAArch64"
ArchPPC_64 _ -> PPC.Instr.maxSpillSlots config
ArchAlpha -> panic "maxSpillSlots ArchAlpha"
ArchMipseb -> panic "maxSpillSlots ArchMipseb"
diff --git a/compiler/GHC/CmmToAsm/Reg/Target.hs b/compiler/GHC/CmmToAsm/Reg/Target.hs
index c925816e24..99baaa50fb 100644
--- a/compiler/GHC/CmmToAsm/Reg/Target.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Target.hs
@@ -48,7 +48,7 @@ targetVirtualRegSqueeze platform
ArchSPARC64 -> panic "targetVirtualRegSqueeze ArchSPARC64"
ArchPPC_64 _ -> PPC.virtualRegSqueeze
ArchARM _ _ _ -> panic "targetVirtualRegSqueeze ArchARM"
- ArchARM64 -> panic "targetVirtualRegSqueeze ArchARM64"
+ ArchAArch64 -> panic "targetVirtualRegSqueeze ArchAArch64"
ArchAlpha -> panic "targetVirtualRegSqueeze ArchAlpha"
ArchMipseb -> panic "targetVirtualRegSqueeze ArchMipseb"
ArchMipsel -> panic "targetVirtualRegSqueeze ArchMipsel"
@@ -67,7 +67,7 @@ targetRealRegSqueeze platform
ArchSPARC64 -> panic "targetRealRegSqueeze ArchSPARC64"
ArchPPC_64 _ -> PPC.realRegSqueeze
ArchARM _ _ _ -> panic "targetRealRegSqueeze ArchARM"
- ArchARM64 -> panic "targetRealRegSqueeze ArchARM64"
+ ArchAArch64 -> panic "targetRealRegSqueeze ArchAArch64"
ArchAlpha -> panic "targetRealRegSqueeze ArchAlpha"
ArchMipseb -> panic "targetRealRegSqueeze ArchMipseb"
ArchMipsel -> panic "targetRealRegSqueeze ArchMipsel"
@@ -85,7 +85,7 @@ targetClassOfRealReg platform
ArchSPARC64 -> panic "targetClassOfRealReg ArchSPARC64"
ArchPPC_64 _ -> PPC.classOfRealReg
ArchARM _ _ _ -> panic "targetClassOfRealReg ArchARM"
- ArchARM64 -> panic "targetClassOfRealReg ArchARM64"
+ ArchAArch64 -> panic "targetClassOfRealReg ArchAArch64"
ArchAlpha -> panic "targetClassOfRealReg ArchAlpha"
ArchMipseb -> panic "targetClassOfRealReg ArchMipseb"
ArchMipsel -> panic "targetClassOfRealReg ArchMipsel"
@@ -103,7 +103,7 @@ targetMkVirtualReg platform
ArchSPARC64 -> panic "targetMkVirtualReg ArchSPARC64"
ArchPPC_64 _ -> PPC.mkVirtualReg
ArchARM _ _ _ -> panic "targetMkVirtualReg ArchARM"
- ArchARM64 -> panic "targetMkVirtualReg ArchARM64"
+ ArchAArch64 -> panic "targetMkVirtualReg ArchAArch64"
ArchAlpha -> panic "targetMkVirtualReg ArchAlpha"
ArchMipseb -> panic "targetMkVirtualReg ArchMipseb"
ArchMipsel -> panic "targetMkVirtualReg ArchMipsel"
@@ -121,7 +121,7 @@ targetRegDotColor platform
ArchSPARC64 -> panic "targetRegDotColor ArchSPARC64"
ArchPPC_64 _ -> PPC.regDotColor
ArchARM _ _ _ -> panic "targetRegDotColor ArchARM"
- ArchARM64 -> panic "targetRegDotColor ArchARM64"
+ ArchAArch64 -> panic "targetRegDotColor ArchAArch64"
ArchAlpha -> panic "targetRegDotColor ArchAlpha"
ArchMipseb -> panic "targetRegDotColor ArchMipseb"
ArchMipsel -> panic "targetRegDotColor ArchMipsel"
diff --git a/compiler/GHC/CmmToC.hs b/compiler/GHC/CmmToC.hs
index 0da229130b..d1f722febd 100644
--- a/compiler/GHC/CmmToC.hs
+++ b/compiler/GHC/CmmToC.hs
@@ -1158,7 +1158,7 @@ cLoad platform expr rep
bewareLoadStoreAlignment ArchMipseb = True
bewareLoadStoreAlignment ArchMipsel = True
bewareLoadStoreAlignment (ArchARM {}) = True
- bewareLoadStoreAlignment ArchARM64 = True
+ bewareLoadStoreAlignment ArchAArch64 = True
bewareLoadStoreAlignment ArchSPARC = True
bewareLoadStoreAlignment ArchSPARC64 = True
-- Pessimistically assume that they will also cause problems
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 80edddb828..687c6e1598 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -3842,8 +3842,8 @@ default_PIC platform =
-- This requires PIC on AArch64, and ExternalDynamicRefs on Linux as on top
-- of that. Subsequently we expect all code on aarch64/linux (and macOS) to
-- be built with -fPIC.
- (OSDarwin, ArchARM64) -> [Opt_PIC]
- (OSLinux, ArchARM64) -> [Opt_PIC, Opt_ExternalDynamicRefs]
+ (OSDarwin, ArchAArch64) -> [Opt_PIC]
+ (OSLinux, ArchAArch64) -> [Opt_PIC, Opt_ExternalDynamicRefs]
(OSOpenBSD, ArchX86_64) -> [Opt_PIC] -- Due to PIE support in
-- OpenBSD since 5.3 release
-- (1 May 2013) we need to
diff --git a/compiler/GHC/Linker/Dynamic.hs b/compiler/GHC/Linker/Dynamic.hs
index e1e669ed0d..497f51ec41 100644
--- a/compiler/GHC/Linker/Dynamic.hs
+++ b/compiler/GHC/Linker/Dynamic.hs
@@ -179,7 +179,7 @@ linkDynLib dflags0 o_files dep_packages
++ [ Option "-undefined",
Option "dynamic_lookup",
Option "-single_module" ]
- ++ (if platformArch platform == ArchX86_64
+ ++ (if platformArch platform `elem` [ ArchX86_64, ArchAArch64 ]
then [ ]
else [ Option "-Wl,-read_only_relocs,suppress" ])
++ [ Option "-install_name", Option instName ]
diff --git a/compiler/GHC/Linker/Static.hs b/compiler/GHC/Linker/Static.hs
index 3074c28864..9d0862e3f3 100644
--- a/compiler/GHC/Linker/Static.hs
+++ b/compiler/GHC/Linker/Static.hs
@@ -225,9 +225,9 @@ linkBinary' staticLink dflags o_files dep_units = do
(platformOS platform == OSDarwin) &&
case platformArch platform of
ArchX86 -> True
- ArchX86_64 -> True
- ArchARM {} -> True
- ArchARM64 -> True
+ ArchX86_64 -> True
+ ArchARM {} -> True
+ ArchAArch64 -> True
_ -> False
then ["-Wl,-no_compact_unwind"]
else [])
@@ -339,4 +339,3 @@ exeFileName platform staticLink output_fn
else "a.out"
where s <?.> ext | null (takeExtension s) = s <.> ext
| otherwise = s
-
diff --git a/compiler/GHC/Platform.hs b/compiler/GHC/Platform.hs
index 09c6ef37aa..858d5a4101 100644
--- a/compiler/GHC/Platform.hs
+++ b/compiler/GHC/Platform.hs
@@ -109,7 +109,7 @@ platformOS platform = case platformArchOS platform of
isARM :: Arch -> Bool
isARM (ArchARM {}) = True
-isARM ArchARM64 = True
+isARM ArchAArch64 = True
isARM _ = False
-- | This predicate tells us whether the platform is 32-bit.
@@ -232,4 +232,3 @@ platformSOExt platform
OSDarwin -> "dylib"
OSMinGW32 -> "dll"
_ -> "so"
-
diff --git a/compiler/GHC/Platform/ARM64.hs b/compiler/GHC/Platform/AArch64.hs
index 5bc1ec91e2..4e6a6bc230 100644
--- a/compiler/GHC/Platform/ARM64.hs
+++ b/compiler/GHC/Platform/AArch64.hs
@@ -1,10 +1,9 @@
{-# LANGUAGE CPP #-}
-module GHC.Platform.ARM64 where
+module GHC.Platform.AArch64 where
import GHC.Prelude
#define MACHREGS_NO_REGS 0
#define MACHREGS_aarch64 1
#include "../../../includes/CodeGen.Platform.hs"
-
diff --git a/compiler/GHC/Platform/Regs.hs b/compiler/GHC/Platform/Regs.hs
index 1b72d07979..1bf21370c7 100644
--- a/compiler/GHC/Platform/Regs.hs
+++ b/compiler/GHC/Platform/Regs.hs
@@ -1,4 +1,3 @@
-
module GHC.Platform.Regs
(callerSaves, activeStgRegs, haveRegBase, globalRegMaybe, freeReg)
where
@@ -10,7 +9,7 @@ import GHC.Platform
import GHC.Platform.Reg
import qualified GHC.Platform.ARM as ARM
-import qualified GHC.Platform.ARM64 as ARM64
+import qualified GHC.Platform.AArch64 as AArch64
import qualified GHC.Platform.PPC as PPC
import qualified GHC.Platform.S390X as S390X
import qualified GHC.Platform.SPARC as SPARC
@@ -26,12 +25,12 @@ callerSaves platform
| platformUnregisterised platform = NoRegs.callerSaves
| otherwise
= case platformArch platform of
- ArchX86 -> X86.callerSaves
- ArchX86_64 -> X86_64.callerSaves
- ArchS390X -> S390X.callerSaves
- ArchSPARC -> SPARC.callerSaves
- ArchARM {} -> ARM.callerSaves
- ArchARM64 -> ARM64.callerSaves
+ ArchX86 -> X86.callerSaves
+ ArchX86_64 -> X86_64.callerSaves
+ ArchS390X -> S390X.callerSaves
+ ArchSPARC -> SPARC.callerSaves
+ ArchARM {} -> ARM.callerSaves
+ ArchAArch64 -> AArch64.callerSaves
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.callerSaves
@@ -48,12 +47,12 @@ activeStgRegs platform
| platformUnregisterised platform = NoRegs.activeStgRegs
| otherwise
= case platformArch platform of
- ArchX86 -> X86.activeStgRegs
- ArchX86_64 -> X86_64.activeStgRegs
- ArchS390X -> S390X.activeStgRegs
- ArchSPARC -> SPARC.activeStgRegs
- ArchARM {} -> ARM.activeStgRegs
- ArchARM64 -> ARM64.activeStgRegs
+ ArchX86 -> X86.activeStgRegs
+ ArchX86_64 -> X86_64.activeStgRegs
+ ArchS390X -> S390X.activeStgRegs
+ ArchSPARC -> SPARC.activeStgRegs
+ ArchARM {} -> ARM.activeStgRegs
+ ArchAArch64 -> AArch64.activeStgRegs
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.activeStgRegs
@@ -65,12 +64,12 @@ haveRegBase platform
| platformUnregisterised platform = NoRegs.haveRegBase
| otherwise
= case platformArch platform of
- ArchX86 -> X86.haveRegBase
- ArchX86_64 -> X86_64.haveRegBase
- ArchS390X -> S390X.haveRegBase
- ArchSPARC -> SPARC.haveRegBase
- ArchARM {} -> ARM.haveRegBase
- ArchARM64 -> ARM64.haveRegBase
+ ArchX86 -> X86.haveRegBase
+ ArchX86_64 -> X86_64.haveRegBase
+ ArchS390X -> S390X.haveRegBase
+ ArchSPARC -> SPARC.haveRegBase
+ ArchARM {} -> ARM.haveRegBase
+ ArchAArch64 -> AArch64.haveRegBase
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.haveRegBase
@@ -82,12 +81,12 @@ globalRegMaybe platform
| platformUnregisterised platform = NoRegs.globalRegMaybe
| otherwise
= case platformArch platform of
- ArchX86 -> X86.globalRegMaybe
- ArchX86_64 -> X86_64.globalRegMaybe
- ArchS390X -> S390X.globalRegMaybe
- ArchSPARC -> SPARC.globalRegMaybe
- ArchARM {} -> ARM.globalRegMaybe
- ArchARM64 -> ARM64.globalRegMaybe
+ ArchX86 -> X86.globalRegMaybe
+ ArchX86_64 -> X86_64.globalRegMaybe
+ ArchS390X -> S390X.globalRegMaybe
+ ArchSPARC -> SPARC.globalRegMaybe
+ ArchARM {} -> ARM.globalRegMaybe
+ ArchAArch64 -> AArch64.globalRegMaybe
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.globalRegMaybe
@@ -99,15 +98,14 @@ freeReg platform
| platformUnregisterised platform = NoRegs.freeReg
| otherwise
= case platformArch platform of
- ArchX86 -> X86.freeReg
- ArchX86_64 -> X86_64.freeReg
- ArchS390X -> S390X.freeReg
- ArchSPARC -> SPARC.freeReg
- ArchARM {} -> ARM.freeReg
- ArchARM64 -> ARM64.freeReg
+ ArchX86 -> X86.freeReg
+ ArchX86_64 -> X86_64.freeReg
+ ArchS390X -> S390X.freeReg
+ ArchSPARC -> SPARC.freeReg
+ ArchARM {} -> ARM.freeReg
+ ArchAArch64 -> AArch64.freeReg
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.freeReg
| otherwise -> NoRegs.freeReg
-
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 98335da373..0a333ba1dc 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -478,7 +478,7 @@ Library
GHC.Parser.Types
GHC.Platform
GHC.Platform.ARM
- GHC.Platform.ARM64
+ GHC.Platform.AArch64
GHC.Platform.Constants
GHC.Platform.NoRegs
GHC.Platform.PPC