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 FunctionPass;
27class PassRegistry;
29
34
36 CodeGenOptLevel OptLevel);
37
39 : public RequiredPassInfoMixin<SparcDelaySlotFillerPass> {
40public:
43
47};
48
50
52 : public RequiredPassInfoMixin<SparcErrataWorkaroundPass> {
53public:
56};
57
61} // namespace llvm
62
63namespace llvm {
64 // Enums corresponding to Sparc condition codes, both icc's and fcc's. These
65 // values must be kept in sync with the ones in the .td file.
66 namespace SPCC {
67 enum CondCodes {
68 ICC_A = 8, // Always
69 ICC_N = 0, // Never
70 ICC_NE = 9, // Not Equal
71 ICC_E = 1, // Equal
72 ICC_G = 10, // Greater
73 ICC_LE = 2, // Less or Equal
74 ICC_GE = 11, // Greater or Equal
75 ICC_L = 3, // Less
76 ICC_GU = 12, // Greater Unsigned
77 ICC_LEU = 4, // Less or Equal Unsigned
78 ICC_CC = 13, // Carry Clear/Great or Equal Unsigned
79 ICC_CS = 5, // Carry Set/Less Unsigned
80 ICC_POS = 14, // Positive
81 ICC_NEG = 6, // Negative
82 ICC_VC = 15, // Overflow Clear
83 ICC_VS = 7, // Overflow Set
84
86 FCC_A = 8 + FCC_BEGIN, // Always
87 FCC_N = 0 + FCC_BEGIN, // Never
88 FCC_U = 7 + FCC_BEGIN, // Unordered
89 FCC_G = 6 + FCC_BEGIN, // Greater
90 FCC_UG = 5 + FCC_BEGIN, // Unordered or Greater
91 FCC_L = 4 + FCC_BEGIN, // Less
92 FCC_UL = 3 + FCC_BEGIN, // Unordered or Less
93 FCC_LG = 2 + FCC_BEGIN, // Less or Greater
94 FCC_NE = 1 + FCC_BEGIN, // Not Equal
95 FCC_E = 9 + FCC_BEGIN, // Equal
96 FCC_UE = 10 + FCC_BEGIN, // Unordered or Equal
97 FCC_GE = 11 + FCC_BEGIN, // Greater or Equal
98 FCC_UGE = 12 + FCC_BEGIN, // Unordered or Greater or Equal
99 FCC_LE = 13 + FCC_BEGIN, // Less or Equal
100 FCC_ULE = 14 + FCC_BEGIN, // Unordered or Less or Equal
101 FCC_O = 15 + FCC_BEGIN, // Ordered
102
104 CPCC_A = 8 + CPCC_BEGIN, // Always
105 CPCC_N = 0 + CPCC_BEGIN, // Never
120
122 REG_Z = 1 + REG_BEGIN, // Is zero
123 REG_LEZ = 2 + REG_BEGIN, // Less or equal to zero
124 REG_LZ = 3 + REG_BEGIN, // Less than zero
125 REG_NZ = 5 + REG_BEGIN, // Is not zero
126 REG_GZ = 6 + REG_BEGIN, // Greater than zero
127 REG_GEZ = 7 + REG_BEGIN // Greater than or equal to zero
128 };
129 }
130
131 inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
132 switch (CC) {
133 case SPCC::ICC_A: return "a";
134 case SPCC::ICC_N: return "n";
135 case SPCC::ICC_NE: return "ne";
136 case SPCC::ICC_E: return "e";
137 case SPCC::ICC_G: return "g";
138 case SPCC::ICC_LE: return "le";
139 case SPCC::ICC_GE: return "ge";
140 case SPCC::ICC_L: return "l";
141 case SPCC::ICC_GU: return "gu";
142 case SPCC::ICC_LEU: return "leu";
143 case SPCC::ICC_CC: return "cc";
144 case SPCC::ICC_CS: return "cs";
145 case SPCC::ICC_POS: return "pos";
146 case SPCC::ICC_NEG: return "neg";
147 case SPCC::ICC_VC: return "vc";
148 case SPCC::ICC_VS: return "vs";
149 case SPCC::FCC_A: return "a";
150 case SPCC::FCC_N: return "n";
151 case SPCC::FCC_U: return "u";
152 case SPCC::FCC_G: return "g";
153 case SPCC::FCC_UG: return "ug";
154 case SPCC::FCC_L: return "l";
155 case SPCC::FCC_UL: return "ul";
156 case SPCC::FCC_LG: return "lg";
157 case SPCC::FCC_NE: return "ne";
158 case SPCC::FCC_E: return "e";
159 case SPCC::FCC_UE: return "ue";
160 case SPCC::FCC_GE: return "ge";
161 case SPCC::FCC_UGE: return "uge";
162 case SPCC::FCC_LE: return "le";
163 case SPCC::FCC_ULE: return "ule";
164 case SPCC::FCC_O: return "o";
165 case SPCC::CPCC_A: return "a";
166 case SPCC::CPCC_N: return "n";
167 case SPCC::CPCC_3: return "3";
168 case SPCC::CPCC_2: return "2";
169 case SPCC::CPCC_23: return "23";
170 case SPCC::CPCC_1: return "1";
171 case SPCC::CPCC_13: return "13";
172 case SPCC::CPCC_12: return "12";
173 case SPCC::CPCC_123: return "123";
174 case SPCC::CPCC_0: return "0";
175 case SPCC::CPCC_03: return "03";
176 case SPCC::CPCC_02: return "02";
177 case SPCC::CPCC_023: return "023";
178 case SPCC::CPCC_01: return "01";
179 case SPCC::CPCC_013: return "013";
180 case SPCC::CPCC_012: return "012";
181 case SPCC::REG_BEGIN:
182 llvm_unreachable("Use of reserved cond code");
183 case SPCC::REG_Z:
184 return "z";
185 case SPCC::REG_LEZ:
186 return "lez";
187 case SPCC::REG_LZ:
188 return "lz";
189 case SPCC::REG_NZ:
190 return "nz";
191 case SPCC::REG_GZ:
192 return "gz";
193 case SPCC::REG_GEZ:
194 return "gez";
195 }
196 llvm_unreachable("Invalid cond code");
197 }
198
199 inline static unsigned HI22(int64_t imm) {
200 return (unsigned)((imm >> 10) & ((1 << 22)-1));
201 }
202
203 inline static unsigned LO10(int64_t imm) {
204 return (unsigned)(imm & 0x3FF);
205 }
206
207 inline static unsigned HIX22(int64_t imm) {
208 return HI22(~imm);
209 }
210
211 inline static unsigned LOX10(int64_t imm) {
212 return ~LO10(~imm);
213 }
214
215} // end namespace llvm
216#endif
This header defines various interfaces for pass management in LLVM.
RISCVCC::CondCode CC
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
Properties which a MachineFunction may have at a given point in time.
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:44
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:114
@ CPCC_013
Definition Sparc.h:118
@ FCC_ULE
Definition Sparc.h:100
@ ICC_POS
Definition Sparc.h:80
@ FCC_UG
Definition Sparc.h:90
@ ICC_N
Definition Sparc.h:69
@ CPCC_123
Definition Sparc.h:112
@ ICC_G
Definition Sparc.h:72
@ REG_LEZ
Definition Sparc.h:123
@ CPCC_23
Definition Sparc.h:108
@ FCC_BEGIN
Definition Sparc.h:85
@ ICC_L
Definition Sparc.h:75
@ REG_BEGIN
Definition Sparc.h:121
@ FCC_NE
Definition Sparc.h:94
@ CPCC_01
Definition Sparc.h:117
@ CPCC_12
Definition Sparc.h:111
@ ICC_CS
Definition Sparc.h:79
@ FCC_LG
Definition Sparc.h:93
@ ICC_VS
Definition Sparc.h:83
@ ICC_LEU
Definition Sparc.h:77
@ CPCC_BEGIN
Definition Sparc.h:103
@ FCC_LE
Definition Sparc.h:99
@ CPCC_012
Definition Sparc.h:119
@ ICC_LE
Definition Sparc.h:73
@ FCC_U
Definition Sparc.h:88
@ FCC_A
Definition Sparc.h:86
@ CPCC_023
Definition Sparc.h:116
@ CPCC_13
Definition Sparc.h:110
@ ICC_GE
Definition Sparc.h:74
@ FCC_E
Definition Sparc.h:95
@ CPCC_02
Definition Sparc.h:115
@ FCC_L
Definition Sparc.h:91
@ ICC_GU
Definition Sparc.h:76
@ ICC_NE
Definition Sparc.h:70
@ FCC_UE
Definition Sparc.h:96
@ ICC_E
Definition Sparc.h:71
@ FCC_GE
Definition Sparc.h:97
@ ICC_A
Definition Sparc.h:68
@ FCC_UGE
Definition Sparc.h:98
@ ICC_VC
Definition Sparc.h:82
@ ICC_CC
Definition Sparc.h:78
@ REG_GEZ
Definition Sparc.h:127
@ FCC_G
Definition Sparc.h:89
@ FCC_UL
Definition Sparc.h:92
@ FCC_N
Definition Sparc.h:87
@ ICC_NEG
Definition Sparc.h:81
This is an optimization pass for GlobalISel generic memory operations.
static const char * SPARCCondCodeToString(SPCC::CondCodes CC)
Definition Sparc.h:131
static unsigned HI22(int64_t imm)
Definition Sparc.h:199
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
static unsigned HIX22(int64_t imm)
Definition Sparc.h:207
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:211
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:203
A CRTP mix-in for passes that should not be skipped.