[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / Target / SystemZ / SystemZSubtarget.cpp
blobbfcdee270f292e9b11346241371c7f2a84927357
1 //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
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 //===----------------------------------------------------------------------===//
9 #include "SystemZSubtarget.h"
10 #include "MCTargetDesc/SystemZMCTargetDesc.h"
11 #include "llvm/IR/GlobalValue.h"
12 #include "llvm/Target/TargetMachine.h"
14 using namespace llvm;
16 #define DEBUG_TYPE "systemz-subtarget"
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "SystemZGenSubtargetInfo.inc"
22 static cl::opt<bool> UseSubRegLiveness(
23 "systemz-subreg-liveness",
24 cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"),
25 cl::Hidden);
27 // Pin the vtable to this file.
28 void SystemZSubtarget::anchor() {}
30 SystemZSubtarget &
31 SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
32 StringRef CPUName = CPU;
33 if (CPUName.empty())
34 CPUName = "generic";
35 // Parse features string.
36 ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
38 // -msoft-float implies -mno-vx.
39 if (HasSoftFloat)
40 HasVector = false;
42 // -mno-vx implicitly disables all vector-related features.
43 if (!HasVector) {
44 HasVectorEnhancements1 = false;
45 HasVectorEnhancements2 = false;
46 HasVectorPackedDecimal = false;
47 HasVectorPackedDecimalEnhancement = false;
48 HasVectorPackedDecimalEnhancement2 = false;
51 return *this;
54 SystemZCallingConventionRegisters *
55 SystemZSubtarget::initializeSpecialRegisters() {
56 if (isTargetXPLINK64())
57 return new SystemZXPLINK64Registers;
58 else if (isTargetELF())
59 return new SystemZELFRegisters;
60 else {
61 llvm_unreachable("Invalid Calling Convention. Cannot initialize Special "
62 "Call Registers!");
66 SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
67 const std::string &FS,
68 const TargetMachine &TM)
69 : SystemZGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
70 HasDistinctOps(false), HasLoadStoreOnCond(false), HasHighWord(false),
71 HasFPExtension(false), HasPopulationCount(false),
72 HasMessageSecurityAssist3(false), HasMessageSecurityAssist4(false),
73 HasResetReferenceBitsMultiple(false), HasFastSerialization(false),
74 HasInterlockedAccess1(false), HasMiscellaneousExtensions(false),
75 HasExecutionHint(false), HasLoadAndTrap(false),
76 HasTransactionalExecution(false), HasProcessorAssist(false),
77 HasDFPZonedConversion(false), HasEnhancedDAT2(false), HasVector(false),
78 HasLoadStoreOnCond2(false), HasLoadAndZeroRightmostByte(false),
79 HasMessageSecurityAssist5(false), HasDFPPackedConversion(false),
80 HasMiscellaneousExtensions2(false), HasGuardedStorage(false),
81 HasMessageSecurityAssist7(false), HasMessageSecurityAssist8(false),
82 HasVectorEnhancements1(false), HasVectorPackedDecimal(false),
83 HasInsertReferenceBitsMultiple(false), HasMiscellaneousExtensions3(false),
84 HasMessageSecurityAssist9(false), HasVectorEnhancements2(false),
85 HasVectorPackedDecimalEnhancement(false), HasEnhancedSort(false),
86 HasDeflateConversion(false), HasVectorPackedDecimalEnhancement2(false),
87 HasNNPAssist(false), HasBEAREnhancement(false),
88 HasResetDATProtection(false), HasProcessorActivityInstrumentation(false),
89 HasSoftFloat(false), TargetTriple(TT),
90 SpecialRegisters(initializeSpecialRegisters()),
91 InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
92 TSInfo(), FrameLowering() {}
94 SystemZSubtarget::~SystemZSubtarget() { delete getSpecialRegisters(); }
96 bool SystemZSubtarget::enableSubRegLiveness() const {
97 return UseSubRegLiveness;
100 bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
101 CodeModel::Model CM) const {
102 // PC32DBL accesses require the low bit to be clear.
104 // FIXME: Explicitly check for functions: the datalayout is currently
105 // missing information about function pointers.
106 const DataLayout &DL = GV->getParent()->getDataLayout();
107 if (GV->getPointerAlignment(DL) == 1 && !GV->getValueType()->isFunctionTy())
108 return false;
110 // For the small model, all locally-binding symbols are in range.
111 if (CM == CodeModel::Small)
112 return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
114 // For Medium and above, assume that the symbol is not within the 4GB range.
115 // Taking the address of locally-defined text would be OK, but that
116 // case isn't easy to detect.
117 return false;