Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 1 | //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "SystemZSubtarget.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 10 | #include "MCTargetDesc/SystemZMCTargetDesc.h" |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 11 | #include "llvm/IR/GlobalValue.h" |
| 12 | |
Chandler Carruth | d174b72 | 2014-04-22 02:03:14 +0000 | [diff] [blame] | 13 | using namespace llvm; |
| 14 | |
Chandler Carruth | e96dd89 | 2014-04-21 22:55:11 +0000 | [diff] [blame] | 15 | #define DEBUG_TYPE "systemz-subtarget" |
| 16 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 17 | #define GET_SUBTARGETINFO_TARGET_DESC |
| 18 | #define GET_SUBTARGETINFO_CTOR |
| 19 | #include "SystemZGenSubtargetInfo.inc" |
| 20 | |
Jonas Paulsson | d5a9c2d | 2018-08-15 15:04:49 +0000 | [diff] [blame] | 21 | static cl::opt<bool> UseSubRegLiveness( |
| 22 | "systemz-subreg-liveness", |
| 23 | cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"), |
| 24 | cl::Hidden); |
| 25 | |
Eric Christopher | 0eaa541 | 2014-07-02 22:05:40 +0000 | [diff] [blame] | 26 | // Pin the vtable to this file. |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 27 | void SystemZSubtarget::anchor() {} |
| 28 | |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 29 | SystemZSubtarget & |
| 30 | SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 31 | std::string CPUName = CPU; |
| 32 | if (CPUName.empty()) |
Richard Sandiford | f834ea1 | 2013-10-31 12:14:17 +0000 | [diff] [blame] | 33 | CPUName = "generic"; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 34 | // Parse features string. |
| 35 | ParseSubtargetFeatures(CPUName, FS); |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 36 | return *this; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Daniel Sanders | a73f1fd | 2015-06-10 12:11:26 +0000 | [diff] [blame] | 39 | SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU, |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 40 | const std::string &FS, |
| 41 | const TargetMachine &TM) |
Daniel Sanders | 50f1723 | 2015-09-15 16:17:27 +0000 | [diff] [blame] | 42 | : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false), |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 43 | HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false), |
Ulrich Weigand | 03ab2e2 | 2017-06-30 20:43:40 +0000 | [diff] [blame] | 44 | HasPopulationCount(false), HasMessageSecurityAssist3(false), |
| 45 | HasMessageSecurityAssist4(false), HasResetReferenceBitsMultiple(false), |
Ulrich Weigand | 33a441a | 2017-05-10 12:42:00 +0000 | [diff] [blame] | 46 | HasFastSerialization(false), HasInterlockedAccess1(false), |
| 47 | HasMiscellaneousExtensions(false), |
Ulrich Weigand | 84404f3 | 2016-11-28 14:01:51 +0000 | [diff] [blame] | 48 | HasExecutionHint(false), HasLoadAndTrap(false), |
| 49 | HasTransactionalExecution(false), HasProcessorAssist(false), |
Ulrich Weigand | 03ab2e2 | 2017-06-30 20:43:40 +0000 | [diff] [blame] | 50 | HasDFPZonedConversion(false), HasEnhancedDAT2(false), |
Ulrich Weigand | 84404f3 | 2016-11-28 14:01:51 +0000 | [diff] [blame] | 51 | HasVector(false), HasLoadStoreOnCond2(false), |
Ulrich Weigand | 33a441a | 2017-05-10 12:42:00 +0000 | [diff] [blame] | 52 | HasLoadAndZeroRightmostByte(false), HasMessageSecurityAssist5(false), |
Ulrich Weigand | 3f484e6 | 2017-05-30 10:15:16 +0000 | [diff] [blame] | 53 | HasDFPPackedConversion(false), |
Ulrich Weigand | 2b3482f | 2017-07-17 17:41:11 +0000 | [diff] [blame] | 54 | HasMiscellaneousExtensions2(false), HasGuardedStorage(false), |
| 55 | HasMessageSecurityAssist7(false), HasMessageSecurityAssist8(false), |
| 56 | HasVectorEnhancements1(false), HasVectorPackedDecimal(false), |
| 57 | HasInsertReferenceBitsMultiple(false), |
Ulrich Weigand | 92c2c67 | 2016-11-11 12:46:28 +0000 | [diff] [blame] | 58 | TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)), |
| 59 | TLInfo(TM, *this), TSInfo(), FrameLowering() {} |
Eric Christopher | 5234995 | 2014-07-01 20:19:02 +0000 | [diff] [blame] | 60 | |
Jonas Paulsson | d5a9c2d | 2018-08-15 15:04:49 +0000 | [diff] [blame] | 61 | |
| 62 | bool SystemZSubtarget::enableSubRegLiveness() const { |
| 63 | return UseSubRegLiveness; |
| 64 | } |
| 65 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 66 | bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 67 | CodeModel::Model CM) const { |
| 68 | // PC32DBL accesses require the low bit to be clear. Note that a zero |
| 69 | // value selects the default alignment and is therefore OK. |
| 70 | if (GV->getAlignment() == 1) |
| 71 | return false; |
| 72 | |
| 73 | // For the small model, all locally-binding symbols are in range. |
| 74 | if (CM == CodeModel::Small) |
Rafael Espindola | 3beef8d | 2016-06-27 23:15:57 +0000 | [diff] [blame] | 75 | return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV); |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 76 | |
| 77 | // For Medium and above, assume that the symbol is not within the 4GB range. |
| 78 | // Taking the address of locally-defined text would be OK, but that |
| 79 | // case isn't easy to detect. |
| 80 | return false; |
| 81 | } |