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
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- | Native code generator for x86 and x86-64 architectures
module GHC.CmmToAsm.X86
( ncgX86_64
, ncgX86
)
where
import GHC.Prelude
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Monad
import GHC.CmmToAsm.Config
import GHC.CmmToAsm.Types
import GHC.Types.Basic (Alignment)
import qualified GHC.CmmToAsm.X86.Instr as X86
import qualified GHC.CmmToAsm.X86.Ppr as X86
import qualified GHC.CmmToAsm.X86.CodeGen as X86
import qualified GHC.CmmToAsm.X86.Regs as X86
ncgX86 :: NCGConfig -> NcgImpl (Alignment, RawCmmStatics) X86.Instr X86.JumpDest
ncgX86 = ncgX86_64
ncgX86_64 :: NCGConfig -> NcgImpl (Alignment, RawCmmStatics) X86.Instr X86.JumpDest
ncgX86_64 config = NcgImpl
{ ncgConfig = config
, cmmTopCodeGen = X86.cmmTopCodeGen
, generateJumpTableForInstr = X86.generateJumpTableForInstr config
, getJumpDestBlockId = X86.getJumpDestBlockId
, canShortcut = X86.canShortcut
, shortcutStatics = X86.shortcutStatics
, shortcutJump = X86.shortcutJump
, pprNatCmmDecl = X86.pprNatCmmDecl config
, maxSpillSlots = X86.maxSpillSlots config
, allocatableRegs = X86.allocatableRegs platform
, ncgAllocMoreStack = X86.allocMoreStack platform
, ncgMakeFarBranches = const id
, extractUnwindPoints = X86.extractUnwindPoints
, invertCondBranches = X86.invertCondBranches
}
where
platform = ncgPlatform config
-- | Instruction instance for x86 instruction set.
instance Instruction X86.Instr where
regUsageOfInstr = X86.regUsageOfInstr
patchRegsOfInstr = X86.patchRegsOfInstr
isJumpishInstr = X86.isJumpishInstr
jumpDestsOfInstr = X86.jumpDestsOfInstr
patchJumpInstr = X86.patchJumpInstr
mkSpillInstr = X86.mkSpillInstr
mkLoadInstr = X86.mkLoadInstr
takeDeltaInstr = X86.takeDeltaInstr
isMetaInstr = X86.isMetaInstr
mkRegRegMoveInstr = X86.mkRegRegMoveInstr
takeRegRegMoveInstr = X86.takeRegRegMoveInstr
mkJumpInstr = X86.mkJumpInstr
mkStackAllocInstr = X86.mkStackAllocInstr
mkStackDeallocInstr = X86.mkStackDeallocInstr
pprInstr = X86.pprInstr
mkComment = pure . X86.COMMENT
|