LLVM  12.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.
121 
122  /// MO_TPREL_FLAG - If this bit is set the symbol reference is relative to
123  /// TLS Initial Exec model.
125 
126  /// MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to
127  /// TLS Local Dynamic model.
129 
130  /// MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set
131  /// they should produce the relocation @got@tlsgd@pcrel.
132  /// Fix up is VK_PPC_GOT_TLSGD_PCREL
134 
135  /// MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set
136  /// they should produce the relocation @got@tlsld@pcrel.
137  /// Fix up is VK_PPC_GOT_TLSLD_PCREL
139 
140  /// MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set
141  /// they should produce the relocation @got@tprel@pcrel.
142  /// Fix up is VK_PPC_GOT_TPREL_PCREL
144 
145  /// The next are not flags but distinct values.
146  MO_ACCESS_MASK = 0xf00,
147 
148  /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
149  MO_LO = 1 << 8,
150  MO_HA = 2 << 8,
151 
152  MO_TPREL_LO = 4 << 8,
153  MO_TPREL_HA = 3 << 8,
154 
155  /// These values identify relocations on immediates folded
156  /// into memory operations.
157  MO_DTPREL_LO = 5 << 8,
158  MO_TLSLD_LO = 6 << 8,
159  MO_TOC_LO = 7 << 8,
160 
161  // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
162  MO_TLS = 8 << 8
163  };
164  } // end namespace PPCII
165 
166 } // end namespace llvm;
167 
168 #endif
void initializePPCTOCRegDepsPass(PassRegistry &)
void initializePPCVSXCopyPass(PassRegistry &)
void initializePPCLoopInstrFormPrepPass(PassRegistry &)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
FunctionPass * createPPCVSXSwapRemovalPass()
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO, MCOperand &OutMO, AsmPrinter &AP)
void initializePPCTLSDynamicCallPass(PassRegistry &)
FunctionPass * createPPCVSXFMAMutatePass()
MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
Definition: PPC.h:149
void initializePPCMIPeepholePass(PassRegistry &)
char & PPCLowerMASSVEntriesID
char & PPCVSXFMAMutateID
TOF
Target Operand Flag enum.
Definition: PPC.h:91
FunctionPass * createPPCTLSDynamicCallPass()
MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to TLS General Dynamic model.
Definition: PPC.h:120
FunctionPass * createPPCTOCRegDepsPass()
void initializePPCBSelPass(PassRegistry &)
ModulePass * createPPCLowerMASSVEntriesPass()
void initializePPCReduceCRLogicalsPass(PassRegistry &)
FunctionPass * createPPCCTRLoops()
void initializePPCBranchCoalescingPass(PassRegistry &)
FunctionPass * createPPCReduceCRLogicalsPass()
MO_TPREL_FLAG - If this bit is set the symbol reference is relative to TLS Initial Exec model.
Definition: PPC.h:124
FunctionPass * createPPCBranchCoalescingPass()
createPPCBranchCoalescingPass - returns an instance of the Branch Coalescing Pass
FunctionPass * createPPCCTRLoopsVerify()
Definition: PPCCTRLoops.cpp:79
FunctionPass * createPPCBoolRetToIntPass()
void initializePPCVSXSwapRemovalPass(PassRegistry &)
MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
Definition: PPC.h:138
FunctionPass * createPPCBranchSelectionPass()
void initializePPCBoolRetToIntPass(PassRegistry &)
FunctionPass * createPPCEarlyReturnPass()
InstructionSelector * createPPCInstructionSelector(const PPCTargetMachine &TM, const PPCSubtarget &Subtarget, const PPCRegisterBankInfo &RBI)
void initializePPCVSXFMAMutatePass(PassRegistry &)
MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to TLS Local Dynamic model.
Definition: PPC.h:128
void initializePPCEarlyReturnPass(PassRegistry &)
FunctionPass * createPPCVSXCopyPass()
void initializePPCCTRLoopsPass(PassRegistry &)
The next are not flags but distinct values.
Definition: PPC.h:146
void initializePPCExpandISELPass(PassRegistry &)
These values identify relocations on immediates folded into memory operations.
Definition: PPC.h:157
void initializePPCLowerMASSVEntriesPass(PassRegistry &)
FunctionPass * createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM)
MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
Definition: PPC.h:133
MO_GOT_FLAG - If this bit is set the symbol reference is to be computed via the GOT.
Definition: PPC.h:112
void initializePPCPreEmitPeepholePass(PassRegistry &)
FunctionPass * createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL)
createPPCISelDag - This pass converts a legalized DAG into a PowerPC-specific DAG,...
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP)
FunctionPass * createPPCMIPeepholePass()
FunctionPass * createPPCPreEmitPeepholePass()
IRTranslator LLVM IR MI
MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to the current instruction addre...
Definition: PPC.h:107
On a symbol operand "FOO", this indicates that the reference is actually to "FOO@plt".
Definition: PPC.h:99
MO_PIC_FLAG - If this bit is set, the symbol reference is relative to the function's picbase,...
Definition: PPC.h:103
FunctionPass * createPPCExpandISELPass()
MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set they should produce the reloc...
Definition: PPC.h:143