summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToAsm/AArch64.hs
blob: d814764b2d54e2c8a6bae1b72581b235c76c2594 (plain)
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
{-# OPTIONS_GHC -fno-warn-orphans #-}

-- | Native code generator for AArch64 architectures
module GHC.CmmToAsm.AArch64
   ( ncgAArch64 )
where

import GHC.Prelude

import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Monad
import GHC.CmmToAsm.Config
import GHC.CmmToAsm.Types
import GHC.Utils.Outputable (ftext)

import qualified GHC.CmmToAsm.AArch64.Instr   as AArch64
import qualified GHC.CmmToAsm.AArch64.Ppr     as AArch64
import qualified GHC.CmmToAsm.AArch64.CodeGen as AArch64
import qualified GHC.CmmToAsm.AArch64.Regs    as AArch64
import qualified GHC.CmmToAsm.AArch64.RegInfo as AArch64

ncgAArch64 :: NCGConfig -> NcgImpl RawCmmStatics AArch64.Instr AArch64.JumpDest
ncgAArch64 config
 = NcgImpl {
        ncgConfig                 = config
       ,cmmTopCodeGen             = AArch64.cmmTopCodeGen
       ,generateJumpTableForInstr = AArch64.generateJumpTableForInstr config
       ,getJumpDestBlockId        = AArch64.getJumpDestBlockId
       ,canShortcut               = AArch64.canShortcut
       ,shortcutStatics           = AArch64.shortcutStatics
       ,shortcutJump              = AArch64.shortcutJump
       ,pprNatCmmDeclS            = AArch64.pprNatCmmDecl config
       ,pprNatCmmDeclH            = AArch64.pprNatCmmDecl config
       ,maxSpillSlots             = AArch64.maxSpillSlots config
       ,allocatableRegs           = AArch64.allocatableRegs platform
       ,ncgAllocMoreStack         = AArch64.allocMoreStack platform
       ,ncgMakeFarBranches        = const id
       ,extractUnwindPoints       = const []
       ,invertCondBranches        = \_ _ -> id
  }
    where
      platform = ncgPlatform config

-- | Instruction instance for aarch64
instance Instruction AArch64.Instr where
        regUsageOfInstr         = AArch64.regUsageOfInstr
        patchRegsOfInstr        = AArch64.patchRegsOfInstr
        isJumpishInstr          = AArch64.isJumpishInstr
        jumpDestsOfInstr        = AArch64.jumpDestsOfInstr
        patchJumpInstr          = AArch64.patchJumpInstr
        mkSpillInstr            = AArch64.mkSpillInstr
        mkLoadInstr             = AArch64.mkLoadInstr
        takeDeltaInstr          = AArch64.takeDeltaInstr
        isMetaInstr             = AArch64.isMetaInstr
        mkRegRegMoveInstr _     = AArch64.mkRegRegMoveInstr
        takeRegRegMoveInstr     = AArch64.takeRegRegMoveInstr
        mkJumpInstr             = AArch64.mkJumpInstr
        mkStackAllocInstr       = AArch64.mkStackAllocInstr
        mkStackDeallocInstr     = AArch64.mkStackDeallocInstr
        mkComment               = pure . AArch64.COMMENT . ftext
        pprInstr                = AArch64.pprInstr