LLVM 24.0.0git
PPC.h
Go to the documentation of this file.
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
18
19// GCC #defines PPC on Linux but we use it as our namespace name
20#undef PPC
21
22namespace llvm {
24class PPCSubtarget;
26class PassRegistry;
27class FunctionPass;
29class MachineInstr;
30class MachineOperand;
31class AsmPrinter;
32class MCInst;
33class MCOperand;
34class ModulePass;
35
36#ifndef NDEBUG
38#endif
58 AsmPrinter &AP);
59 bool LowerPPCMachineOperandToMCOperand(unsigned MIOpcode,
60 const MachineOperand &MO,
61 MCOperand &OutMO, AsmPrinter &AP);
62
63#ifndef NDEBUG
65#endif
86
87 extern char &PPCVSXFMAMutateID;
88
91 extern char &PPCLowerMASSVEntriesID;
92
95 extern char &PPCGenScalarMASSEntriesID;
96
99 const PPCRegisterBankInfo &);
100 namespace PPCII {
101
102 /// Target Operand Flag enum.
103 enum TOF {
104 //===------------------------------------------------------------------===//
105 // PPC Specific MachineOperand flags.
107
108 /// On PPC, the 12 bits are not enough for all target operand flags.
109 /// Treat all PPC target flags as direct flags. To define new flag that is
110 /// combination of other flags, add new enum entry instead of combining
111 /// existing flags. See example MO_GOT_TPREL_PCREL_FLAG.
112
113 /// On a symbol operand "FOO", this indicates that the reference is actually
114 /// to "FOO@plt". This is used for calls and jumps to external functions
115 /// and for PIC calls on 32-bit ELF systems.
117
118 /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
119 /// the function's picbase, e.g. lo16(symbol-picbase).
121
122 /// MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to
123 /// the current instruction address(pc), e.g., var@pcrel. Fixup is VK_PCREL.
125
126 /// MO_GOT_FLAG - If this bit is set the symbol reference is to be computed
127 /// via the GOT. For example when combined with the MO_PCREL_FLAG it should
128 /// produce the relocation @got@pcrel. Fixup is VK_GOT_PCREL.
130
131 /// MO_PCREL_OPT_FLAG - If this bit is set the operand is part of a
132 /// PC Relative linker optimization.
134
135 /// MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to
136 /// TLS General Dynamic model for Linux and the variable offset of TLS
137 /// General Dynamic model for AIX.
139
140 /// MO_TPREL_FLAG - If this bit is set, the symbol reference is relative to
141 /// the thread pointer and the symbol can be used for the TLS Initial Exec
142 /// and Local Exec models.
144
145 /// MO_TLSLDM_FLAG - on AIX the ML relocation type is only valid for a
146 /// reference to a TOC symbol from the symbol itself, and right now its only
147 /// user is the symbol "_$TLSML". The symbol name is used to decide that
148 /// the R_TLSML relocation is expected.
150
151 /// MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to
152 /// TLS Local Dynamic model.
154
155 /// MO_TLSGDM_FLAG - If this bit is set the symbol reference is relative
156 /// to the region handle of TLS General Dynamic model for AIX.
158
159 /// MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set
160 /// they should produce the relocation @got@tlsgd@pcrel.
161 /// Fix up is VK_GOT_TLSGD_PCREL
162 /// MO_GOT_TLSGD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSGD_FLAG,
164
165 /// MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set
166 /// they should produce the relocation @got@tlsld@pcrel.
167 /// Fix up is VK_GOT_TLSLD_PCREL
168 /// MO_GOT_TLSLD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSLD_FLAG,
170
171 /// MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set
172 /// they should produce the relocation @got@tprel@pcrel.
173 /// Fix up is VK_GOT_TPREL_PCREL
174 /// MO_GOT_TPREL_PCREL_FLAG = MO_GOT_FLAG | MO_TPREL_FLAG | MO_PCREL_FLAG,
176
177 /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
180
183
184 /// These values identify relocations on immediates folded
185 /// into memory operations.
189
190 /// Symbol for VK_TLS fixup attached to an ADD instruction
192
193 /// MO_PIC_HA_FLAG = MO_PIC_FLAG | MO_HA
195
196 /// MO_PIC_LO_FLAG = MO_PIC_FLAG | MO_LO
198
199 /// MO_TPREL_PCREL_FLAG = MO_PCREL_FLAG | MO_TPREL_FLAG
201
202 /// MO_TPREL_PCREL_FLAG = MO_PCREL_FLAG | MO_TLS
204
205 /// MO_GOT_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG
207 };
208 } // end namespace PPCII
209
210} // end namespace llvm;
211
212#endif
IRTranslator LLVM IR MI
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:91
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Instances of this class represent operands of the MCInst class.
Definition MCInst.h:40
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition Pass.h:255
Common code between 32-bit and 64-bit PowerPC targets.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
PPCII - This namespace holds all of the PowerPC target-specific per-instruction flags.
TOF
Target Operand Flag enum.
Definition PPC.h:103
@ MO_TLSLD_LO
Definition PPC.h:187
@ MO_TLSLDM_FLAG
MO_TLSLDM_FLAG - on AIX the ML relocation type is only valid for a reference to a TOC symbol from the...
Definition PPC.h:149
@ MO_PIC_LO_FLAG
MO_PIC_LO_FLAG = MO_PIC_FLAG | MO_LO.
Definition PPC.h:197
@ MO_TPREL_PCREL_FLAG
MO_TPREL_PCREL_FLAG = MO_PCREL_FLAG | MO_TPREL_FLAG.
Definition PPC.h:200
@ MO_GOT_TPREL_PCREL_FLAG
MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
Definition PPC.h:175
@ MO_GOT_PCREL_FLAG
MO_GOT_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG.
Definition PPC.h:206
@ MO_TLSGDM_FLAG
MO_TLSGDM_FLAG - If this bit is set the symbol reference is relative to the region handle of TLS Gene...
Definition PPC.h:157
@ MO_PCREL_FLAG
MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to the current instruction addre...
Definition PPC.h:124
@ MO_TLSLD_FLAG
MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to TLS Local Dynamic model.
Definition PPC.h:153
@ MO_TLS_PCREL_FLAG
MO_TPREL_PCREL_FLAG = MO_PCREL_FLAG | MO_TLS.
Definition PPC.h:203
@ MO_GOT_FLAG
MO_GOT_FLAG - If this bit is set the symbol reference is to be computed via the GOT.
Definition PPC.h:129
@ MO_NO_FLAG
Definition PPC.h:106
@ MO_TPREL_HA
Definition PPC.h:182
@ MO_PLT
On PPC, the 12 bits are not enough for all target operand flags.
Definition PPC.h:116
@ MO_DTPREL_LO
These values identify relocations on immediates folded into memory operations.
Definition PPC.h:186
@ MO_TLS
Symbol for VK_TLS fixup attached to an ADD instruction.
Definition PPC.h:191
@ MO_TPREL_FLAG
MO_TPREL_FLAG - If this bit is set, the symbol reference is relative to the thread pointer and the sy...
Definition PPC.h:143
@ MO_TPREL_LO
Definition PPC.h:181
@ MO_LO
MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
Definition PPC.h:178
@ MO_GOT_TLSLD_PCREL_FLAG
MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
Definition PPC.h:169
@ MO_PIC_HA_FLAG
MO_PIC_HA_FLAG = MO_PIC_FLAG | MO_HA.
Definition PPC.h:194
@ MO_TOC_LO
Definition PPC.h:188
@ MO_TLSGD_FLAG
MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to TLS General Dynamic model for ...
Definition PPC.h:138
@ MO_GOT_TLSGD_PCREL_FLAG
MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
Definition PPC.h:163
@ MO_HA
Definition PPC.h:179
@ MO_PIC_FLAG
MO_PIC_FLAG - If this bit is set, the symbol reference is relative to the function's picbase,...
Definition PPC.h:120
@ MO_PCREL_OPT_FLAG
MO_PCREL_OPT_FLAG - If this bit is set the operand is part of a PC Relative linker optimization.
Definition PPC.h:133
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createPPCPreEmitPeepholePass()
void initializePPCTLSDynamicCallPass(PassRegistry &)
FunctionPass * createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM)
FunctionPass * createPPCVSXFMAMutatePass()
void initializePPCVSXFMAMutatePass(PassRegistry &)
void initializePPCLowerMASSVEntriesPass(PassRegistry &)
FunctionPass * createPPCCTRLoopsPass()
FunctionPass * createPPCTLSDynamicCallPass()
FunctionPass * createPPCEarlyReturnPass()
void initializePPCPreEmitPeepholePass(PassRegistry &)
FunctionPass * createPPCExpandAtomicPseudoPass()
void initializePPCTOCRegDepsPass(PassRegistry &)
void initializePPCReduceCRLogicalsPass(PassRegistry &)
ModulePass * createPPCPrepareIFuncsOnAIXPass()
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
FunctionPass * createPPCVSXSwapRemovalPass()
void initializePPCAIXAsmPrinterPass(PassRegistry &)
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP)
void initializePPCCTRLoopsPass(PassRegistry &)
ModulePass * createPPCLowerMASSVEntriesPass()
bool LowerPPCMachineOperandToMCOperand(unsigned MIOpcode, const MachineOperand &MO, MCOperand &OutMO, AsmPrinter &AP)
void initializePPCDAGToDAGISelLegacyPass(PassRegistry &)
ModulePass * createPPCGenScalarMASSEntriesPass()
void initializePPCEarlyReturnPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:149
void initializePPCGenScalarMASSEntriesPass(PassRegistry &)
FunctionPass * createPPCReduceCRLogicalsPass()
FunctionPass * createPPCISelDag(PPCTargetMachine &TM, CodeGenOptLevel OL)
createPPCISelDag - This pass converts a legalized DAG into a PowerPC-specific DAG,...
void initializePPCExpandAtomicPseudoPass(PassRegistry &)
FunctionPass * createPPCBranchCoalescingPass()
createPPCBranchCoalescingPass - returns an instance of the Branch Coalescing Pass
void initializePPCVSXWACCCopyPass(PassRegistry &)
void initializePPCLinuxAsmPrinterPass(PassRegistry &)
void initializePPCBSelPass(PassRegistry &)
FunctionPass * createPPCTOCRegDepsPass()
FunctionPass * createPPCCTRLoopsVerify()
void initializePPCBranchCoalescingPass(PassRegistry &)
void initializePPCBoolRetToIntPass(PassRegistry &)
void initializePPCMIPeepholePass(PassRegistry &)
void initializePPCVSXSwapRemovalPass(PassRegistry &)
char & PPCVSXFMAMutateID
char & PPCLowerMASSVEntriesID
InstructionSelector * createPPCInstructionSelector(const PPCTargetMachine &TM, const PPCSubtarget &Subtarget, const PPCRegisterBankInfo &RBI)
char & PPCGenScalarMASSEntriesID
void initializePPCLoopInstrFormPrepPass(PassRegistry &)
FunctionPass * createPPCVSXWACCCopyPass()
FunctionPass * createPPCExpandISELPass()
void initializePPCPrepareIFuncsOnAIXPass(PassRegistry &)
FunctionPass * createPPCBranchSelectionPass()
FunctionPass * createPPCBoolRetToIntPass()
FunctionPass * createPPCMIPeepholePass()
void initializePPCExpandISELPass(PassRegistry &)