LLVM  8.0.1
X86.h
Go to the documentation of this file.
1 //===-- X86.h - Top-level interface for X86 representation ------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the entry points for global functions defined in the x86
11 // target library, as used by the LLVM JIT.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_X86_X86_H
16 #define LLVM_LIB_TARGET_X86_X86_H
17 
18 #include "llvm/Support/CodeGen.h"
19 
20 namespace llvm {
21 
22 class FunctionPass;
23 class ImmutablePass;
24 class InstructionSelector;
25 class ModulePass;
26 class PassRegistry;
27 class X86RegisterBankInfo;
28 class X86Subtarget;
29 class X86TargetMachine;
30 
31 /// This pass converts a legalized DAG into a X86-specific DAG, ready for
32 /// instruction scheduling.
33 FunctionPass *createX86ISelDag(X86TargetMachine &TM,
34  CodeGenOpt::Level OptLevel);
35 
36 /// This pass initializes a global base register for PIC on x86-32.
37 FunctionPass *createX86GlobalBaseRegPass();
38 
39 /// This pass combines multiple accesses to local-dynamic TLS variables so that
40 /// the TLS base address for the module is only fetched once per execution path
41 /// through the function.
42 FunctionPass *createCleanupLocalDynamicTLSPass();
43 
44 /// This function returns a pass which converts floating-point register
45 /// references and pseudo instructions into floating-point stack references and
46 /// physical instructions.
48 
49 /// This pass inserts AVX vzeroupper instructions before each call to avoid
50 /// transition penalty between functions encoded with AVX and SSE.
51 FunctionPass *createX86IssueVZeroUpperPass();
52 
53 /// This pass instruments the function prolog to save the return address to a
54 /// 'shadow call stack' and the function epilog to check that the return address
55 /// did not change during function execution.
56 FunctionPass *createShadowCallStackPass();
57 
58 /// This pass inserts ENDBR instructions before indirect jump/call
59 /// destinations as part of CET IBT mechanism.
61 
62 /// Return a pass that pads short functions with NOOPs.
63 /// This will prevent a stall when returning on the Atom.
64 FunctionPass *createX86PadShortFunctions();
65 
66 /// Return a pass that selectively replaces certain instructions (like add,
67 /// sub, inc, dec, some shifts, and some multiplies) by equivalent LEA
68 /// instructions, in order to eliminate execution delays in some processors.
69 FunctionPass *createX86FixupLEAs();
70 
71 /// Return a pass that removes redundant LEA instructions and redundant address
72 /// recalculations.
73 FunctionPass *createX86OptimizeLEAs();
74 
75 /// Return a pass that transforms setcc + movzx pairs into xor + setcc.
76 FunctionPass *createX86FixupSetCC();
77 
78 /// Return a pass that folds conditional branch jumps.
79 FunctionPass *createX86CondBrFolding();
80 
81 /// Return a pass that avoids creating store forward block issues in the hardware.
83 
84 /// Return a pass that lowers EFLAGS copy pseudo instructions.
85 FunctionPass *createX86FlagsCopyLoweringPass();
86 
87 /// Return a pass that expands WinAlloca pseudo-instructions.
88 FunctionPass *createX86WinAllocaExpander();
89 
90 /// Return a pass that optimizes the code-size of x86 call sequences. This is
91 /// done by replacing esp-relative movs with pushes.
92 FunctionPass *createX86CallFrameOptimization();
93 
94 /// Return an IR pass that inserts EH registration stack objects and explicit
95 /// EH state updates. This pass must run after EH preparation, which does
96 /// Windows-specific but architecture-neutral preparation.
97 FunctionPass *createX86WinEHStatePass();
98 
99 /// Return a Machine IR pass that expands X86-specific pseudo
100 /// instructions into a sequence of actual instructions. This pass
101 /// must run after prologue/epilogue insertion and before lowering
102 /// the MachineInstr to MC.
103 FunctionPass *createX86ExpandPseudoPass();
104 
105 /// This pass converts X86 cmov instructions into branch when profitable.
106 FunctionPass *createX86CmovConverterPass();
107 
108 /// Return a Machine IR pass that selectively replaces
109 /// certain byte and word instructions by equivalent 32 bit instructions,
110 /// in order to eliminate partial register usage, false dependences on
111 /// the upper portions of registers, and to save code size.
112 FunctionPass *createX86FixupBWInsts();
113 
114 /// Return a Machine IR pass that reassigns instruction chains from one domain
115 /// to another, when profitable.
116 FunctionPass *createX86DomainReassignmentPass();
117 
118 /// This pass replaces EVEX encoded of AVX-512 instructiosn by VEX
119 /// encoding when possible in order to reduce code size.
120 FunctionPass *createX86EvexToVexInsts();
121 
122 /// This pass creates the thunks for the retpoline feature.
123 FunctionPass *createX86RetpolineThunksPass();
124 
125 /// This pass ensures instructions featuring a memory operand
126 /// have distinctive <LineNumber, Discriminator> (with respect to eachother)
127 FunctionPass *createX86DiscriminateMemOpsPass();
128 
129 /// This pass applies profiling information to insert cache prefetches.
130 FunctionPass *createX86InsertPrefetchPass();
131 
132 InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM,
133  X86Subtarget &,
134  X86RegisterBankInfo &);
135 
137 
138 void initializeEvexToVexInstPassPass(PassRegistry &);
139 void initializeFixupBWInstPassPass(PassRegistry &);
140 void initializeFixupLEAPassPass(PassRegistry &);
141 void initializeShadowCallStackPass(PassRegistry &);
142 void initializeWinEHStatePassPass(PassRegistry &);
143 void initializeX86AvoidSFBPassPass(PassRegistry &);
144 void initializeX86CallFrameOptimizationPass(PassRegistry &);
145 void initializeX86CmovConverterPassPass(PassRegistry &);
146 void initializeX86CondBrFoldingPassPass(PassRegistry &);
147 void initializeX86DomainReassignmentPass(PassRegistry &);
148 void initializeX86ExecutionDomainFixPass(PassRegistry &);
149 void initializeX86FlagsCopyLoweringPassPass(PassRegistry &);
151 
152 } // End llvm namespace
153 
154 #endif
FunctionPass * createX86OptimizeLEAs()
Return a pass that removes redundant LEA instructions and redundant address recalculations.
FunctionPass * createX86FixupBWInsts()
Return a Machine IR pass that selectively replaces certain byte and word instructions by equivalent 3...
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void initializeFixupBWInstPassPass(PassRegistry &)
FunctionPass * createX86FixupSetCC()
Return a pass that transforms setcc + movzx pairs into xor + setcc.
FunctionPass * createX86CallFrameOptimization()
Return a pass that optimizes the code-size of x86 call sequences.
void initializeX86CallFrameOptimizationPass(PassRegistry &)
FunctionPass * createX86IssueVZeroUpperPass()
This pass inserts AVX vzeroupper instructions before each call to avoid transition penalty between fu...
FunctionPass * createX86EvexToVexInsts()
This pass replaces EVEX encoded of AVX-512 instructiosn by VEX encoding when possible in order to red...
FunctionPass * createShadowCallStackPass()
This pass instruments the function prolog to save the return address to a &#39;shadow call stack&#39; and the...
FunctionPass * createX86DomainReassignmentPass()
Return a Machine IR pass that reassigns instruction chains from one domain to another, when profitable.
void initializeX86CmovConverterPassPass(PassRegistry &)
FunctionPass * createX86PadShortFunctions()
Return a pass that pads short functions with NOOPs.
void initializeX86AvoidSFBPassPass(PassRegistry &)
void initializeX86CondBrFoldingPassPass(PassRegistry &)
void initializeEvexToVexInstPassPass(PassRegistry &)
FunctionPass * createX86FixupLEAs()
Return a pass that selectively replaces certain instructions (like add, sub, inc, dec...
void initializeX86ExecutionDomainFixPass(PassRegistry &)
FunctionPass * createX86ExpandPseudoPass()
Return a Machine IR pass that expands X86-specific pseudo instructions into a sequence of actual inst...
FunctionPass * createX86GlobalBaseRegPass()
This pass initializes a global base register for PIC on x86-32.
void initializeFixupLEAPassPass(PassRegistry &)
void initializeX86DomainReassignmentPass(PassRegistry &)
FunctionPass * createX86CmovConverterPass()
This pass converts X86 cmov instructions into branch when profitable.
FunctionPass * createX86IndirectBranchTrackingPass()
This pass inserts ENDBR instructions before indirect jump/call destinations as part of CET IBT mechan...
void initializeX86SpeculativeLoadHardeningPassPass(PassRegistry &)
FunctionPass * createX86FlagsCopyLoweringPass()
Return a pass that lowers EFLAGS copy pseudo instructions.
FunctionPass * createX86SpeculativeLoadHardeningPass()
InstructionSelector * createX86InstructionSelector(const X86TargetMachine &TM, X86Subtarget &, X86RegisterBankInfo &)
FunctionPass * createX86FloatingPointStackifierPass()
This function returns a pass which converts floating-point register references and pseudo instruction...
FunctionPass * createX86WinAllocaExpander()
Return a pass that expands WinAlloca pseudo-instructions.
FunctionPass * createX86InsertPrefetchPass()
This pass applies profiling information to insert cache prefetches.
void initializeX86FlagsCopyLoweringPassPass(PassRegistry &)
FunctionPass * createX86ISelDag(X86TargetMachine &TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a X86-specific DAG, ready for instruction scheduling...
void initializeShadowCallStackPass(PassRegistry &)
FunctionPass * createX86CondBrFolding()
Return a pass that folds conditional branch jumps.
FunctionPass * createX86RetpolineThunksPass()
This pass creates the thunks for the retpoline feature.
void initializeWinEHStatePassPass(PassRegistry &)
FunctionPass * createX86AvoidStoreForwardingBlocks()
Return a pass that avoids creating store forward block issues in the hardware.
FunctionPass * createX86DiscriminateMemOpsPass()
This pass ensures instructions featuring a memory operand have distinctive <LineNumber, Discriminator> (with respect to eachother)
FunctionPass * createX86WinEHStatePass()
Return an IR pass that inserts EH registration stack objects and explicit EH state updates...
FunctionPass * createCleanupLocalDynamicTLSPass()
This pass combines multiple accesses to local-dynamic TLS variables so that the TLS base address for ...