LLVM  8.0.0svn
SystemZSubtarget.cpp
Go to the documentation of this file.
1 //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "SystemZSubtarget.h"
12 #include "llvm/IR/GlobalValue.h"
13 
14 using namespace llvm;
15 
16 #define DEBUG_TYPE "systemz-subtarget"
17 
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "SystemZGenSubtargetInfo.inc"
21 
23  "systemz-subreg-liveness",
24  cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"),
25  cl::Hidden);
26 
27 // Pin the vtable to this file.
28 void SystemZSubtarget::anchor() {}
29 
31 SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
32  std::string CPUName = CPU;
33  if (CPUName.empty())
34  CPUName = "generic";
35  // Parse features string.
36  ParseSubtargetFeatures(CPUName, FS);
37  return *this;
38 }
39 
40 SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
41  const std::string &FS,
42  const TargetMachine &TM)
59  TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
60  TLInfo(TM, *this), TSInfo(), FrameLowering() {}
61 
62 
64  return UseSubRegLiveness;
65 }
66 
68  CodeModel::Model CM) const {
69  // PC32DBL accesses require the low bit to be clear. Note that a zero
70  // value selects the default alignment and is therefore OK.
71  if (GV->getAlignment() == 1)
72  return false;
73 
74  // For the small model, all locally-binding symbols are in range.
75  if (CM == CodeModel::Small)
76  return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
77 
78  // For Medium and above, assume that the symbol is not within the 4GB range.
79  // Taking the address of locally-defined text would be OK, but that
80  // case isn't easy to detect.
81  return false;
82 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
unsigned getAlignment() const
Definition: Globals.cpp:97
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:44
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:566
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
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)