]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / lib / Target / PowerPC / PPC.h
1 //===-- PPC.h - Top-level interface for PowerPC Target ----------*- 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 LLVM
10 // PowerPC back-end.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_POWERPC_PPC_H
15 #define LLVM_LIB_TARGET_POWERPC_PPC_H
16
17 #include "llvm/Support/CodeGen.h"
18
19 // GCC #defines PPC on Linux but we use it as our namespace name
20 #undef PPC
21
22 namespace llvm {
23   class PPCTargetMachine;
24   class PassRegistry;
25   class FunctionPass;
26   class MachineInstr;
27   class MachineOperand;
28   class AsmPrinter;
29   class MCInst;
30   class MCOperand;
31   class ModulePass;
32   
33   FunctionPass *createPPCCTRLoops();
34 #ifndef NDEBUG
35   FunctionPass *createPPCCTRLoopsVerify();
36 #endif
37   FunctionPass *createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM);
38   FunctionPass *createPPCTOCRegDepsPass();
39   FunctionPass *createPPCEarlyReturnPass();
40   FunctionPass *createPPCVSXCopyPass();
41   FunctionPass *createPPCVSXFMAMutatePass();
42   FunctionPass *createPPCVSXSwapRemovalPass();
43   FunctionPass *createPPCReduceCRLogicalsPass();
44   FunctionPass *createPPCMIPeepholePass();
45   FunctionPass *createPPCBranchSelectionPass();
46   FunctionPass *createPPCBranchCoalescingPass();
47   FunctionPass *createPPCQPXLoadSplatPass();
48   FunctionPass *createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL);
49   FunctionPass *createPPCTLSDynamicCallPass();
50   FunctionPass *createPPCBoolRetToIntPass();
51   FunctionPass *createPPCExpandISELPass();
52   FunctionPass *createPPCPreEmitPeepholePass();
53   void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
54                                     AsmPrinter &AP);
55   bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
56                                          MCOperand &OutMO, AsmPrinter &AP);
57
58   void initializePPCCTRLoopsPass(PassRegistry&);
59 #ifndef NDEBUG
60   void initializePPCCTRLoopsVerifyPass(PassRegistry&);
61 #endif
62   void initializePPCLoopInstrFormPrepPass(PassRegistry&);
63   void initializePPCTOCRegDepsPass(PassRegistry&);
64   void initializePPCEarlyReturnPass(PassRegistry&);
65   void initializePPCVSXCopyPass(PassRegistry&);
66   void initializePPCVSXFMAMutatePass(PassRegistry&);
67   void initializePPCVSXSwapRemovalPass(PassRegistry&);
68   void initializePPCReduceCRLogicalsPass(PassRegistry&);
69   void initializePPCBSelPass(PassRegistry&);
70   void initializePPCBranchCoalescingPass(PassRegistry&);
71   void initializePPCQPXLoadSplatPass(PassRegistry&);
72   void initializePPCBoolRetToIntPass(PassRegistry&);
73   void initializePPCExpandISELPass(PassRegistry &);
74   void initializePPCPreEmitPeepholePass(PassRegistry &);
75   void initializePPCTLSDynamicCallPass(PassRegistry &);
76   void initializePPCMIPeepholePass(PassRegistry&);
77
78   extern char &PPCVSXFMAMutateID;
79
80   ModulePass *createPPCLowerMASSVEntriesPass();
81   void initializePPCLowerMASSVEntriesPass(PassRegistry &);
82   extern char &PPCLowerMASSVEntriesID;
83   
84   namespace PPCII {
85
86   /// Target Operand Flag enum.
87   enum TOF {
88     //===------------------------------------------------------------------===//
89     // PPC Specific MachineOperand flags.
90     MO_NO_FLAG,
91
92     /// On a symbol operand "FOO", this indicates that the reference is actually
93     /// to "FOO@plt".  This is used for calls and jumps to external functions
94     /// and for PIC calls on 32-bit ELF systems.
95     MO_PLT = 1,
96
97     /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
98     /// the function's picbase, e.g. lo16(symbol-picbase).
99     MO_PIC_FLAG = 2,
100
101     /// MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to
102     /// the current instruction address(pc), e.g., var@pcrel. Fixup is VK_PCREL.
103     MO_PCREL_FLAG = 4,
104
105     /// MO_GOT_FLAG - If this bit is set the symbol reference is to be computed
106     /// via the GOT. For example when combined with the MO_PCREL_FLAG it should
107     /// produce the relocation @got@pcrel. Fixup is VK_PPC_GOT_PCREL.
108     MO_GOT_FLAG = 8,
109
110     /// The next are not flags but distinct values.
111     MO_ACCESS_MASK = 0xf00,
112
113     /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
114     MO_LO = 1 << 8,
115     MO_HA = 2 << 8,
116
117     MO_TPREL_LO = 4 << 8,
118     MO_TPREL_HA = 3 << 8,
119
120     /// These values identify relocations on immediates folded
121     /// into memory operations.
122     MO_DTPREL_LO = 5 << 8,
123     MO_TLSLD_LO = 6 << 8,
124     MO_TOC_LO = 7 << 8,
125
126     // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
127     MO_TLS = 8 << 8
128   };
129   } // end namespace PPCII
130
131 } // end namespace llvm;
132
133 #endif