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