summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToAsm/PPC.hs
blob: 148fd1b4b25c676e426f530d5092487a3860bd5d (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 PPC architectures
module GHC.CmmToAsm.PPC
   ( ncgPPC
   )
where

import GHC.Prelude

import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Monad
import GHC.CmmToAsm.Config
import GHC.CmmToAsm.Types

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

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

-- | Instruction instance for powerpc
instance Instruction PPC.Instr where
   regUsageOfInstr     = PPC.regUsageOfInstr
   patchRegsOfInstr    = PPC.patchRegsOfInstr
   isJumpishInstr      = PPC.isJumpishInstr
   jumpDestsOfInstr    = PPC.jumpDestsOfInstr
   patchJumpInstr      = PPC.patchJumpInstr
   mkSpillInstr        = PPC.mkSpillInstr
   mkLoadInstr         = PPC.mkLoadInstr
   takeDeltaInstr      = PPC.takeDeltaInstr
   isMetaInstr         = PPC.isMetaInstr
   mkRegRegMoveInstr _ = PPC.mkRegRegMoveInstr
   takeRegRegMoveInstr = PPC.takeRegRegMoveInstr
   mkJumpInstr         = PPC.mkJumpInstr
   mkStackAllocInstr   = PPC.mkStackAllocInstr
   mkStackDeallocInstr = PPC.mkStackDeallocInstr
   pprInstr            = PPC.pprInstr