LLVM 17.0.0git
Go to the documentation of this file.
1//===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
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
9#include "SystemZSubtarget.h"
11#include "llvm/IR/GlobalValue.h"
14using namespace llvm;
16#define DEBUG_TYPE "systemz-subtarget"
20#include "SystemZGenSubtargetInfo.inc"
23 "systemz-subreg-liveness",
24 cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"),
27// Pin the vtable to this file.
28void SystemZSubtarget::anchor() {}
30SystemZSubtarget &SystemZSubtarget::initializeSubtargetDependencies(
31 StringRef CPU, StringRef TuneCPU, StringRef FS) {
32 if (CPU.empty())
33 CPU = "generic";
34 if (TuneCPU.empty())
35 TuneCPU = CPU;
36 // Parse features string.
37 ParseSubtargetFeatures(CPU, TuneCPU, FS);
39 // -msoft-float implies -mno-vx.
40 if (HasSoftFloat)
41 HasVector = false;
43 // -mno-vx implicitly disables all vector-related features.
44 if (!HasVector) {
45 HasVectorEnhancements1 = false;
46 HasVectorEnhancements2 = false;
47 HasVectorPackedDecimal = false;
48 HasVectorPackedDecimalEnhancement = false;
49 HasVectorPackedDecimalEnhancement2 = false;
50 }
52 return *this;
56SystemZSubtarget::initializeSpecialRegisters() {
57 if (isTargetXPLINK64())
58 return new SystemZXPLINK64Registers;
59 else if (isTargetELF())
60 return new SystemZELFRegisters;
61 else {
62 llvm_unreachable("Invalid Calling Convention. Cannot initialize Special "
63 "Call Registers!");
64 }
67SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
68 const std::string &TuneCPU,
69 const std::string &FS,
70 const TargetMachine &TM)
71 : SystemZGenSubtargetInfo(TT, CPU, TuneCPU, FS), TargetTriple(TT),
72 SpecialRegisters(initializeSpecialRegisters()),
73 InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)),
74 TLInfo(TM, *this), FrameLowering(SystemZFrameLowering::create(*this)) {}
77 return UseSubRegLiveness;
81 CodeModel::Model CM) const {
82 // PC32DBL accesses require the low bit to be clear.
83 //
84 // FIXME: Explicitly check for functions: the datalayout is currently
85 // missing information about function pointers.
86 const DataLayout &DL = GV->getParent()->getDataLayout();
87 if (GV->getPointerAlignment(DL) == 1 && !GV->getValueType()->isFunctionTy())
88 return false;
90 // For the small model, all locally-binding symbols are in range.
91 if (CM == CodeModel::Small)
92 return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
94 // For Medium and above, assume that the symbol is not within the 4GB range.
95 // Taking the address of locally-defined text would be OK, but that
96 // case isn't easy to detect.
97 return false;
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static cl::opt< bool > UseSubRegLiveness("ppc-track-subreg-liveness", cl::desc("Enable subregister liveness tracking for PPC"), cl::init(true), cl::Hidden)
const char LLVMTargetMachineRef TM
return InstrInfo
static cl::opt< bool > UseSubRegLiveness("systemz-subreg-liveness", cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"), cl::Hidden)
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:652
Type * getValueType() const
Definition: GlobalValue.h:292
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:398
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
A SystemZ-specific class detailing special use registers particular for calling conventions.
ELF calling convention specific use registers Particular when on zLinux in 64 bit mode.
bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const
bool enableSubRegLiveness() const override
SystemZSubtarget(const Triple &TT, const std::string &CPU, const std::string &TuneCPU, const std::string &FS, const TargetMachine &TM)
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
XPLINK64 calling convention specific use registers Particular to z/OS when in 64 bit mode.
const TargetMachine & getTargetMachine() const
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:78
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition: Type.h:249
Align getPointerAlignment(const DataLayout &DL) const
Returns an alignment of the pointer value.
Definition: Value.cpp:918
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18