X86.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. //===-- X86.h - Top-level interface for X86 representation ------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file contains the entry points for global functions defined in the x86
  10. // target library, as used by the LLVM JIT.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_LIB_TARGET_X86_X86_H
  14. #define LLVM_LIB_TARGET_X86_X86_H
  15. #include "llvm/Support/CodeGen.h"
  16. namespace llvm {
  17. class FunctionPass;
  18. class InstructionSelector;
  19. class PassRegistry;
  20. class X86RegisterBankInfo;
  21. class X86Subtarget;
  22. class X86TargetMachine;
  23. /// This pass converts a legalized DAG into a X86-specific DAG, ready for
  24. /// instruction scheduling.
  25. FunctionPass *createX86ISelDag(X86TargetMachine &TM,
  26. CodeGenOpt::Level OptLevel);
  27. /// This pass initializes a global base register for PIC on x86-32.
  28. FunctionPass *createX86GlobalBaseRegPass();
  29. /// This pass combines multiple accesses to local-dynamic TLS variables so that
  30. /// the TLS base address for the module is only fetched once per execution path
  31. /// through the function.
  32. FunctionPass *createCleanupLocalDynamicTLSPass();
  33. /// This function returns a pass which converts floating-point register
  34. /// references and pseudo instructions into floating-point stack references and
  35. /// physical instructions.
  36. FunctionPass *createX86FloatingPointStackifierPass();
  37. /// This pass inserts AVX vzeroupper instructions before each call to avoid
  38. /// transition penalty between functions encoded with AVX and SSE.
  39. FunctionPass *createX86IssueVZeroUpperPass();
  40. /// This pass inserts ENDBR instructions before indirect jump/call
  41. /// destinations as part of CET IBT mechanism.
  42. FunctionPass *createX86IndirectBranchTrackingPass();
  43. /// Return a pass that pads short functions with NOOPs.
  44. /// This will prevent a stall when returning on the Atom.
  45. FunctionPass *createX86PadShortFunctions();
  46. /// Return a pass that selectively replaces certain instructions (like add,
  47. /// sub, inc, dec, some shifts, and some multiplies) by equivalent LEA
  48. /// instructions, in order to eliminate execution delays in some processors.
  49. FunctionPass *createX86FixupLEAs();
  50. /// Return a pass that removes redundant LEA instructions and redundant address
  51. /// recalculations.
  52. FunctionPass *createX86OptimizeLEAs();
  53. /// Return a pass that transforms setcc + movzx pairs into xor + setcc.
  54. FunctionPass *createX86FixupSetCC();
  55. /// Return a pass that avoids creating store forward block issues in the hardware.
  56. FunctionPass *createX86AvoidStoreForwardingBlocks();
  57. /// Return a pass that lowers EFLAGS copy pseudo instructions.
  58. FunctionPass *createX86FlagsCopyLoweringPass();
  59. /// Return a pass that expands DynAlloca pseudo-instructions.
  60. FunctionPass *createX86DynAllocaExpander();
  61. /// Return a pass that config the tile registers.
  62. FunctionPass *createX86TileConfigPass();
  63. /// Return a pass that config the tile registers after fast reg allocation.
  64. FunctionPass *createX86FastTileConfigPass();
  65. /// Return a pass that insert pseudo tile config instruction.
  66. FunctionPass *createX86PreTileConfigPass();
  67. /// Return a pass that lower the tile copy instruction.
  68. FunctionPass *createX86LowerTileCopyPass();
  69. /// Return a pass that inserts int3 at the end of the function if it ends with a
  70. /// CALL instruction. The pass does the same for each funclet as well. This
  71. /// ensures that the open interval of function start and end PCs contains all
  72. /// return addresses for the benefit of the Windows x64 unwinder.
  73. FunctionPass *createX86AvoidTrailingCallPass();
  74. /// Return a pass that optimizes the code-size of x86 call sequences. This is
  75. /// done by replacing esp-relative movs with pushes.
  76. FunctionPass *createX86CallFrameOptimization();
  77. /// Return an IR pass that inserts EH registration stack objects and explicit
  78. /// EH state updates. This pass must run after EH preparation, which does
  79. /// Windows-specific but architecture-neutral preparation.
  80. FunctionPass *createX86WinEHStatePass();
  81. /// Return a Machine IR pass that expands X86-specific pseudo
  82. /// instructions into a sequence of actual instructions. This pass
  83. /// must run after prologue/epilogue insertion and before lowering
  84. /// the MachineInstr to MC.
  85. FunctionPass *createX86ExpandPseudoPass();
  86. /// This pass converts X86 cmov instructions into branch when profitable.
  87. FunctionPass *createX86CmovConverterPass();
  88. /// Return a Machine IR pass that selectively replaces
  89. /// certain byte and word instructions by equivalent 32 bit instructions,
  90. /// in order to eliminate partial register usage, false dependences on
  91. /// the upper portions of registers, and to save code size.
  92. FunctionPass *createX86FixupBWInsts();
  93. /// Return a Machine IR pass that reassigns instruction chains from one domain
  94. /// to another, when profitable.
  95. FunctionPass *createX86DomainReassignmentPass();
  96. /// This pass replaces EVEX encoded of AVX-512 instructiosn by VEX
  97. /// encoding when possible in order to reduce code size.
  98. FunctionPass *createX86EvexToVexInsts();
  99. /// This pass creates the thunks for the retpoline feature.
  100. FunctionPass *createX86IndirectThunksPass();
  101. /// This pass ensures instructions featuring a memory operand
  102. /// have distinctive <LineNumber, Discriminator> (with respect to eachother)
  103. FunctionPass *createX86DiscriminateMemOpsPass();
  104. /// This pass applies profiling information to insert cache prefetches.
  105. FunctionPass *createX86InsertPrefetchPass();
  106. /// This pass insert wait instruction after X87 instructions which could raise
  107. /// fp exceptions when strict-fp enabled.
  108. FunctionPass *createX86InsertX87waitPass();
  109. /// This pass optimizes arithmetic based on knowledge that is only used by
  110. /// a reduction sequence and is therefore safe to reassociate in interesting
  111. /// ways.
  112. FunctionPass *createX86PartialReductionPass();
  113. InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM,
  114. X86Subtarget &,
  115. X86RegisterBankInfo &);
  116. FunctionPass *createX86LoadValueInjectionLoadHardeningPass();
  117. FunctionPass *createX86LoadValueInjectionRetHardeningPass();
  118. FunctionPass *createX86SpeculativeLoadHardeningPass();
  119. FunctionPass *createX86SpeculativeExecutionSideEffectSuppression();
  120. void initializeEvexToVexInstPassPass(PassRegistry &);
  121. void initializeFixupBWInstPassPass(PassRegistry &);
  122. void initializeFixupLEAPassPass(PassRegistry &);
  123. void initializeFPSPass(PassRegistry &);
  124. void initializeWinEHStatePassPass(PassRegistry &);
  125. void initializeX86AvoidSFBPassPass(PassRegistry &);
  126. void initializeX86AvoidTrailingCallPassPass(PassRegistry &);
  127. void initializeX86CallFrameOptimizationPass(PassRegistry &);
  128. void initializeX86CmovConverterPassPass(PassRegistry &);
  129. void initializeX86DomainReassignmentPass(PassRegistry &);
  130. void initializeX86ExecutionDomainFixPass(PassRegistry &);
  131. void initializeX86ExpandPseudoPass(PassRegistry &);
  132. void initializeX86FixupSetCCPassPass(PassRegistry &);
  133. void initializeX86FlagsCopyLoweringPassPass(PassRegistry &);
  134. void initializeX86LoadValueInjectionLoadHardeningPassPass(PassRegistry &);
  135. void initializeX86LoadValueInjectionRetHardeningPassPass(PassRegistry &);
  136. void initializeX86OptimizeLEAPassPass(PassRegistry &);
  137. void initializeX86PartialReductionPass(PassRegistry &);
  138. void initializeX86SpeculativeLoadHardeningPassPass(PassRegistry &);
  139. void initializeX86SpeculativeExecutionSideEffectSuppressionPass(PassRegistry &);
  140. void initializeX86PreTileConfigPass(PassRegistry &);
  141. void initializeX86FastTileConfigPass(PassRegistry &);
  142. void initializeX86TileConfigPass(PassRegistry &);
  143. void initializeX86LowerAMXTypeLegacyPassPass(PassRegistry &);
  144. void initializeX86PreAMXConfigPassPass(PassRegistry &);
  145. void initializeX86LowerTileCopyPass(PassRegistry &);
  146. void initializeX86LowerAMXIntrinsicsLegacyPassPass(PassRegistry &);
  147. namespace X86AS {
  148. enum : unsigned {
  149. GS = 256,
  150. FS = 257,
  151. SS = 258,
  152. PTR32_SPTR = 270,
  153. PTR32_UPTR = 271,
  154. PTR64 = 272
  155. };
  156. } // End X86AS namespace
  157. } // End llvm namespace
  158. #endif