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