LLVM  16.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 
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 PPCRegisterBankInfo;
24 class PPCSubtarget;
25 class PPCTargetMachine;
26 class PassRegistry;
27 class FunctionPass;
28 class InstructionSelector;
29 class MachineInstr;
30 class MachineOperand;
31 class AsmPrinter;
32 class MCInst;
33 class MCOperand;
34 class ModulePass;
35 
36 #ifndef NDEBUG
37  FunctionPass *createPPCCTRLoopsVerify();
38 #endif
39  FunctionPass *createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM);
40  FunctionPass *createPPCTOCRegDepsPass();
41  FunctionPass *createPPCEarlyReturnPass();
42  FunctionPass *createPPCVSXCopyPass();
43  FunctionPass *createPPCVSXFMAMutatePass();
44  FunctionPass *createPPCVSXSwapRemovalPass();
45  FunctionPass *createPPCReduceCRLogicalsPass();
46  FunctionPass *createPPCMIPeepholePass();
47  FunctionPass *createPPCBranchSelectionPass();
48  FunctionPass *createPPCBranchCoalescingPass();
49  FunctionPass *createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL);
50  FunctionPass *createPPCTLSDynamicCallPass();
51  FunctionPass *createPPCBoolRetToIntPass();
52  FunctionPass *createPPCExpandISELPass();
53  FunctionPass *createPPCPreEmitPeepholePass();
54  FunctionPass *createPPCExpandAtomicPseudoPass();
55  FunctionPass *createPPCCTRLoopsPass();
56  void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
57  AsmPrinter &AP);
58  bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
59  MCOperand &OutMO, AsmPrinter &AP);
60 
61 #ifndef NDEBUG
62  void initializePPCCTRLoopsVerifyPass(PassRegistry&);
63 #endif
64  void initializePPCLoopInstrFormPrepPass(PassRegistry&);
65  void initializePPCTOCRegDepsPass(PassRegistry&);
66  void initializePPCEarlyReturnPass(PassRegistry&);
67  void initializePPCVSXCopyPass(PassRegistry&);
68  void initializePPCVSXFMAMutatePass(PassRegistry&);
69  void initializePPCVSXSwapRemovalPass(PassRegistry&);
70  void initializePPCReduceCRLogicalsPass(PassRegistry&);
71  void initializePPCBSelPass(PassRegistry&);
72  void initializePPCBranchCoalescingPass(PassRegistry&);
73  void initializePPCBoolRetToIntPass(PassRegistry&);
74  void initializePPCExpandISELPass(PassRegistry &);
75  void initializePPCPreEmitPeepholePass(PassRegistry &);
76  void initializePPCTLSDynamicCallPass(PassRegistry &);
77  void initializePPCMIPeepholePass(PassRegistry&);
78  void initializePPCExpandAtomicPseudoPass(PassRegistry &);
79  void initializePPCCTRLoopsPass(PassRegistry &);
80 
81  extern char &PPCVSXFMAMutateID;
82 
83  ModulePass *createPPCLowerMASSVEntriesPass();
84  void initializePPCLowerMASSVEntriesPass(PassRegistry &);
85  extern char &PPCLowerMASSVEntriesID;
86 
88  void initializePPCGenScalarMASSEntriesPass(PassRegistry &);
89  extern char &PPCGenScalarMASSEntriesID;
90 
91  InstructionSelector *
92  createPPCInstructionSelector(const PPCTargetMachine &, const PPCSubtarget &,
93  const PPCRegisterBankInfo &);
94  namespace PPCII {
95 
96  /// Target Operand Flag enum.
97  enum TOF {
98  //===------------------------------------------------------------------===//
99  // PPC Specific MachineOperand flags.
101 
102  /// On a symbol operand "FOO", this indicates that the reference is actually
103  /// to "FOO@plt". This is used for calls and jumps to external functions
104  /// and for PIC calls on 32-bit ELF systems.
105  MO_PLT = 1,
106 
107  /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
108  /// the function's picbase, e.g. lo16(symbol-picbase).
110 
111  /// MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to
112  /// the current instruction address(pc), e.g., var@pcrel. Fixup is VK_PCREL.
114 
115  /// MO_GOT_FLAG - If this bit is set the symbol reference is to be computed
116  /// via the GOT. For example when combined with the MO_PCREL_FLAG it should
117  /// produce the relocation @got@pcrel. Fixup is VK_PPC_GOT_PCREL.
119 
120  // MO_PCREL_OPT_FLAG - If this bit is set the operand is part of a
121  // PC Relative linker optimization.
123 
124  /// MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to
125  /// TLS General Dynamic model for Linux and the variable offset of TLS
126  /// General Dynamic model for AIX.
128 
129  /// MO_TPREL_FLAG - If this bit is set the symbol reference is relative to
130  /// TLS Initial Exec model.
132 
133  /// MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to
134  /// TLS Local Dynamic model.
136 
137  /// MO_TLSGDM_FLAG - If this bit is set the symbol reference is relative
138  /// to the region handle of TLS General Dynamic model for AIX.
140 
141  /// MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set
142  /// they should produce the relocation @got@tlsgd@pcrel.
143  /// Fix up is VK_PPC_GOT_TLSGD_PCREL
145 
146  /// MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set
147  /// they should produce the relocation @got@tlsld@pcrel.
148  /// Fix up is VK_PPC_GOT_TLSLD_PCREL
150 
151  /// MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set
152  /// they should produce the relocation @got@tprel@pcrel.
153  /// Fix up is VK_PPC_GOT_TPREL_PCREL
155 
156  /// The next are not flags but distinct values.
157  MO_ACCESS_MASK = 0xf00,
158 
159  /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
160  MO_LO = 1 << 8,
161  MO_HA = 2 << 8,
162 
163  MO_TPREL_LO = 4 << 8,
164  MO_TPREL_HA = 3 << 8,
165 
166  /// These values identify relocations on immediates folded
167  /// into memory operations.
168  MO_DTPREL_LO = 5 << 8,
169  MO_TLSLD_LO = 6 << 8,
170  MO_TOC_LO = 7 << 8,
171 
172  // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
173  MO_TLS = 8 << 8
174  };
175  } // end namespace PPCII
176 
177 } // end namespace llvm;
178 
179 #endif
llvm::PPCII::MO_TLSGD_FLAG
@ 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:127
llvm::initializePPCPreEmitPeepholePass
void initializePPCPreEmitPeepholePass(PassRegistry &)
llvm::PPCII::MO_GOT_FLAG
@ MO_GOT_FLAG
MO_GOT_FLAG - If this bit is set the symbol reference is to be computed via the GOT.
Definition: PPC.h:118
llvm::initializePPCGenScalarMASSEntriesPass
void initializePPCGenScalarMASSEntriesPass(PassRegistry &)
llvm::PPCII::MO_PLT
@ MO_PLT
On a symbol operand "FOO", this indicates that the reference is actually to "FOO@plt".
Definition: PPC.h:105
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::LowerPPCMachineInstrToMCInst
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP)
Definition: PPCMCInstLower.cpp:151
llvm::initializePPCVSXFMAMutatePass
void initializePPCVSXFMAMutatePass(PassRegistry &)
llvm::PPCII::MO_GOT_TLSLD_PCREL_FLAG
@ 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:149
llvm::createPPCExpandISELPass
FunctionPass * createPPCExpandISELPass()
llvm::PPCII::MO_DTPREL_LO
@ MO_DTPREL_LO
These values identify relocations on immediates folded into memory operations.
Definition: PPC.h:168
llvm::createPPCLoopInstrFormPrepPass
FunctionPass * createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM)
Definition: PPCLoopInstrFormPrep.cpp:352
llvm::createPPCBoolRetToIntPass
FunctionPass * createPPCBoolRetToIntPass()
llvm::PPCII::MO_TLSLD_FLAG
@ MO_TLSLD_FLAG
MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to TLS Local Dynamic model.
Definition: PPC.h:135
llvm::PPCII::MO_LO
@ MO_LO
MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
Definition: PPC.h:160
llvm::PPCII::TOF
TOF
Target Operand Flag enum.
Definition: PPC.h:97
llvm::PPCII::MO_GOT_TLSGD_PCREL_FLAG
@ 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:144
llvm::LowerPPCMachineOperandToMCOperand
bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO, MCOperand &OutMO, AsmPrinter &AP)
Definition: PPCMCInstLower.cpp:162
llvm::createPPCEarlyReturnPass
FunctionPass * createPPCEarlyReturnPass()
llvm::createPPCCTRLoopsVerify
FunctionPass * createPPCCTRLoopsVerify()
Definition: PPCCTRLoopsVerify.cpp:79
llvm::PPCII::MO_NO_FLAG
@ MO_NO_FLAG
Definition: PPC.h:100
llvm::createPPCVSXFMAMutatePass
FunctionPass * createPPCVSXFMAMutatePass()
Definition: PPCVSXFMAMutate.cpp:392
llvm::initializePPCVSXCopyPass
void initializePPCVSXCopyPass(PassRegistry &)
llvm::initializePPCLoopInstrFormPrepPass
void initializePPCLoopInstrFormPrepPass(PassRegistry &)
llvm::initializePPCExpandAtomicPseudoPass
void initializePPCExpandAtomicPseudoPass(PassRegistry &)
llvm::initializePPCLowerMASSVEntriesPass
void initializePPCLowerMASSVEntriesPass(PassRegistry &)
llvm::PPCII::MO_PCREL_FLAG
@ MO_PCREL_FLAG
MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to the current instruction addre...
Definition: PPC.h:113
llvm::createPPCInstructionSelector
InstructionSelector * createPPCInstructionSelector(const PPCTargetMachine &TM, const PPCSubtarget &Subtarget, const PPCRegisterBankInfo &RBI)
Definition: PPCInstructionSelector.cpp:136
llvm::createPPCGenScalarMASSEntriesPass
ModulePass * createPPCGenScalarMASSEntriesPass()
llvm::initializePPCBSelPass
void initializePPCBSelPass(PassRegistry &)
llvm::createPPCCTRLoopsPass
FunctionPass * createPPCCTRLoopsPass()
Definition: PPCCTRLoops.cpp:93
llvm::initializePPCTOCRegDepsPass
void initializePPCTOCRegDepsPass(PassRegistry &)
llvm::createPPCVSXCopyPass
FunctionPass * createPPCVSXCopyPass()
llvm::PPCII::MO_GOT_TPREL_PCREL_FLAG
@ 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:154
llvm::initializePPCMIPeepholePass
void initializePPCMIPeepholePass(PassRegistry &)
llvm::createPPCLowerMASSVEntriesPass
ModulePass * createPPCLowerMASSVEntriesPass()
llvm::PPCII::MO_TPREL_HA
@ MO_TPREL_HA
Definition: PPC.h:164
llvm::PPCII::MO_TLSGDM_FLAG
@ 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:139
llvm::PPCVSXFMAMutateID
char & PPCVSXFMAMutateID
Definition: PPCVSXFMAMutate.cpp:389
llvm::PPCII::MO_ACCESS_MASK
@ MO_ACCESS_MASK
The next are not flags but distinct values.
Definition: PPC.h:157
llvm::createPPCTLSDynamicCallPass
FunctionPass * createPPCTLSDynamicCallPass()
Definition: PPCTLSDynamicCall.cpp:219
llvm::PPCII::MO_PIC_FLAG
@ MO_PIC_FLAG
MO_PIC_FLAG - If this bit is set, the symbol reference is relative to the function's picbase,...
Definition: PPC.h:109
llvm::createPPCTOCRegDepsPass
FunctionPass * createPPCTOCRegDepsPass()
llvm::PPCII::MO_TLS
@ MO_TLS
Definition: PPC.h:173
llvm::PPCII::MO_TLSLD_LO
@ MO_TLSLD_LO
Definition: PPC.h:169
llvm::initializePPCCTRLoopsVerifyPass
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
llvm::PPCII::MO_TOC_LO
@ MO_TOC_LO
Definition: PPC.h:170
llvm::createPPCBranchSelectionPass
FunctionPass * createPPCBranchSelectionPass()
llvm::createPPCPreEmitPeepholePass
FunctionPass * createPPCPreEmitPeepholePass()
llvm::initializePPCTLSDynamicCallPass
void initializePPCTLSDynamicCallPass(PassRegistry &)
llvm::createPPCBranchCoalescingPass
FunctionPass * createPPCBranchCoalescingPass()
createPPCBranchCoalescingPass - returns an instance of the Branch Coalescing Pass
Definition: PPCBranchCoalescing.cpp:193
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::createPPCMIPeepholePass
FunctionPass * createPPCMIPeepholePass()
Definition: PPCMIPeephole.cpp:1765
llvm::createPPCVSXSwapRemovalPass
FunctionPass * createPPCVSXSwapRemovalPass()
Definition: PPCVSXSwapRemoval.cpp:1074
llvm::createPPCReduceCRLogicalsPass
FunctionPass * createPPCReduceCRLogicalsPass()
Definition: PPCReduceCRLogicals.cpp:739
llvm::initializePPCExpandISELPass
void initializePPCExpandISELPass(PassRegistry &)
llvm::PPCII::MO_HA
@ MO_HA
Definition: PPC.h:161
llvm::PPCLowerMASSVEntriesID
char & PPCLowerMASSVEntriesID
Definition: PPCLowerMASSVEntries.cpp:190
llvm::initializePPCEarlyReturnPass
void initializePPCEarlyReturnPass(PassRegistry &)
CodeGen.h
llvm::initializePPCCTRLoopsPass
void initializePPCCTRLoopsPass(PassRegistry &)
llvm::initializePPCBoolRetToIntPass
void initializePPCBoolRetToIntPass(PassRegistry &)
llvm::initializePPCBranchCoalescingPass
void initializePPCBranchCoalescingPass(PassRegistry &)
llvm::PPCII::MO_PCREL_OPT_FLAG
@ MO_PCREL_OPT_FLAG
Definition: PPC.h:122
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::createPPCISelDag
FunctionPass * createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL)
createPPCISelDag - This pass converts a legalized DAG into a PowerPC-specific DAG,...
Definition: PPCISelDAGToDAG.cpp:7593
llvm::PPCII::MO_TPREL_FLAG
@ MO_TPREL_FLAG
MO_TPREL_FLAG - If this bit is set the symbol reference is relative to TLS Initial Exec model.
Definition: PPC.h:131
llvm::PPCII::MO_TPREL_LO
@ MO_TPREL_LO
Definition: PPC.h:163
llvm::initializePPCReduceCRLogicalsPass
void initializePPCReduceCRLogicalsPass(PassRegistry &)
llvm::initializePPCVSXSwapRemovalPass
void initializePPCVSXSwapRemovalPass(PassRegistry &)
llvm::createPPCExpandAtomicPseudoPass
FunctionPass * createPPCExpandAtomicPseudoPass()
llvm::PPCGenScalarMASSEntriesID
char & PPCGenScalarMASSEntriesID
Definition: PPCGenScalarMASSEntries.cpp:142