LLVM  15.0.0git
SystemZ.h
Go to the documentation of this file.
1 //==- SystemZ.h - Top-Level Interface for SystemZ 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
10 // the LLVM SystemZ backend.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZ_H
15 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZ_H
16 
18 #include "llvm/Support/CodeGen.h"
19 
20 namespace llvm {
21 class SystemZTargetMachine;
22 class FunctionPass;
23 class PassRegistry;
24 
25 namespace SystemZ {
26 // Condition-code mask values.
27 const unsigned CCMASK_0 = 1 << 3;
28 const unsigned CCMASK_1 = 1 << 2;
29 const unsigned CCMASK_2 = 1 << 1;
30 const unsigned CCMASK_3 = 1 << 0;
31 const unsigned CCMASK_ANY = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;
32 
33 // Condition-code mask assignments for integer and floating-point
34 // comparisons.
35 const unsigned CCMASK_CMP_EQ = CCMASK_0;
36 const unsigned CCMASK_CMP_LT = CCMASK_1;
37 const unsigned CCMASK_CMP_GT = CCMASK_2;
41 
42 // Condition-code mask assignments for floating-point comparisons only.
43 const unsigned CCMASK_CMP_UO = CCMASK_3;
45 
46 // All condition-code values produced by comparisons.
47 const unsigned CCMASK_ICMP = CCMASK_0 | CCMASK_1 | CCMASK_2;
49 
50 // Condition-code mask assignments for arithmetical operations.
51 const unsigned CCMASK_ARITH_EQ = CCMASK_0;
52 const unsigned CCMASK_ARITH_LT = CCMASK_1;
53 const unsigned CCMASK_ARITH_GT = CCMASK_2;
55 const unsigned CCMASK_ARITH = CCMASK_ANY;
56 
57 // Condition-code mask assignments for logical operations.
64 const unsigned CCMASK_LOGICAL = CCMASK_ANY;
65 
66 // Condition-code mask assignments for CS.
67 const unsigned CCMASK_CS_EQ = CCMASK_0;
68 const unsigned CCMASK_CS_NE = CCMASK_1;
69 const unsigned CCMASK_CS = CCMASK_0 | CCMASK_1;
70 
71 // Condition-code mask assignments for a completed SRST loop.
72 const unsigned CCMASK_SRST_FOUND = CCMASK_1;
73 const unsigned CCMASK_SRST_NOTFOUND = CCMASK_2;
74 const unsigned CCMASK_SRST = CCMASK_1 | CCMASK_2;
75 
76 // Condition-code mask assignments for TEST UNDER MASK.
77 const unsigned CCMASK_TM_ALL_0 = CCMASK_0;
80 const unsigned CCMASK_TM_ALL_1 = CCMASK_3;
83 const unsigned CCMASK_TM_MSB_0 = CCMASK_0 | CCMASK_1;
84 const unsigned CCMASK_TM_MSB_1 = CCMASK_2 | CCMASK_3;
85 const unsigned CCMASK_TM = CCMASK_ANY;
86 
87 // Condition-code mask assignments for TRANSACTION_BEGIN.
92 const unsigned CCMASK_TBEGIN = CCMASK_ANY;
93 
94 // Condition-code mask assignments for TRANSACTION_END.
95 const unsigned CCMASK_TEND_TX = CCMASK_0;
96 const unsigned CCMASK_TEND_NOTX = CCMASK_2;
98 
99 // Condition-code mask assignments for vector comparisons (and similar
100 // operations).
101 const unsigned CCMASK_VCMP_ALL = CCMASK_0;
102 const unsigned CCMASK_VCMP_MIXED = CCMASK_1;
103 const unsigned CCMASK_VCMP_NONE = CCMASK_3;
104 const unsigned CCMASK_VCMP = CCMASK_0 | CCMASK_1 | CCMASK_3;
105 
106 // Condition-code mask assignments for Test Data Class.
107 const unsigned CCMASK_TDC_NOMATCH = CCMASK_0;
108 const unsigned CCMASK_TDC_MATCH = CCMASK_1;
110 
111 // The position of the low CC bit in an IPM result.
112 const unsigned IPM_CC = 28;
113 
114 // Mask assignments for PFD.
115 const unsigned PFD_READ = 1;
116 const unsigned PFD_WRITE = 2;
117 
118 // Mask assignments for TDC
119 const unsigned TDCMASK_ZERO_PLUS = 0x800;
120 const unsigned TDCMASK_ZERO_MINUS = 0x400;
121 const unsigned TDCMASK_NORMAL_PLUS = 0x200;
122 const unsigned TDCMASK_NORMAL_MINUS = 0x100;
123 const unsigned TDCMASK_SUBNORMAL_PLUS = 0x080;
124 const unsigned TDCMASK_SUBNORMAL_MINUS = 0x040;
125 const unsigned TDCMASK_INFINITY_PLUS = 0x020;
126 const unsigned TDCMASK_INFINITY_MINUS = 0x010;
127 const unsigned TDCMASK_QNAN_PLUS = 0x008;
128 const unsigned TDCMASK_QNAN_MINUS = 0x004;
129 const unsigned TDCMASK_SNAN_PLUS = 0x002;
130 const unsigned TDCMASK_SNAN_MINUS = 0x001;
131 
139 const unsigned TDCMASK_NAN = TDCMASK_QNAN_PLUS |
143 const unsigned TDCMASK_PLUS = TDCMASK_POSITIVE |
147 const unsigned TDCMASK_MINUS = TDCMASK_NEGATIVE |
152 
153 // Number of bits in a vector register.
154 const unsigned VectorBits = 128;
155 
156 // Number of bytes in a vector register (and consequently the number of
157 // bytes in a general permute vector).
158 const unsigned VectorBytes = VectorBits / 8;
159 
160 // Return true if Val fits an LLILL operand.
161 static inline bool isImmLL(uint64_t Val) {
162  return (Val & ~0x000000000000ffffULL) == 0;
163 }
164 
165 // Return true if Val fits an LLILH operand.
166 static inline bool isImmLH(uint64_t Val) {
167  return (Val & ~0x00000000ffff0000ULL) == 0;
168 }
169 
170 // Return true if Val fits an LLIHL operand.
171 static inline bool isImmHL(uint64_t Val) {
172  return (Val & ~0x00000ffff00000000ULL) == 0;
173 }
174 
175 // Return true if Val fits an LLIHH operand.
176 static inline bool isImmHH(uint64_t Val) {
177  return (Val & ~0xffff000000000000ULL) == 0;
178 }
179 
180 // Return true if Val fits an LLILF operand.
181 static inline bool isImmLF(uint64_t Val) {
182  return (Val & ~0x00000000ffffffffULL) == 0;
183 }
184 
185 // Return true if Val fits an LLIHF operand.
186 static inline bool isImmHF(uint64_t Val) {
187  return (Val & ~0xffffffff00000000ULL) == 0;
188 }
189 } // end namespace SystemZ
190 
191 FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM,
192  CodeGenOpt::Level OptLevel);
193 FunctionPass *createSystemZElimComparePass(SystemZTargetMachine &TM);
194 FunctionPass *createSystemZShortenInstPass(SystemZTargetMachine &TM);
195 FunctionPass *createSystemZLongBranchPass(SystemZTargetMachine &TM);
196 FunctionPass *createSystemZLDCleanupPass(SystemZTargetMachine &TM);
197 FunctionPass *createSystemZCopyPhysRegsPass(SystemZTargetMachine &TM);
198 FunctionPass *createSystemZPostRewritePass(SystemZTargetMachine &TM);
199 FunctionPass *createSystemZTDCPass();
200 
201 void initializeSystemZElimComparePass(PassRegistry &);
202 void initializeSystemZShortenInstPass(PassRegistry &);
203 void initializeSystemZLongBranchPass(PassRegistry &);
204 void initializeSystemZLDCleanupPass(PassRegistry &);
205 void initializeSystemZCopyPhysRegsPass(PassRegistry &);
206 void initializeSystemZPostRewritePass(PassRegistry &);
207 void initializeSystemZTDCPassPass(PassRegistry &);
208 
209 } // end namespace llvm
210 
211 #endif
llvm::SystemZ::isImmLH
static bool isImmLH(uint64_t Val)
Definition: SystemZ.h:166
llvm::initializeSystemZCopyPhysRegsPass
void initializeSystemZCopyPhysRegsPass(PassRegistry &)
llvm::initializeSystemZLDCleanupPass
void initializeSystemZLDCleanupPass(PassRegistry &)
llvm::createSystemZLongBranchPass
FunctionPass * createSystemZLongBranchPass(SystemZTargetMachine &TM)
Definition: SystemZLongBranch.cpp:485
llvm::SystemZ::CCMASK_ARITH_EQ
const unsigned CCMASK_ARITH_EQ
Definition: SystemZ.h:51
llvm::SystemZ::CCMASK_TM_MIXED_MSB_1
const unsigned CCMASK_TM_MIXED_MSB_1
Definition: SystemZ.h:79
llvm::SystemZ::CCMASK_TBEGIN
const unsigned CCMASK_TBEGIN
Definition: SystemZ.h:92
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::SystemZ::TDCMASK_NAN
const unsigned TDCMASK_NAN
Definition: SystemZ.h:139
llvm::SystemZ::CCMASK_VCMP
const unsigned CCMASK_VCMP
Definition: SystemZ.h:104
llvm::SystemZ::CCMASK_ARITH
const unsigned CCMASK_ARITH
Definition: SystemZ.h:55
llvm::SystemZ::CCMASK_0
const unsigned CCMASK_0
Definition: SystemZ.h:27
llvm::SystemZ::CCMASK_FCMP
const unsigned CCMASK_FCMP
Definition: SystemZ.h:48
llvm::SystemZ::TDCMASK_QNAN_MINUS
const unsigned TDCMASK_QNAN_MINUS
Definition: SystemZ.h:128
llvm::SystemZ::CCMASK_1
const unsigned CCMASK_1
Definition: SystemZ.h:28
llvm::SystemZ::CCMASK_ARITH_OVERFLOW
const unsigned CCMASK_ARITH_OVERFLOW
Definition: SystemZ.h:54
llvm::SystemZ::isImmHL
static bool isImmHL(uint64_t Val)
Definition: SystemZ.h:171
llvm::SystemZ::TDCMASK_NORMAL_PLUS
const unsigned TDCMASK_NORMAL_PLUS
Definition: SystemZ.h:121
llvm::SystemZ::CCMASK_CMP_LT
const unsigned CCMASK_CMP_LT
Definition: SystemZ.h:36
llvm::createSystemZISelDag
FunctionPass * createSystemZISelDag(SystemZTargetMachine &TM, CodeGenOpt::Level OptLevel)
Definition: SystemZISelDAGToDAG.cpp:381
llvm::SystemZ::CCMASK_3
const unsigned CCMASK_3
Definition: SystemZ.h:30
llvm::SystemZ::CCMASK_LOGICAL_ZERO
const unsigned CCMASK_LOGICAL_ZERO
Definition: SystemZ.h:58
llvm::SystemZ::isImmHH
static bool isImmHH(uint64_t Val)
Definition: SystemZ.h:176
llvm::SystemZ::CCMASK_CS_EQ
const unsigned CCMASK_CS_EQ
Definition: SystemZ.h:67
llvm::SystemZ::CCMASK_CMP_LE
const unsigned CCMASK_CMP_LE
Definition: SystemZ.h:39
llvm::initializeSystemZPostRewritePass
void initializeSystemZPostRewritePass(PassRegistry &)
llvm::SystemZ::CCMASK_TBEGIN_STARTED
const unsigned CCMASK_TBEGIN_STARTED
Definition: SystemZ.h:88
SystemZMCTargetDesc.h
llvm::SystemZ::CCMASK_TBEGIN_PERSISTENT
const unsigned CCMASK_TBEGIN_PERSISTENT
Definition: SystemZ.h:91
llvm::SystemZ::isImmLF
static bool isImmLF(uint64_t Val)
Definition: SystemZ.h:181
llvm::SystemZ::CCMASK_CMP_EQ
const unsigned CCMASK_CMP_EQ
Definition: SystemZ.h:35
llvm::SystemZ::TDCMASK_ZERO
const unsigned TDCMASK_ZERO
Definition: SystemZ.h:132
llvm::SystemZ::CCMASK_SRST_FOUND
const unsigned CCMASK_SRST_FOUND
Definition: SystemZ.h:72
llvm::SystemZ::CCMASK_TEND
const unsigned CCMASK_TEND
Definition: SystemZ.h:97
llvm::SystemZ::CCMASK_VCMP_MIXED
const unsigned CCMASK_VCMP_MIXED
Definition: SystemZ.h:102
llvm::initializeSystemZLongBranchPass
void initializeSystemZLongBranchPass(PassRegistry &)
llvm::SystemZ::CCMASK_ARITH_GT
const unsigned CCMASK_ARITH_GT
Definition: SystemZ.h:53
llvm::SystemZ::CCMASK_TM_MSB_1
const unsigned CCMASK_TM_MSB_1
Definition: SystemZ.h:84
llvm::SystemZ::CCMASK_CS_NE
const unsigned CCMASK_CS_NE
Definition: SystemZ.h:68
llvm::SystemZ::CCMASK_LOGICAL_NOCARRY
const unsigned CCMASK_LOGICAL_NOCARRY
Definition: SystemZ.h:61
llvm::SystemZ::TDCMASK_PLUS
const unsigned TDCMASK_PLUS
Definition: SystemZ.h:143
llvm::SystemZ::TDCMASK_INFINITY_MINUS
const unsigned TDCMASK_INFINITY_MINUS
Definition: SystemZ.h:126
llvm::createSystemZShortenInstPass
FunctionPass * createSystemZShortenInstPass(SystemZTargetMachine &TM)
llvm::SystemZ::TDCMASK_POSITIVE
const unsigned TDCMASK_POSITIVE
Definition: SystemZ.h:133
llvm::SystemZ::TDCMASK_QNAN_PLUS
const unsigned TDCMASK_QNAN_PLUS
Definition: SystemZ.h:127
llvm::SystemZ::CCMASK_TM_MSB_0
const unsigned CCMASK_TM_MSB_0
Definition: SystemZ.h:83
llvm::SystemZ::CCMASK_CMP_GT
const unsigned CCMASK_CMP_GT
Definition: SystemZ.h:37
llvm::SystemZ::CCMASK_TBEGIN_TRANSIENT
const unsigned CCMASK_TBEGIN_TRANSIENT
Definition: SystemZ.h:90
llvm::SystemZ::CCMASK_TDC_MATCH
const unsigned CCMASK_TDC_MATCH
Definition: SystemZ.h:108
llvm::SystemZ::CCMASK_CMP_O
const unsigned CCMASK_CMP_O
Definition: SystemZ.h:44
llvm::SystemZ::TDCMASK_ZERO_MINUS
const unsigned TDCMASK_ZERO_MINUS
Definition: SystemZ.h:120
llvm::SystemZ::CCMASK_CMP_NE
const unsigned CCMASK_CMP_NE
Definition: SystemZ.h:38
llvm::SystemZ::CCMASK_LOGICAL
const unsigned CCMASK_LOGICAL
Definition: SystemZ.h:64
llvm::SystemZ::CCMASK_VCMP_ALL
const unsigned CCMASK_VCMP_ALL
Definition: SystemZ.h:101
llvm::SystemZ::CCMASK_TDC_NOMATCH
const unsigned CCMASK_TDC_NOMATCH
Definition: SystemZ.h:107
llvm::SystemZ::CCMASK_LOGICAL_NOBORROW
const unsigned CCMASK_LOGICAL_NOBORROW
Definition: SystemZ.h:63
llvm::SystemZ::CCMASK_SRST
const unsigned CCMASK_SRST
Definition: SystemZ.h:74
llvm::SystemZ::isImmLL
static bool isImmLL(uint64_t Val)
Definition: SystemZ.h:161
llvm::SystemZ::VectorBytes
const unsigned VectorBytes
Definition: SystemZ.h:158
llvm::SystemZ::CCMASK_ANY
const unsigned CCMASK_ANY
Definition: SystemZ.h:31
uint64_t
llvm::SystemZ::CCMASK_TEND_NOTX
const unsigned CCMASK_TEND_NOTX
Definition: SystemZ.h:96
llvm::SystemZ::CCMASK_ICMP
const unsigned CCMASK_ICMP
Definition: SystemZ.h:47
llvm::createSystemZElimComparePass
FunctionPass * createSystemZElimComparePass(SystemZTargetMachine &TM)
Definition: SystemZElimCompare.cpp:748
llvm::SystemZ::TDCMASK_INFINITY_PLUS
const unsigned TDCMASK_INFINITY_PLUS
Definition: SystemZ.h:125
llvm::SystemZ::CCMASK_CS
const unsigned CCMASK_CS
Definition: SystemZ.h:69
llvm::SystemZ::CCMASK_TM_MIXED_MSB_0
const unsigned CCMASK_TM_MIXED_MSB_0
Definition: SystemZ.h:78
llvm::SystemZ::TDCMASK_ZERO_PLUS
const unsigned TDCMASK_ZERO_PLUS
Definition: SystemZ.h:119
llvm::SystemZ::CCMASK_TM_SOME_1
const unsigned CCMASK_TM_SOME_1
Definition: SystemZ.h:82
llvm::SystemZ::TDCMASK_NORMAL_MINUS
const unsigned TDCMASK_NORMAL_MINUS
Definition: SystemZ.h:122
llvm::SystemZ::CCMASK_LOGICAL_CARRY
const unsigned CCMASK_LOGICAL_CARRY
Definition: SystemZ.h:60
llvm::SystemZ::CCMASK_VCMP_NONE
const unsigned CCMASK_VCMP_NONE
Definition: SystemZ.h:103
llvm::SystemZ::CCMASK_CMP_GE
const unsigned CCMASK_CMP_GE
Definition: SystemZ.h:40
llvm::SystemZ::CCMASK_CMP_UO
const unsigned CCMASK_CMP_UO
Definition: SystemZ.h:43
llvm::SystemZ::CCMASK_TDC
const unsigned CCMASK_TDC
Definition: SystemZ.h:109
llvm::SystemZ::VectorBits
const unsigned VectorBits
Definition: SystemZ.h:154
llvm::SystemZ::TDCMASK_MINUS
const unsigned TDCMASK_MINUS
Definition: SystemZ.h:147
llvm::SystemZ::CCMASK_LOGICAL_BORROW
const unsigned CCMASK_LOGICAL_BORROW
Definition: SystemZ.h:62
llvm::createSystemZTDCPass
FunctionPass * createSystemZTDCPass()
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::SystemZ::CCMASK_TM
const unsigned CCMASK_TM
Definition: SystemZ.h:85
llvm::SystemZ::TDCMASK_NEGATIVE
const unsigned TDCMASK_NEGATIVE
Definition: SystemZ.h:136
llvm::SystemZ::CCMASK_ARITH_LT
const unsigned CCMASK_ARITH_LT
Definition: SystemZ.h:52
llvm::SystemZ::TDCMASK_SNAN_MINUS
const unsigned TDCMASK_SNAN_MINUS
Definition: SystemZ.h:130
llvm::initializeSystemZTDCPassPass
void initializeSystemZTDCPassPass(PassRegistry &)
llvm::SystemZ::TDCMASK_ALL
const unsigned TDCMASK_ALL
Definition: SystemZ.h:151
llvm::SystemZ::IPM_CC
const unsigned IPM_CC
Definition: SystemZ.h:112
llvm::SystemZ::CCMASK_SRST_NOTFOUND
const unsigned CCMASK_SRST_NOTFOUND
Definition: SystemZ.h:73
llvm::SystemZ::CCMASK_LOGICAL_NONZERO
const unsigned CCMASK_LOGICAL_NONZERO
Definition: SystemZ.h:59
llvm::SystemZ::CCMASK_2
const unsigned CCMASK_2
Definition: SystemZ.h:29
CodeGen.h
llvm::SystemZ::CCMASK_TBEGIN_INDETERMINATE
const unsigned CCMASK_TBEGIN_INDETERMINATE
Definition: SystemZ.h:89
llvm::initializeSystemZShortenInstPass
void initializeSystemZShortenInstPass(PassRegistry &)
llvm::initializeSystemZElimComparePass
void initializeSystemZElimComparePass(PassRegistry &)
llvm::SystemZ::CCMASK_TM_ALL_1
const unsigned CCMASK_TM_ALL_1
Definition: SystemZ.h:80
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::createSystemZPostRewritePass
FunctionPass * createSystemZPostRewritePass(SystemZTargetMachine &TM)
llvm::createSystemZCopyPhysRegsPass
FunctionPass * createSystemZCopyPhysRegsPass(SystemZTargetMachine &TM)
llvm::createSystemZLDCleanupPass
FunctionPass * createSystemZLDCleanupPass(SystemZTargetMachine &TM)
llvm::SystemZ::isImmHF
static bool isImmHF(uint64_t Val)
Definition: SystemZ.h:186
llvm::SystemZ::TDCMASK_SNAN_PLUS
const unsigned TDCMASK_SNAN_PLUS
Definition: SystemZ.h:129
llvm::SystemZ::CCMASK_TEND_TX
const unsigned CCMASK_TEND_TX
Definition: SystemZ.h:95
llvm::SystemZ::TDCMASK_SUBNORMAL_PLUS
const unsigned TDCMASK_SUBNORMAL_PLUS
Definition: SystemZ.h:123
llvm::SystemZ::TDCMASK_SUBNORMAL_MINUS
const unsigned TDCMASK_SUBNORMAL_MINUS
Definition: SystemZ.h:124
llvm::SystemZ::PFD_WRITE
const unsigned PFD_WRITE
Definition: SystemZ.h:116
llvm::SystemZ::PFD_READ
const unsigned PFD_READ
Definition: SystemZ.h:115
llvm::SystemZ::CCMASK_TM_SOME_0
const unsigned CCMASK_TM_SOME_0
Definition: SystemZ.h:81
llvm::SystemZ::CCMASK_TM_ALL_0
const unsigned CCMASK_TM_ALL_0
Definition: SystemZ.h:77