LLVM 24.0.0git
Sparc.h
Go to the documentation of this file.
1//===-- Sparc.h - Top-level interface for Sparc representation --*- 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// Sparc back-end.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_SPARC_SPARC_H
15#define LLVM_LIB_TARGET_SPARC_SPARC_H
16
20#include "llvm/IR/Analysis.h"
21#include "llvm/IR/PassManager.h"
24
25namespace llvm {
26class AsmPrinter;
27class FunctionPass;
28class MCInst;
29class MachineInstr;
30class PassRegistry;
32
37
39 CodeGenOptLevel OptLevel);
40
42 : public RequiredPassInfoMixin<SparcDelaySlotFillerPass> {
43public:
46
50};
51
53
55 : public RequiredPassInfoMixin<SparcInsertNOPLoadPass> {
56public:
59};
60
62 : public RequiredPassInfoMixin<SparcDetectRoundChangePass> {
63public:
66};
67
69 : public RequiredPassInfoMixin<SparcFixAllFDIVSQRTPass> {
70public:
73};
74
76 : public RequiredPassInfoMixin<SparcErrataWorkaroundPass> {
77public:
80};
81
85} // namespace llvm
86
87namespace llvm {
88 // Enums corresponding to Sparc condition codes, both icc's and fcc's. These
89 // values must be kept in sync with the ones in the .td file.
90 namespace SPCC {
91 enum CondCodes {
92 ICC_A = 8, // Always
93 ICC_N = 0, // Never
94 ICC_NE = 9, // Not Equal
95 ICC_E = 1, // Equal
96 ICC_G = 10, // Greater
97 ICC_LE = 2, // Less or Equal
98 ICC_GE = 11, // Greater or Equal
99 ICC_L = 3, // Less
100 ICC_GU = 12, // Greater Unsigned
101 ICC_LEU = 4, // Less or Equal Unsigned
102 ICC_CC = 13, // Carry Clear/Great or Equal Unsigned
103 ICC_CS = 5, // Carry Set/Less Unsigned
104 ICC_POS = 14, // Positive
105 ICC_NEG = 6, // Negative
106 ICC_VC = 15, // Overflow Clear
107 ICC_VS = 7, // Overflow Set
108
110 FCC_A = 8 + FCC_BEGIN, // Always
111 FCC_N = 0 + FCC_BEGIN, // Never
112 FCC_U = 7 + FCC_BEGIN, // Unordered
113 FCC_G = 6 + FCC_BEGIN, // Greater
114 FCC_UG = 5 + FCC_BEGIN, // Unordered or Greater
115 FCC_L = 4 + FCC_BEGIN, // Less
116 FCC_UL = 3 + FCC_BEGIN, // Unordered or Less
117 FCC_LG = 2 + FCC_BEGIN, // Less or Greater
118 FCC_NE = 1 + FCC_BEGIN, // Not Equal
119 FCC_E = 9 + FCC_BEGIN, // Equal
120 FCC_UE = 10 + FCC_BEGIN, // Unordered or Equal
121 FCC_GE = 11 + FCC_BEGIN, // Greater or Equal
122 FCC_UGE = 12 + FCC_BEGIN, // Unordered or Greater or Equal
123 FCC_LE = 13 + FCC_BEGIN, // Less or Equal
124 FCC_ULE = 14 + FCC_BEGIN, // Unordered or Less or Equal
125 FCC_O = 15 + FCC_BEGIN, // Ordered
126
128 CPCC_A = 8 + CPCC_BEGIN, // Always
129 CPCC_N = 0 + CPCC_BEGIN, // Never
144
146 REG_Z = 1 + REG_BEGIN, // Is zero
147 REG_LEZ = 2 + REG_BEGIN, // Less or equal to zero
148 REG_LZ = 3 + REG_BEGIN, // Less than zero
149 REG_NZ = 5 + REG_BEGIN, // Is not zero
150 REG_GZ = 6 + REG_BEGIN, // Greater than zero
151 REG_GEZ = 7 + REG_BEGIN // Greater than or equal to zero
152 };
153 }
154
155 inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
156 switch (CC) {
157 case SPCC::ICC_A: return "a";
158 case SPCC::ICC_N: return "n";
159 case SPCC::ICC_NE: return "ne";
160 case SPCC::ICC_E: return "e";
161 case SPCC::ICC_G: return "g";
162 case SPCC::ICC_LE: return "le";
163 case SPCC::ICC_GE: return "ge";
164 case SPCC::ICC_L: return "l";
165 case SPCC::ICC_GU: return "gu";
166 case SPCC::ICC_LEU: return "leu";
167 case SPCC::ICC_CC: return "cc";
168 case SPCC::ICC_CS: return "cs";
169 case SPCC::ICC_POS: return "pos";
170 case SPCC::ICC_NEG: return "neg";
171 case SPCC::ICC_VC: return "vc";
172 case SPCC::ICC_VS: return "vs";
173 case SPCC::FCC_A: return "a";
174 case SPCC::FCC_N: return "n";
175 case SPCC::FCC_U: return "u";
176 case SPCC::FCC_G: return "g";
177 case SPCC::FCC_UG: return "ug";
178 case SPCC::FCC_L: return "l";
179 case SPCC::FCC_UL: return "ul";
180 case SPCC::FCC_LG: return "lg";
181 case SPCC::FCC_NE: return "ne";
182 case SPCC::FCC_E: return "e";
183 case SPCC::FCC_UE: return "ue";
184 case SPCC::FCC_GE: return "ge";
185 case SPCC::FCC_UGE: return "uge";
186 case SPCC::FCC_LE: return "le";
187 case SPCC::FCC_ULE: return "ule";
188 case SPCC::FCC_O: return "o";
189 case SPCC::CPCC_A: return "a";
190 case SPCC::CPCC_N: return "n";
191 case SPCC::CPCC_3: return "3";
192 case SPCC::CPCC_2: return "2";
193 case SPCC::CPCC_23: return "23";
194 case SPCC::CPCC_1: return "1";
195 case SPCC::CPCC_13: return "13";
196 case SPCC::CPCC_12: return "12";
197 case SPCC::CPCC_123: return "123";
198 case SPCC::CPCC_0: return "0";
199 case SPCC::CPCC_03: return "03";
200 case SPCC::CPCC_02: return "02";
201 case SPCC::CPCC_023: return "023";
202 case SPCC::CPCC_01: return "01";
203 case SPCC::CPCC_013: return "013";
204 case SPCC::CPCC_012: return "012";
205 case SPCC::REG_BEGIN:
206 llvm_unreachable("Use of reserved cond code");
207 case SPCC::REG_Z:
208 return "z";
209 case SPCC::REG_LEZ:
210 return "lez";
211 case SPCC::REG_LZ:
212 return "lz";
213 case SPCC::REG_NZ:
214 return "nz";
215 case SPCC::REG_GZ:
216 return "gz";
217 case SPCC::REG_GEZ:
218 return "gez";
219 }
220 llvm_unreachable("Invalid cond code");
221 }
222
223 inline static unsigned HI22(int64_t imm) {
224 return (unsigned)((imm >> 10) & ((1 << 22)-1));
225 }
226
227 inline static unsigned LO10(int64_t imm) {
228 return (unsigned)(imm & 0x3FF);
229 }
230
231 inline static unsigned HIX22(int64_t imm) {
232 return HI22(~imm);
233 }
234
235 inline static unsigned LOX10(int64_t imm) {
236 return ~LO10(~imm);
237 }
238
239} // end namespace llvm
240#endif
This header defines various interfaces for pass management in LLVM.
RISCVCC::CondCode CC
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:95
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Properties which a MachineFunction may have at a given point in time.
Representation of each machine instruction.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
SelectionDAGISelPass(std::unique_ptr< SelectionDAGISel > Selector)
SparcDAGToDAGISelPass(SparcTargetMachine &TM, CodeGenOptLevel OptLevel)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
MachineFunctionProperties getRequiredProperties() const
Definition Sparc.h:47
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Pass manager infrastructure for declaring and invalidating analyses.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ CPCC_03
Definition Sparc.h:138
@ CPCC_013
Definition Sparc.h:142
@ FCC_ULE
Definition Sparc.h:124
@ ICC_POS
Definition Sparc.h:104
@ ICC_N
Definition Sparc.h:93
@ CPCC_123
Definition Sparc.h:136
@ ICC_G
Definition Sparc.h:96
@ REG_LEZ
Definition Sparc.h:147
@ CPCC_23
Definition Sparc.h:132
@ FCC_BEGIN
Definition Sparc.h:109
@ ICC_L
Definition Sparc.h:99
@ REG_BEGIN
Definition Sparc.h:145
@ CPCC_01
Definition Sparc.h:141
@ CPCC_12
Definition Sparc.h:135
@ ICC_LEU
Definition Sparc.h:101
@ CPCC_BEGIN
Definition Sparc.h:127
@ CPCC_012
Definition Sparc.h:143
@ ICC_LE
Definition Sparc.h:97
@ CPCC_023
Definition Sparc.h:140
@ CPCC_13
Definition Sparc.h:134
@ ICC_GE
Definition Sparc.h:98
@ CPCC_02
Definition Sparc.h:139
@ ICC_NE
Definition Sparc.h:94
@ ICC_E
Definition Sparc.h:95
@ ICC_A
Definition Sparc.h:92
@ FCC_UGE
Definition Sparc.h:122
@ REG_GEZ
Definition Sparc.h:151
@ ICC_NEG
Definition Sparc.h:105
This is an optimization pass for GlobalISel generic memory operations.
static const char * SPARCCondCodeToString(SPCC::CondCodes CC)
Definition Sparc.h:155
static unsigned HI22(int64_t imm)
Definition Sparc.h:223
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
static unsigned HIX22(int64_t imm)
Definition Sparc.h:231
void initializeSparcAsmPrinterPass(PassRegistry &)
void initializeSparcDAGToDAGISelLegacyPass(PassRegistry &)
void initializeSparcErrataWorkaroundLegacyPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:280
static unsigned LOX10(int64_t imm)
Definition Sparc.h:235
FunctionPass * createSparcDAGToDAGISelLegacyPass(SparcTargetMachine &TM, CodeGenOptLevel OptLevel)
createSparcISelDag - This pass converts a legalized DAG into a SPARC-specific DAG,...
FunctionPass * createSparcDelaySlotFillerLegacyPass()
createSparcDelaySlotFillerPass - Returns a pass that fills in delay slots in Sparc MachineFunctions
static unsigned LO10(int64_t imm)
Definition Sparc.h:227
A CRTP mix-in for passes that should not be skipped.