1 //===- SystemZSubtarget.cpp - SystemZ Subtarget Information -------*- C++ -*-=//
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 // This file implements the SystemZ specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "SystemZSubtarget.h"
15 #include "SystemZ.h"
16 #include "llvm/GlobalValue.h"
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Support/TargetRegistry.h"
19
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "SystemZGenSubtargetInfo.inc"
23
24 using namespace llvm;
25
SystemZSubtarget(const std::string & TT,const std::string & CPU,const std::string & FS)26 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
27 const std::string &CPU,
28 const std::string &FS):
29 SystemZGenSubtargetInfo(TT, CPU, FS), HasZ10Insts(false) {
30 std::string CPUName = CPU;
31 if (CPUName.empty())
32 CPUName = "z9";
33
34 // Parse features string.
35 ParseSubtargetFeatures(CPUName, FS);
36 }
37
38 /// True if accessing the GV requires an extra load.
GVRequiresExtraLoad(const GlobalValue * GV,const TargetMachine & TM,bool isDirectCall) const39 bool SystemZSubtarget::GVRequiresExtraLoad(const GlobalValue* GV,
40 const TargetMachine& TM,
41 bool isDirectCall) const {
42 if (TM.getRelocationModel() == Reloc::PIC_) {
43 // Extra load is needed for all externally visible.
44 if (isDirectCall)
45 return false;
46
47 if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
48 return false;
49
50 return true;
51 }
52
53 return false;
54 }
55