blob: a8b5e1f18679784c999f0d25b59d75bdf57bdf1c [file] [log] [blame]
Anton Korobeynikov4403b932009-07-16 13:27:25 +00001//===- 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 TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
14#include "SystemZSubtarget.h"
15#include "SystemZ.h"
16#include "SystemZGenSubtarget.inc"
Anton Korobeynikov6fe326c2009-07-16 14:16:05 +000017#include "llvm/GlobalValue.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000018#include "llvm/Target/TargetMachine.h"
19
20using namespace llvm;
21
Daniel Dunbar3be03402009-08-02 22:11:08 +000022SystemZSubtarget::SystemZSubtarget(const std::string &TT,
Anton Korobeynikov747052c2009-07-16 14:05:00 +000023 const std::string &FS):
24 HasZ10Insts(false) {
25 std::string CPU = "z9";
Anton Korobeynikov4403b932009-07-16 13:27:25 +000026
27 // Parse features string.
28 ParseSubtargetFeatures(FS, CPU);
29}
Anton Korobeynikov6fe326c2009-07-16 14:16:05 +000030
31/// True if accessing the GV requires an extra load.
32bool SystemZSubtarget::GVRequiresExtraLoad(const GlobalValue* GV,
33 const TargetMachine& TM,
34 bool isDirectCall) const {
35 if (TM.getRelocationModel() == Reloc::PIC_) {
36 // Extra load is needed for all externally visible.
37 if (isDirectCall)
38 return false;
39
40 if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
41 return false;
42
43 return true;
44 }
45
46 return false;
47}