1 //===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file contains the entry points for global functions defined in the LLVM
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_POWERPC_PPC_H
15 #define LLVM_LIB_TARGET_POWERPC_PPC_H
17 #include "llvm/Support/CodeGen.h"
19 // GCC #defines PPC on Linux but we use it as our namespace name
23 class PPCTargetMachine;
33 FunctionPass *createPPCCTRLoops();
35 FunctionPass *createPPCCTRLoopsVerify();
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, bool IsDarwin);
55 bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
56 MCOperand &OutMO, AsmPrinter &AP,
59 void initializePPCCTRLoopsPass(PassRegistry&);
61 void initializePPCCTRLoopsVerifyPass(PassRegistry&);
63 void initializePPCLoopInstrFormPrepPass(PassRegistry&);
64 void initializePPCTOCRegDepsPass(PassRegistry&);
65 void initializePPCEarlyReturnPass(PassRegistry&);
66 void initializePPCVSXCopyPass(PassRegistry&);
67 void initializePPCVSXFMAMutatePass(PassRegistry&);
68 void initializePPCVSXSwapRemovalPass(PassRegistry&);
69 void initializePPCReduceCRLogicalsPass(PassRegistry&);
70 void initializePPCBSelPass(PassRegistry&);
71 void initializePPCBranchCoalescingPass(PassRegistry&);
72 void initializePPCQPXLoadSplatPass(PassRegistry&);
73 void initializePPCBoolRetToIntPass(PassRegistry&);
74 void initializePPCExpandISELPass(PassRegistry &);
75 void initializePPCPreEmitPeepholePass(PassRegistry &);
76 void initializePPCTLSDynamicCallPass(PassRegistry &);
77 void initializePPCMIPeepholePass(PassRegistry&);
79 extern char &PPCVSXFMAMutateID;
81 ModulePass *createPPCLowerMASSVEntriesPass();
82 void initializePPCLowerMASSVEntriesPass(PassRegistry &);
83 extern char &PPCLowerMASSVEntriesID;
87 /// Target Operand Flag enum.
89 //===------------------------------------------------------------------===//
90 // PPC Specific MachineOperand flags.
93 /// On a symbol operand "FOO", this indicates that the reference is actually
94 /// to "FOO@plt". This is used for calls and jumps to external functions
95 /// and for PIC calls on 32-bit ELF systems.
98 /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
99 /// the function's picbase, e.g. lo16(symbol-picbase).
102 /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
103 /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
106 /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
107 /// symbol with hidden visibility. This causes a different kind of
108 /// non-lazy-pointer to be generated.
109 MO_NLP_HIDDEN_FLAG = 8,
111 /// The next are not flags but distinct values.
112 MO_ACCESS_MASK = 0xf0,
114 /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
118 MO_TPREL_LO = 4 << 4,
119 MO_TPREL_HA = 3 << 4,
121 /// These values identify relocations on immediates folded
122 /// into memory operations.
123 MO_DTPREL_LO = 5 << 4,
124 MO_TLSLD_LO = 6 << 4,
127 // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
130 } // end namespace PPCII
132 } // end namespace llvm;