xref: /aosp_15_r20/external/llvm/lib/Target/PowerPC/PPC.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file contains the entry points for global functions defined in the LLVM
11*9880d681SAndroid Build Coastguard Worker // PowerPC back-end.
12*9880d681SAndroid Build Coastguard Worker //
13*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
14*9880d681SAndroid Build Coastguard Worker 
15*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_POWERPC_PPC_H
16*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_POWERPC_PPC_H
17*9880d681SAndroid Build Coastguard Worker 
18*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/PPCMCTargetDesc.h"
19*9880d681SAndroid Build Coastguard Worker 
20*9880d681SAndroid Build Coastguard Worker // GCC #defines PPC on Linux but we use it as our namespace name
21*9880d681SAndroid Build Coastguard Worker #undef PPC
22*9880d681SAndroid Build Coastguard Worker 
23*9880d681SAndroid Build Coastguard Worker namespace llvm {
24*9880d681SAndroid Build Coastguard Worker   class PPCTargetMachine;
25*9880d681SAndroid Build Coastguard Worker   class PassRegistry;
26*9880d681SAndroid Build Coastguard Worker   class FunctionPass;
27*9880d681SAndroid Build Coastguard Worker   class ImmutablePass;
28*9880d681SAndroid Build Coastguard Worker   class MachineInstr;
29*9880d681SAndroid Build Coastguard Worker   class AsmPrinter;
30*9880d681SAndroid Build Coastguard Worker   class MCInst;
31*9880d681SAndroid Build Coastguard Worker 
32*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCCTRLoops(PPCTargetMachine &TM);
33*9880d681SAndroid Build Coastguard Worker #ifndef NDEBUG
34*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCCTRLoopsVerify();
35*9880d681SAndroid Build Coastguard Worker #endif
36*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCLoopPreIncPrepPass(PPCTargetMachine &TM);
37*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCTOCRegDepsPass();
38*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCEarlyReturnPass();
39*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCVSXCopyPass();
40*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCVSXFMAMutatePass();
41*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCVSXSwapRemovalPass();
42*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCMIPeepholePass();
43*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCBranchSelectionPass();
44*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCQPXLoadSplatPass();
45*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
46*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCTLSDynamicCallPass();
47*9880d681SAndroid Build Coastguard Worker   FunctionPass *createPPCBoolRetToIntPass();
48*9880d681SAndroid Build Coastguard Worker   void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
49*9880d681SAndroid Build Coastguard Worker                                     AsmPrinter &AP, bool isDarwin);
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker   void initializePPCVSXFMAMutatePass(PassRegistry&);
52*9880d681SAndroid Build Coastguard Worker   void initializePPCBoolRetToIntPass(PassRegistry&);
53*9880d681SAndroid Build Coastguard Worker   extern char &PPCVSXFMAMutateID;
54*9880d681SAndroid Build Coastguard Worker 
55*9880d681SAndroid Build Coastguard Worker   namespace PPCII {
56*9880d681SAndroid Build Coastguard Worker 
57*9880d681SAndroid Build Coastguard Worker   /// Target Operand Flag enum.
58*9880d681SAndroid Build Coastguard Worker   enum TOF {
59*9880d681SAndroid Build Coastguard Worker     //===------------------------------------------------------------------===//
60*9880d681SAndroid Build Coastguard Worker     // PPC Specific MachineOperand flags.
61*9880d681SAndroid Build Coastguard Worker     MO_NO_FLAG,
62*9880d681SAndroid Build Coastguard Worker 
63*9880d681SAndroid Build Coastguard Worker     /// On a symbol operand "FOO", this indicates that the reference is actually
64*9880d681SAndroid Build Coastguard Worker     /// to "FOO@plt".  This is used for calls and jumps to external functions on
65*9880d681SAndroid Build Coastguard Worker     /// for PIC calls on Linux and ELF systems.
66*9880d681SAndroid Build Coastguard Worker     MO_PLT = 1,
67*9880d681SAndroid Build Coastguard Worker 
68*9880d681SAndroid Build Coastguard Worker     /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
69*9880d681SAndroid Build Coastguard Worker     /// the function's picbase, e.g. lo16(symbol-picbase).
70*9880d681SAndroid Build Coastguard Worker     MO_PIC_FLAG = 2,
71*9880d681SAndroid Build Coastguard Worker 
72*9880d681SAndroid Build Coastguard Worker     /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
73*9880d681SAndroid Build Coastguard Worker     /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
74*9880d681SAndroid Build Coastguard Worker     MO_NLP_FLAG = 4,
75*9880d681SAndroid Build Coastguard Worker 
76*9880d681SAndroid Build Coastguard Worker     /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
77*9880d681SAndroid Build Coastguard Worker     /// symbol with hidden visibility.  This causes a different kind of
78*9880d681SAndroid Build Coastguard Worker     /// non-lazy-pointer to be generated.
79*9880d681SAndroid Build Coastguard Worker     MO_NLP_HIDDEN_FLAG = 8,
80*9880d681SAndroid Build Coastguard Worker 
81*9880d681SAndroid Build Coastguard Worker     /// The next are not flags but distinct values.
82*9880d681SAndroid Build Coastguard Worker     MO_ACCESS_MASK = 0xf0,
83*9880d681SAndroid Build Coastguard Worker 
84*9880d681SAndroid Build Coastguard Worker     /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
85*9880d681SAndroid Build Coastguard Worker     MO_LO = 1 << 4,
86*9880d681SAndroid Build Coastguard Worker     MO_HA = 2 << 4,
87*9880d681SAndroid Build Coastguard Worker 
88*9880d681SAndroid Build Coastguard Worker     MO_TPREL_LO = 4 << 4,
89*9880d681SAndroid Build Coastguard Worker     MO_TPREL_HA = 3 << 4,
90*9880d681SAndroid Build Coastguard Worker 
91*9880d681SAndroid Build Coastguard Worker     /// These values identify relocations on immediates folded
92*9880d681SAndroid Build Coastguard Worker     /// into memory operations.
93*9880d681SAndroid Build Coastguard Worker     MO_DTPREL_LO = 5 << 4,
94*9880d681SAndroid Build Coastguard Worker     MO_TLSLD_LO = 6 << 4,
95*9880d681SAndroid Build Coastguard Worker     MO_TOC_LO = 7 << 4,
96*9880d681SAndroid Build Coastguard Worker 
97*9880d681SAndroid Build Coastguard Worker     // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
98*9880d681SAndroid Build Coastguard Worker     MO_TLS = 8 << 4
99*9880d681SAndroid Build Coastguard Worker   };
100*9880d681SAndroid Build Coastguard Worker   } // end namespace PPCII
101*9880d681SAndroid Build Coastguard Worker 
102*9880d681SAndroid Build Coastguard Worker } // end namespace llvm;
103*9880d681SAndroid Build Coastguard Worker 
104*9880d681SAndroid Build Coastguard Worker #endif
105