never executed always true always false
1 {-# OPTIONS_GHC -fno-warn-orphans #-}
2
3 -- | Native code generator for x86 and x86-64 architectures
4 module GHC.CmmToAsm.X86
5 ( ncgX86_64
6 , ncgX86
7 )
8 where
9
10 import GHC.Prelude
11
12 import GHC.CmmToAsm.Instr
13 import GHC.CmmToAsm.Monad
14 import GHC.CmmToAsm.Config
15 import GHC.CmmToAsm.Types
16 import GHC.Types.Basic (Alignment)
17
18 import qualified GHC.CmmToAsm.X86.Instr as X86
19 import qualified GHC.CmmToAsm.X86.Ppr as X86
20 import qualified GHC.CmmToAsm.X86.CodeGen as X86
21 import qualified GHC.CmmToAsm.X86.Regs as X86
22
23 ncgX86 :: NCGConfig -> NcgImpl (Alignment, RawCmmStatics) X86.Instr X86.JumpDest
24 ncgX86 = ncgX86_64
25
26
27 ncgX86_64 :: NCGConfig -> NcgImpl (Alignment, RawCmmStatics) X86.Instr X86.JumpDest
28 ncgX86_64 config = NcgImpl
29 { ncgConfig = config
30 , cmmTopCodeGen = X86.cmmTopCodeGen
31 , generateJumpTableForInstr = X86.generateJumpTableForInstr config
32 , getJumpDestBlockId = X86.getJumpDestBlockId
33 , canShortcut = X86.canShortcut
34 , shortcutStatics = X86.shortcutStatics
35 , shortcutJump = X86.shortcutJump
36 , pprNatCmmDecl = X86.pprNatCmmDecl config
37 , maxSpillSlots = X86.maxSpillSlots config
38 , allocatableRegs = X86.allocatableRegs platform
39 , ncgAllocMoreStack = X86.allocMoreStack platform
40 , ncgExpandTop = id
41 , ncgMakeFarBranches = const id
42 , extractUnwindPoints = X86.extractUnwindPoints
43 , invertCondBranches = X86.invertCondBranches
44 }
45 where
46 platform = ncgPlatform config
47
48 -- | Instruction instance for x86 instruction set.
49 instance Instruction X86.Instr where
50 regUsageOfInstr = X86.regUsageOfInstr
51 patchRegsOfInstr = X86.patchRegsOfInstr
52 isJumpishInstr = X86.isJumpishInstr
53 jumpDestsOfInstr = X86.jumpDestsOfInstr
54 patchJumpInstr = X86.patchJumpInstr
55 mkSpillInstr = X86.mkSpillInstr
56 mkLoadInstr = X86.mkLoadInstr
57 takeDeltaInstr = X86.takeDeltaInstr
58 isMetaInstr = X86.isMetaInstr
59 mkRegRegMoveInstr = X86.mkRegRegMoveInstr
60 takeRegRegMoveInstr = X86.takeRegRegMoveInstr
61 mkJumpInstr = X86.mkJumpInstr
62 mkStackAllocInstr = X86.mkStackAllocInstr
63 mkStackDeallocInstr = X86.mkStackDeallocInstr
64 pprInstr = X86.pprInstr
65 mkComment = pure . X86.COMMENT