1*0b57cec5SDimitry Andric //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric #include "SystemZSubtarget.h" 10*0b57cec5SDimitry Andric #include "MCTargetDesc/SystemZMCTargetDesc.h" 11*0b57cec5SDimitry Andric #include "llvm/IR/GlobalValue.h" 12*0b57cec5SDimitry Andric 13*0b57cec5SDimitry Andric using namespace llvm; 14*0b57cec5SDimitry Andric 15*0b57cec5SDimitry Andric #define DEBUG_TYPE "systemz-subtarget" 16*0b57cec5SDimitry Andric 17*0b57cec5SDimitry Andric #define GET_SUBTARGETINFO_TARGET_DESC 18*0b57cec5SDimitry Andric #define GET_SUBTARGETINFO_CTOR 19*0b57cec5SDimitry Andric #include "SystemZGenSubtargetInfo.inc" 20*0b57cec5SDimitry Andric 21*0b57cec5SDimitry Andric static cl::opt<bool> UseSubRegLiveness( 22*0b57cec5SDimitry Andric "systemz-subreg-liveness", 23*0b57cec5SDimitry Andric cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"), 24*0b57cec5SDimitry Andric cl::Hidden); 25*0b57cec5SDimitry Andric 26*0b57cec5SDimitry Andric // Pin the vtable to this file. 27*0b57cec5SDimitry Andric void SystemZSubtarget::anchor() {} 28*0b57cec5SDimitry Andric 29*0b57cec5SDimitry Andric SystemZSubtarget & 30*0b57cec5SDimitry Andric SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { 31*0b57cec5SDimitry Andric std::string CPUName = CPU; 32*0b57cec5SDimitry Andric if (CPUName.empty()) 33*0b57cec5SDimitry Andric CPUName = "generic"; 34*0b57cec5SDimitry Andric // Parse features string. 35*0b57cec5SDimitry Andric ParseSubtargetFeatures(CPUName, FS); 36*0b57cec5SDimitry Andric return *this; 37*0b57cec5SDimitry Andric } 38*0b57cec5SDimitry Andric 39*0b57cec5SDimitry Andric SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU, 40*0b57cec5SDimitry Andric const std::string &FS, 41*0b57cec5SDimitry Andric const TargetMachine &TM) 42*0b57cec5SDimitry Andric : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false), 43*0b57cec5SDimitry Andric HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false), 44*0b57cec5SDimitry Andric HasPopulationCount(false), HasMessageSecurityAssist3(false), 45*0b57cec5SDimitry Andric HasMessageSecurityAssist4(false), HasResetReferenceBitsMultiple(false), 46*0b57cec5SDimitry Andric HasFastSerialization(false), HasInterlockedAccess1(false), 47*0b57cec5SDimitry Andric HasMiscellaneousExtensions(false), 48*0b57cec5SDimitry Andric HasExecutionHint(false), HasLoadAndTrap(false), 49*0b57cec5SDimitry Andric HasTransactionalExecution(false), HasProcessorAssist(false), 50*0b57cec5SDimitry Andric HasDFPZonedConversion(false), HasEnhancedDAT2(false), 51*0b57cec5SDimitry Andric HasVector(false), HasLoadStoreOnCond2(false), 52*0b57cec5SDimitry Andric HasLoadAndZeroRightmostByte(false), HasMessageSecurityAssist5(false), 53*0b57cec5SDimitry Andric HasDFPPackedConversion(false), 54*0b57cec5SDimitry Andric HasMiscellaneousExtensions2(false), HasGuardedStorage(false), 55*0b57cec5SDimitry Andric HasMessageSecurityAssist7(false), HasMessageSecurityAssist8(false), 56*0b57cec5SDimitry Andric HasVectorEnhancements1(false), HasVectorPackedDecimal(false), 57*0b57cec5SDimitry Andric HasInsertReferenceBitsMultiple(false), 58*0b57cec5SDimitry Andric HasMiscellaneousExtensions3(false), HasMessageSecurityAssist9(false), 59*0b57cec5SDimitry Andric HasVectorEnhancements2(false), HasVectorPackedDecimalEnhancement(false), 60*0b57cec5SDimitry Andric HasEnhancedSort(false), HasDeflateConversion(false), 61*0b57cec5SDimitry Andric TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)), 62*0b57cec5SDimitry Andric TLInfo(TM, *this), TSInfo(), FrameLowering() {} 63*0b57cec5SDimitry Andric 64*0b57cec5SDimitry Andric 65*0b57cec5SDimitry Andric bool SystemZSubtarget::enableSubRegLiveness() const { 66*0b57cec5SDimitry Andric return UseSubRegLiveness; 67*0b57cec5SDimitry Andric } 68*0b57cec5SDimitry Andric 69*0b57cec5SDimitry Andric bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV, 70*0b57cec5SDimitry Andric CodeModel::Model CM) const { 71*0b57cec5SDimitry Andric // PC32DBL accesses require the low bit to be clear. Note that a zero 72*0b57cec5SDimitry Andric // value selects the default alignment and is therefore OK. 73*0b57cec5SDimitry Andric if (GV->getAlignment() == 1) 74*0b57cec5SDimitry Andric return false; 75*0b57cec5SDimitry Andric 76*0b57cec5SDimitry Andric // For the small model, all locally-binding symbols are in range. 77*0b57cec5SDimitry Andric if (CM == CodeModel::Small) 78*0b57cec5SDimitry Andric return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV); 79*0b57cec5SDimitry Andric 80*0b57cec5SDimitry Andric // For Medium and above, assume that the symbol is not within the 4GB range. 81*0b57cec5SDimitry Andric // Taking the address of locally-defined text would be OK, but that 82*0b57cec5SDimitry Andric // case isn't easy to detect. 83*0b57cec5SDimitry Andric return false; 84*0b57cec5SDimitry Andric } 85