Chris Lattner | 12e9730 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 1 | //===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===// |
Misha Brukman | b440243 | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 2 | // |
Misha Brukman | e05203f | 2004-06-21 16:55:25 +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 | b440243 | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 7 | // |
Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the entry points for global functions defined in the LLVM |
| 11 | // PowerPC back-end. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_POWERPC_PPC_H |
| 16 | #define LLVM_LIB_TARGET_POWERPC_PPC_H |
Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 17 | |
Evan Cheng | bc153d4 | 2011-07-14 20:59:42 +0000 | [diff] [blame] | 18 | #include "MCTargetDesc/PPCMCTargetDesc.h" |
Chris Lattner | aac9fa7 | 2010-11-15 08:49:58 +0000 | [diff] [blame] | 19 | #include <string> |
| 20 | |
Chris Lattner | 6be7260 | 2006-11-04 05:27:39 +0000 | [diff] [blame] | 21 | // GCC #defines PPC on Linux but we use it as our namespace name |
| 22 | #undef PPC |
| 23 | |
Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 24 | namespace llvm { |
Chris Lattner | 6be7260 | 2006-11-04 05:27:39 +0000 | [diff] [blame] | 25 | class PPCTargetMachine; |
Hal Finkel | 174e590 | 2014-03-25 23:29:21 +0000 | [diff] [blame] | 26 | class PassRegistry; |
Chris Lattner | 6be7260 | 2006-11-04 05:27:39 +0000 | [diff] [blame] | 27 | class FunctionPass; |
Hal Finkel | 4e5ca9e | 2013-01-25 23:05:59 +0000 | [diff] [blame] | 28 | class ImmutablePass; |
Chris Lattner | 5c1b0cd | 2010-11-14 21:12:33 +0000 | [diff] [blame] | 29 | class MachineInstr; |
Chris Lattner | 5c1b0cd | 2010-11-14 21:12:33 +0000 | [diff] [blame] | 30 | class AsmPrinter; |
Chris Lattner | 9ec375c | 2010-11-15 04:16:32 +0000 | [diff] [blame] | 31 | class MCInst; |
Craig Topper | b25fda9 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 32 | |
Hal Finkel | 25c1992 | 2013-05-15 21:37:41 +0000 | [diff] [blame] | 33 | FunctionPass *createPPCCTRLoops(PPCTargetMachine &TM); |
Hal Finkel | 8ca3884 | 2013-05-20 16:08:17 +0000 | [diff] [blame] | 34 | #ifndef NDEBUG |
| 35 | FunctionPass *createPPCCTRLoopsVerify(); |
| 36 | #endif |
Hal Finkel | e5aaf3f | 2015-02-20 05:08:21 +0000 | [diff] [blame] | 37 | FunctionPass *createPPCLoopDataPrefetchPass(); |
Hal Finkel | c9dd020 | 2015-02-05 18:43:00 +0000 | [diff] [blame] | 38 | FunctionPass *createPPCLoopPreIncPrepPass(PPCTargetMachine &TM); |
Hal Finkel | 8340de1 | 2015-05-18 06:25:59 +0000 | [diff] [blame] | 39 | FunctionPass *createPPCTOCRegDepsPass(); |
Hal Finkel | b5aa7e5 | 2013-04-08 16:24:03 +0000 | [diff] [blame] | 40 | FunctionPass *createPPCEarlyReturnPass(); |
Hal Finkel | 27774d9 | 2014-03-13 07:58:58 +0000 | [diff] [blame] | 41 | FunctionPass *createPPCVSXCopyPass(); |
Hal Finkel | 174e590 | 2014-03-25 23:29:21 +0000 | [diff] [blame] | 42 | FunctionPass *createPPCVSXFMAMutatePass(); |
Bill Schmidt | fe723b9 | 2015-04-27 19:57:34 +0000 | [diff] [blame] | 43 | FunctionPass *createPPCVSXSwapRemovalPass(); |
Chris Lattner | dd6df84 | 2010-11-15 03:13:19 +0000 | [diff] [blame] | 44 | FunctionPass *createPPCBranchSelectionPass(); |
| 45 | FunctionPass *createPPCISelDag(PPCTargetMachine &TM); |
Bill Schmidt | 82f1c77 | 2015-02-10 19:09:05 +0000 | [diff] [blame] | 46 | FunctionPass *createPPCTLSDynamicCallPass(); |
Chris Lattner | dd6df84 | 2010-11-15 03:13:19 +0000 | [diff] [blame] | 47 | void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, |
Ulrich Weigand | 266db7f | 2013-07-08 20:20:51 +0000 | [diff] [blame] | 48 | AsmPrinter &AP, bool isDarwin); |
Hal Finkel | 4e5ca9e | 2013-01-25 23:05:59 +0000 | [diff] [blame] | 49 | |
Hal Finkel | 174e590 | 2014-03-25 23:29:21 +0000 | [diff] [blame] | 50 | void initializePPCVSXFMAMutatePass(PassRegistry&); |
| 51 | extern char &PPCVSXFMAMutateID; |
| 52 | |
Chris Lattner | df8e17d | 2010-11-14 23:42:06 +0000 | [diff] [blame] | 53 | namespace PPCII { |
| 54 | |
| 55 | /// Target Operand Flag enum. |
| 56 | enum TOF { |
| 57 | //===------------------------------------------------------------------===// |
| 58 | // PPC Specific MachineOperand flags. |
| 59 | MO_NO_FLAG, |
| 60 | |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 61 | /// MO_PLT_OR_STUB - On a symbol operand "FOO", this indicates that the |
| 62 | /// reference is actually to the "FOO$stub" or "FOO@plt" symbol. This is |
| 63 | /// used for calls and jumps to external functions on Tiger and earlier, and |
| 64 | /// for PIC calls on Linux and ELF systems. |
| 65 | MO_PLT_OR_STUB = 1, |
Chris Lattner | df8e17d | 2010-11-14 23:42:06 +0000 | [diff] [blame] | 66 | |
Chris Lattner | dd6df84 | 2010-11-15 03:13:19 +0000 | [diff] [blame] | 67 | /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to |
| 68 | /// the function's picbase, e.g. lo16(symbol-picbase). |
Bill Schmidt | 3822ef2 | 2013-02-21 00:05:29 +0000 | [diff] [blame] | 69 | MO_PIC_FLAG = 2, |
Chris Lattner | dd6df84 | 2010-11-15 03:13:19 +0000 | [diff] [blame] | 70 | |
| 71 | /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to |
| 72 | /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase). |
Bill Schmidt | 3822ef2 | 2013-02-21 00:05:29 +0000 | [diff] [blame] | 73 | MO_NLP_FLAG = 4, |
Chris Lattner | edb9d84 | 2010-11-15 02:46:57 +0000 | [diff] [blame] | 74 | |
Chris Lattner | dd6df84 | 2010-11-15 03:13:19 +0000 | [diff] [blame] | 75 | /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a |
| 76 | /// symbol with hidden visibility. This causes a different kind of |
| 77 | /// non-lazy-pointer to be generated. |
Bill Schmidt | 3822ef2 | 2013-02-21 00:05:29 +0000 | [diff] [blame] | 78 | MO_NLP_HIDDEN_FLAG = 8, |
Roman Divacky | e3f15c98 | 2012-06-04 17:36:38 +0000 | [diff] [blame] | 79 | |
| 80 | /// The next are not flags but distinct values. |
Bill Schmidt | 3822ef2 | 2013-02-21 00:05:29 +0000 | [diff] [blame] | 81 | MO_ACCESS_MASK = 0xf0, |
Roman Divacky | e3f15c98 | 2012-06-04 17:36:38 +0000 | [diff] [blame] | 82 | |
Ulrich Weigand | d51c09f | 2013-06-21 14:42:20 +0000 | [diff] [blame] | 83 | /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol) |
| 84 | MO_LO = 1 << 4, |
| 85 | MO_HA = 2 << 4, |
Roman Divacky | e3f15c98 | 2012-06-04 17:36:38 +0000 | [diff] [blame] | 86 | |
Ulrich Weigand | d51c09f | 2013-06-21 14:42:20 +0000 | [diff] [blame] | 87 | MO_TPREL_LO = 4 << 4, |
| 88 | MO_TPREL_HA = 3 << 4, |
Bill Schmidt | 3822ef2 | 2013-02-21 00:05:29 +0000 | [diff] [blame] | 89 | |
| 90 | /// These values identify relocations on immediates folded |
| 91 | /// into memory operations. |
Ulrich Weigand | d51c09f | 2013-06-21 14:42:20 +0000 | [diff] [blame] | 92 | MO_DTPREL_LO = 5 << 4, |
| 93 | MO_TLSLD_LO = 6 << 4, |
Ulrich Weigand | 5b42759 | 2013-07-05 12:22:36 +0000 | [diff] [blame] | 94 | MO_TOC_LO = 7 << 4, |
| 95 | |
| 96 | // Symbol for VK_PPC_TLS fixup attached to an ADD instruction |
Bill Schmidt | 82f1c77 | 2015-02-10 19:09:05 +0000 | [diff] [blame] | 97 | MO_TLS = 8 << 4 |
Chris Lattner | df8e17d | 2010-11-14 23:42:06 +0000 | [diff] [blame] | 98 | }; |
| 99 | } // end namespace PPCII |
| 100 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 101 | } // end namespace llvm; |
Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 102 | |
Misha Brukman | e05203f | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 103 | #endif |