Chris Lattner | d92fb00 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 1 | //===-- X86.h - Top-level interface for X86 representation ------*- C++ -*-===// |
Misha Brukman | c88330a | 2005-04-21 23:38:14 +0000 | [diff] [blame] | 2 | // |
John Criswell | 29265fe | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | c88330a | 2005-04-21 23:38:14 +0000 | [diff] [blame] | 7 | // |
John Criswell | 29265fe | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | d92fb00 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 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 | // |
Chris Lattner | d92fb00 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_X86_X86_H |
| 16 | #define LLVM_LIB_TARGET_X86_X86_H |
Chris Lattner | d92fb00 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 17 | |
Craig Topper | c6d4efa | 2014-03-19 06:53:25 +0000 | [diff] [blame] | 18 | #include "llvm/Support/CodeGen.h" |
Bill Wendling | 026e5d7 | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 19 | |
Brian Gaeke | 960707c | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 20 | namespace llvm { |
| 21 | |
Brian Gaeke | 1a6f2b8 | 2003-08-13 18:15:29 +0000 | [diff] [blame] | 22 | class FunctionPass; |
Craig Topper | c6d4efa | 2014-03-19 06:53:25 +0000 | [diff] [blame] | 23 | class ImmutablePass; |
Daniel Sanders | 0b5293f | 2017-04-06 09:49:34 +0000 | [diff] [blame] | 24 | class InstructionSelector; |
Ahmed Bougacha | 068ac4a | 2016-05-07 01:11:10 +0000 | [diff] [blame] | 25 | class PassRegistry; |
Daniel Sanders | 0b5293f | 2017-04-06 09:49:34 +0000 | [diff] [blame] | 26 | class X86RegisterBankInfo; |
| 27 | class X86Subtarget; |
Daniel Dunbar | 40eb7f0 | 2010-02-21 21:54:14 +0000 | [diff] [blame] | 28 | class X86TargetMachine; |
Chris Lattner | d92fb00 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 29 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 30 | /// This pass converts a legalized DAG into a X86-specific DAG, ready for |
| 31 | /// instruction scheduling. |
Bruno Cardoso Lopes | 9fd794b | 2009-06-01 19:57:37 +0000 | [diff] [blame] | 32 | FunctionPass *createX86ISelDag(X86TargetMachine &TM, |
| 33 | CodeGenOpt::Level OptLevel); |
Chris Lattner | ff9e21c | 2005-01-07 07:48:33 +0000 | [diff] [blame] | 34 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 35 | /// This pass initializes a global base register for PIC on x86-32. |
Andrey Turetskiy | fed110f | 2016-01-12 13:34:11 +0000 | [diff] [blame] | 36 | FunctionPass *createX86GlobalBaseRegPass(); |
Dan Gohman | d7b5ce3 | 2010-07-10 09:00:22 +0000 | [diff] [blame] | 37 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 38 | /// This pass combines multiple accesses to local-dynamic TLS variables so that |
| 39 | /// the TLS base address for the module is only fetched once per execution path |
| 40 | /// through the function. |
Hans Wennborg | 789acfb | 2012-06-01 16:27:21 +0000 | [diff] [blame] | 41 | FunctionPass *createCleanupLocalDynamicTLSPass(); |
| 42 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 43 | /// This function returns a pass which converts floating-point register |
| 44 | /// references and pseudo instructions into floating-point stack references and |
| 45 | /// physical instructions. |
Brian Gaeke | 1a6f2b8 | 2003-08-13 18:15:29 +0000 | [diff] [blame] | 46 | FunctionPass *createX86FloatingPointStackifierPass(); |
Chris Lattner | 02a3d83 | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 47 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 48 | /// This pass inserts AVX vzeroupper instructions before each call to avoid |
| 49 | /// transition penalty between functions encoded with AVX and SSE. |
Bruno Cardoso Lopes | 2a3ffb5 | 2011-08-23 01:14:17 +0000 | [diff] [blame] | 50 | FunctionPass *createX86IssueVZeroUpperPass(); |
| 51 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 52 | /// Return a pass that pads short functions with NOOPs. |
| 53 | /// This will prevent a stall when returning on the Atom. |
Preston Gurd | a01daac | 2013-01-08 18:27:24 +0000 | [diff] [blame] | 54 | FunctionPass *createX86PadShortFunctions(); |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 55 | |
Andrey Turetskiy | fed110f | 2016-01-12 13:34:11 +0000 | [diff] [blame] | 56 | /// Return a pass that selectively replaces certain instructions (like add, |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 57 | /// sub, inc, dec, some shifts, and some multiplies) by equivalent LEA |
| 58 | /// instructions, in order to eliminate execution delays in some processors. |
Preston Gurd | 8b7ab4b | 2013-04-25 20:29:37 +0000 | [diff] [blame] | 59 | FunctionPass *createX86FixupLEAs(); |
Preston Gurd | a01daac | 2013-01-08 18:27:24 +0000 | [diff] [blame] | 60 | |
Andrey Turetskiy | 1ce2c99 | 2016-01-13 11:30:44 +0000 | [diff] [blame] | 61 | /// Return a pass that removes redundant LEA instructions and redundant address |
| 62 | /// recalculations. |
Alexey Bataev | 7cf3247 | 2015-12-04 10:53:15 +0000 | [diff] [blame] | 63 | FunctionPass *createX86OptimizeLEAs(); |
| 64 | |
Michael Kuperstein | 3e3652a | 2016-07-07 22:50:23 +0000 | [diff] [blame] | 65 | /// Return a pass that transforms setcc + movzx pairs into xor + setcc. |
| 66 | FunctionPass *createX86FixupSetCC(); |
| 67 | |
Hans Wennborg | 8eb336c | 2016-05-18 16:10:17 +0000 | [diff] [blame] | 68 | /// Return a pass that expands WinAlloca pseudo-instructions. |
| 69 | FunctionPass *createX86WinAllocaExpander(); |
| 70 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 71 | /// Return a pass that optimizes the code-size of x86 call sequences. This is |
| 72 | /// done by replacing esp-relative movs with pushes. |
Michael Kuperstein | 13fbd45 | 2015-02-01 16:56:04 +0000 | [diff] [blame] | 73 | FunctionPass *createX86CallFrameOptimization(); |
| 74 | |
Sanjay Patel | a6bdd70 | 2015-12-07 19:31:34 +0000 | [diff] [blame] | 75 | /// Return an IR pass that inserts EH registration stack objects and explicit |
| 76 | /// EH state updates. This pass must run after EH preparation, which does |
| 77 | /// Windows-specific but architecture-neutral preparation. |
Reid Kleckner | 0738a9c | 2015-05-05 17:44:16 +0000 | [diff] [blame] | 78 | FunctionPass *createX86WinEHStatePass(); |
| 79 | |
Quentin Colombet | 494eb60 | 2015-05-22 18:10:47 +0000 | [diff] [blame] | 80 | /// Return a Machine IR pass that expands X86-specific pseudo |
| 81 | /// instructions into a sequence of actual instructions. This pass |
| 82 | /// must run after prologue/epilogue insertion and before lowering |
| 83 | /// the MachineInstr to MC. |
| 84 | FunctionPass *createX86ExpandPseudoPass(); |
Kevin B. Smith | 6a83350 | 2016-02-11 19:43:04 +0000 | [diff] [blame] | 85 | |
| 86 | /// Return a Machine IR pass that selectively replaces |
| 87 | /// certain byte and word instructions by equivalent 32 bit instructions, |
| 88 | /// in order to eliminate partial register usage, false dependences on |
| 89 | /// the upper portions of registers, and to save code size. |
| 90 | FunctionPass *createX86FixupBWInsts(); |
Ahmed Bougacha | 068ac4a | 2016-05-07 01:11:10 +0000 | [diff] [blame] | 91 | |
| 92 | void initializeFixupBWInstPassPass(PassRegistry &); |
Gadi Haber | 19c4fc5 | 2016-12-28 10:12:48 +0000 | [diff] [blame] | 93 | |
| 94 | /// This pass replaces EVEX ecnoded of AVX-512 instructiosn by VEX |
| 95 | /// encoding when possible in order to reduce code size. |
| 96 | FunctionPass *createX86EvexToVexInsts(); |
| 97 | |
Daniel Sanders | e7b0d66 | 2017-04-21 15:59:56 +0000 | [diff] [blame] | 98 | InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM, |
| 99 | X86Subtarget &, |
Daniel Sanders | 0b5293f | 2017-04-06 09:49:34 +0000 | [diff] [blame] | 100 | X86RegisterBankInfo &); |
| 101 | |
Gadi Haber | 19c4fc5 | 2016-12-28 10:12:48 +0000 | [diff] [blame] | 102 | void initializeEvexToVexInstPassPass(PassRegistry &); |
| 103 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 104 | } // End llvm namespace |
Chris Lattner | ff9e21c | 2005-01-07 07:48:33 +0000 | [diff] [blame] | 105 | |
Chris Lattner | d92fb00 | 2002-10-25 22:55:53 +0000 | [diff] [blame] | 106 | #endif |