LLVM  9.0.0svn
SystemZSubtarget.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
9 #include "SystemZSubtarget.h"
11 #include "llvm/IR/GlobalValue.h"
12 
13 using namespace llvm;
14 
15 #define DEBUG_TYPE "systemz-subtarget"
16 
17 #define GET_SUBTARGETINFO_TARGET_DESC
18 #define GET_SUBTARGETINFO_CTOR
19 #include "SystemZGenSubtargetInfo.inc"
20 
22  "systemz-subreg-liveness",
23  cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"),
24  cl::Hidden);
25 
26 // Pin the vtable to this file.
27 void SystemZSubtarget::anchor() {}
28 
30 SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
31  std::string CPUName = CPU;
32  if (CPUName.empty())
33  CPUName = "generic";
34  // Parse features string.
35  ParseSubtargetFeatures(CPUName, FS);
36  return *this;
37 }
38 
39 SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
40  const std::string &FS,
41  const TargetMachine &TM)
58  TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
59  TLInfo(TM, *this), TSInfo(), FrameLowering() {}
60 
61 
63  return UseSubRegLiveness;
64 }
65 
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)
75  return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
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 }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
unsigned getAlignment() const
Definition: Globals.cpp:96
bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const
bool enableSubRegLiveness() const override
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
const TargetMachine & getTargetMachine() const
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:565
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
static cl::opt< bool > UseSubRegLiveness("systemz-subreg-liveness", cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"), cl::Hidden)
SystemZSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)