LLVM 24.0.0git
SystemZSubtarget.h
Go to the documentation of this file.
1//===-- SystemZSubtarget.h - SystemZ subtarget information -----*- C++ -*--===//
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//===----------------------------------------------------------------------===//
8//
9// This file declares the SystemZ specific subclass of TargetSubtargetInfo.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
14#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSUBTARGET_H
15
17#include "SystemZISelLowering.h"
18#include "SystemZInstrInfo.h"
19#include "SystemZRegisterInfo.h"
22#include "llvm/IR/DataLayout.h"
24#include <string>
25
26#define OPTIONS_STRUCT_DECL
27#include "SystemZOptions.inc"
28
29#define GET_SUBTARGETINFO_HEADER
30#include "SystemZGenSubtargetInfo.inc"
31
32namespace llvm {
33class GlobalValue;
34class StringRef;
35class SystemZTargetMachine;
36
38 virtual void anchor();
39protected:
40// Bool members corresponding to the SubtargetFeatures defined in tablegen.
41#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
42 bool ATTRIBUTE = DEFAULT;
43#include "SystemZGenSubtargetInfo.inc"
44
45private:
46 const SystemZOptions &CLOpts;
47 Triple TargetTriple;
48 std::unique_ptr<SystemZCallingConventionRegisters> SpecialRegisters;
49 SystemZInstrInfo InstrInfo;
50 SystemZTargetLowering TLInfo;
51 SystemZSelectionDAGInfo TSInfo;
52 std::unique_ptr<const SystemZFrameLowering> FrameLowering;
53
54 SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
55 StringRef TuneCPU,
56 StringRef FS);
57 SystemZCallingConventionRegisters *initializeSpecialRegisters();
58
59public:
60 SystemZSubtarget(const Triple &TT, const std::string &CPU,
61 const std::string &TuneCPU, const std::string &FS,
62 const SystemZTargetMachine &TM);
63
64 const SystemZOptions &getCLOpts() const { return CLOpts; }
65
67 assert(SpecialRegisters && "Unsupported SystemZ calling convention");
68 return SpecialRegisters.get();
69 }
70
71 template <class SR> SR &getSpecialRegisters() const {
72 return *static_cast<SR *>(getSpecialRegisters());
73 }
74
75 const TargetFrameLowering *getFrameLowering() const override {
76 return FrameLowering.get();
77 }
78
79 template <class TFL> const TFL *getFrameLowering() const {
80 return static_cast<const TFL *>(getFrameLowering());
81 }
82
83 const SystemZInstrInfo *getInstrInfo() const override { return &InstrInfo; }
84 const SystemZRegisterInfo *getRegisterInfo() const override {
85 return &InstrInfo.getRegisterInfo();
86 }
87 const SystemZTargetLowering *getTargetLowering() const override {
88 return &TLInfo;
89 }
91 return &TSInfo;
92 }
93
94 // True if the subtarget should run MachineScheduler after aggressive
95 // coalescing. This currently replaces the SelectionDAG scheduler with the
96 // "source" order scheduler.
97 bool enableMachineScheduler() const override { return true; }
98
99 // This is important for reducing register pressure in vector code.
100 bool useAA() const override { return true; }
101
102 // Always enable the early if-conversion pass.
103 bool enableEarlyIfConversion() const override { return true; }
104
105 // Enable tracking of subregister liveness in register allocator.
106 bool enableSubRegLiveness() const override;
107
108 // Automatically generated by tblgen.
110
111// Getters for SubtargetFeatures defined in tablegen.
112#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
113 bool GETTER() const { return ATTRIBUTE; }
114#include "SystemZGenSubtargetInfo.inc"
115
116 bool isXRaySupported() const override { return true; }
117
118 bool isAddressedViaADA(const GlobalValue *GV) const;
119
120 // Return true if GV can be accessed using LARL for reloc model RM
121 // and code model CM.
122 bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const;
123
124 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
125
126 // Returns TRUE if we are generating GOFF object code
127 bool isTargetGOFF() const { return TargetTriple.isOSBinFormatGOFF(); }
128
129 // Returns TRUE if we are using XPLINK64 linkage convention
130 bool isTargetXPLINK64() const { return (isTargetGOFF() && isTargetzOS()); }
131
132 // Returns TRUE if we are generating code for a s390x machine running zOS
133 bool isTargetzOS() const { return TargetTriple.isOSzOS(); }
134};
135} // end namespace llvm
136
137#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
A SystemZ-specific class detailing special use registers particular for calling conventions.
const SystemZInstrInfo * getInstrInfo() const override
bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const
SR & getSpecialRegisters() const
const TargetFrameLowering * getFrameLowering() const override
bool isXRaySupported() const override
const SystemZTargetLowering * getTargetLowering() const override
bool enableMachineScheduler() const override
SystemZCallingConventionRegisters * getSpecialRegisters() const
bool enableSubRegLiveness() const override
bool isAddressedViaADA(const GlobalValue *GV) const
bool enableEarlyIfConversion() const override
const SystemZRegisterInfo * getRegisterInfo() const override
const SystemZOptions & getCLOpts() const
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
SystemZSubtarget(const Triple &TT, const std::string &CPU, const std::string &TuneCPU, const std::string &FS, const SystemZTargetMachine &TM)
const TFL * getFrameLowering() const
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
bool useAA() const override
Information about stack frame layout on the target.
This is an optimization pass for GlobalISel generic memory operations.