-
Notifications
You must be signed in to change notification settings - Fork 392
/
OMRCPU.hpp
340 lines (285 loc) · 12.1 KB
/
OMRCPU.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at http://eclipse.org/legal/epl-2.0
* or the Apache License, Version 2.0 which accompanies this distribution
* and is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception [1] and GNU General Public
* License, version 2 with the OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
#ifndef OMR_Z_CPU_INCL
#define OMR_Z_CPU_INCL
/*
* The following #define and typedef must appear before any #includes in this file
*/
#ifndef OMR_CPU_CONNECTOR
#define OMR_CPU_CONNECTOR
namespace OMR { namespace Z { class CPU; } }
namespace OMR { typedef OMR::Z::CPU CPUConnector; }
#else
#error OMR::Z::CPU expected to be a primary connector, but a OMR connector is already defined
#endif
#include "compiler/env/OMRCPU.hpp"
#include "env/jittypes.h"
#include "env/ProcessorInfo.hpp"
#include "infra/Assert.hpp"
#include "infra/Flags.hpp"
namespace OMR
{
namespace Z
{
class OMR_EXTENSIBLE CPU : public OMR::CPU
{
public:
enum Architecture
{
Unknown = 0,
z900,
z990,
z9,
z10,
z196,
zEC12,
z13,
z14,
z15,
zNext,
};
/** \brief
* Gets the name of the processor given the four digit machine id.
*/
static const char* getProcessorName(int32_t machineId);
/** \brief
* Gets the name of the processor given the four TR::CPU::Architecture enum type.
*/
static const char* getProcessorName(Architecture arch);
/** \brief
* Gets the name of the processor given the OMRProcessorArchitecture enum type.
*/
static const char* getProcessorName(OMRProcessorArchitecture arch);
static TR::CPU detect(OMRPortLibrary * const omrPortLib);
public:
bool getSupportsArch(Architecture arch);
bool setSupportsArch(Architecture arch);
bool getSupportsHardwareSQRT();
bool hasPopulationCountInstruction();
/** \brief
* Determines whether the High-Word facility is available on the current processor.
*/
bool getSupportsHighWordFacility();
/** \brief
* Determines whether the High-Word facility is available on the current processor.
*
* \param value
* Determines whether the High-Word facility is available (if \c true) or not (if \c false).
*/
bool setSupportsHighWordFacility(bool value);
/** \brief
* Determines whether the Decimal Floating Point (DFP) facility is available on the current processor.
*/
bool getSupportsDecimalFloatingPointFacility();
/** \brief
* Determines whether the Decimal Floating Point (DFP) facility is available on the current processor.
*
* \param value
* Determines whether the Decimal Floating Point facility is available (if \c true) or not (if \c false).
*/
bool setSupportsDecimalFloatingPointFacility(bool value);
/** \brief
* Determines whether the Floating Point Extension (FPE) facility is available on the current processor.
*/
bool getSupportsFloatingPointExtensionFacility();
/** \brief
* Determines whether the Floating Point Extension (FPE) facility is available on the current processor.
*
* \param value
* Determines whether the Floating Point Extension facility is available (if \c true) or not (if \c false).
*/
bool setSupportsFloatingPointExtensionFacility(bool value);
/** \brief
* Determines whether the Transactional Memory (TM) facility is available on the current processor.
*/
bool getSupportsTransactionalMemoryFacility();
/** \brief
* Determines whether the Transactional Memory (TM) facility is available on the current processor.
* Alias of supportsFeature(OMR_FEATURE_S390_TE) as a platform agnostic query.
*/
bool supportsTransactionalMemoryInstructions();
/** \brief
* Determines whether the Transactional Memory (TM) facility is available on the current processor.
*
* \param value
* Determines whether the Transactional Memory facility is available (if \c true) or not (if \c false).
*/
bool setSupportsTransactionalMemoryFacility(bool value);
/** \brief
* Determines whether the Runtime Instrumentation (RI) facility is available on the current processor.
*/
bool getSupportsRuntimeInstrumentationFacility();
/** \brief
* Determines whether the Runtime Instrumentation (RI) facility is available on the current processor.
*
* \param value
* Determines whether the Runtime Instrumentation facility is available (if \c true) or not (if \c false).
*/
bool setSupportsRuntimeInstrumentationFacility(bool value);
/** \brief
* Determines whether the Vector facility is available on the current processor.
*/
bool getSupportsVectorFacility();
/** \brief
* Determines whether the Vector facility is available on the current processor.
*
* \param value
* Determines whether the Vector facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorFacility(bool value);
/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*/
bool getSupportsVectorPackedDecimalFacility();
/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*
* \param value
* Determines whether the Vector Packed Decimal facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorPackedDecimalFacility(bool value);
/** \brief
* Determines whether the Miscellaneous Instruction Extensions 2 (MIE2) facility is available on the current
* processor.
*/
bool getSupportsMiscellaneousInstructionExtensions2Facility();
/** \brief
* Determines whether the Miscellaneous Instruction Extensions 2 (MIE2) facility is available on the current
* processor.
*
* \param value
* Determines whether the Miscellaneous Instruction Extensions 2 facility is available (if \c true) or not (if
* \c false).
*/
bool setSupportsMiscellaneousInstructionExtensions2Facility(bool value);
/** \brief
* Determines whether the Miscellaneous Instruction Extensions 3 (MIE3) facility is available on the current
* processor.
*/
bool getSupportsMiscellaneousInstructionExtensions3Facility();
/** \brief
* Determines whether the Miscellaneous Instruction Extensions 3 (MIE3) facility is available on the current
* processor.
*
* \param value
* Determines whether the Miscellaneous Instruction Extensions 3 facility is available (if \c true) or not (if
* \c false).
*/
bool setSupportsMiscellaneousInstructionExtensions3Facility(bool value);
/** \brief
* Determines whether the Vector Enhancement 2 facility is available on the current processor.
*/
bool getSupportsVectorFacilityEnhancement2();
/** \brief
* Determines whether the Vector Enhancement 2 facility is available on the current processor.
*
* \param value
* Determines whether the Vector Enhancement 2 facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorFacilityEnhancement2(bool value);
/** \brief
* Determines whether the Vector Enhancement 1 facility is available on the current processor.
*/
bool getSupportsVectorFacilityEnhancement1();
/** \brief
* Determines whether the Vector Enhancement 1 facility is available on the current processor.
*
* \param value
* Determines whether the Vector Enhancement 1 facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorFacilityEnhancement1(bool value);
/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*/
bool getSupportsVectorPackedDecimalEnhancementFacility();
/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*
* \param value
* Determines whether the Vector Packed Decimal facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorPackedDecimalEnhancementFacility(bool value);
/** \brief
* Determines whether the Guarded Storage (GS) facility is available on the current processor.
*/
bool getSupportsGuardedStorageFacility();
/** \brief
* Determines whether the Guarded Storage (GS) facility is available on the current processor.
*
* \param value
* Determines whether the Guarded Storage facility is available (if \c true) or not (if \c false).
*/
bool setSupportsGuardedStorageFacility(bool value);
/**
* @brief Answers whether the distance between a target and source address
* is within the reachable displacement range for a branch relative
* RIL-format instruction.
*
* @param[in] : targetAddress : the address of the target
*
* @param[in] : sourceAddress : the address of the branch relative RIL-format
* instruction from which the displacement range is measured.
*
* @return true if the target is within range; false otherwise.
*/
bool isTargetWithinBranchRelativeRILRange(intptr_t targetAddress, intptr_t sourceAddress);
bool isAtLeast(OMRProcessorArchitecture p);
bool supportsFeature(uint32_t feature);
bool is_at_least_old_api(OMRProcessorArchitecture p);
bool supports_feature_old_api(uint32_t feature);
bool is_at_least_test(OMRProcessorArchitecture p);
bool supports_feature_test(uint32_t feature);
protected:
CPU() : OMR::CPU(), _supportedArch(z10)
{
_processorDescription.processor = OMR_PROCESSOR_S390_UNKNOWN;
_processorDescription.physicalProcessor = OMR_PROCESSOR_S390_UNKNOWN;
memset(_processorDescription.features, 0, OMRPORT_SYSINFO_FEATURES_SIZE*sizeof(uint32_t));
}
CPU(const OMRProcessorDesc& processorDescription) : OMR::CPU(processorDescription), _supportedArch(z10) {}
enum
{
// Available = 0x00000001,
HasResumableTrapHandler = 0x00000002,
HasFixedFrameC_CallingConvention = 0x00000004,
SupportsScaledIndexAddressing = 0x00000080,
S390SupportsDFP = 0x00000100,
S390SupportsFPE = 0x00000200,
S390SupportsHPR = 0x00001000,
IsInZOSSupervisorState = 0x00008000,
S390SupportsTM = 0x00010000,
S390SupportsRI = 0x00020000,
S390SupportsVectorFacility = 0x00040000,
S390SupportsVectorPackedDecimalFacility = 0x00080000,
S390SupportsGuardedStorageFacility = 0x00100000,
S390SupportsSideEffectAccessFacility = 0x00200000,
S390SupportsMIE2 = 0x00400000,
S390SupportsMIE3 = 0x00800000,
S390SupportsVectorFacilityEnhancement2 = 0x01000000,
S390SupportsVectorPDEnhancementFacility = 0x02000000,
S390SupportsVectorFacilityEnhancement1 = 0x04000000,
};
Architecture _supportedArch;
flags32_t _flags;
};
}
}
#endif