blob: 518c09f260235083791d96bbce7dfa39879b7459 [file] [log] [blame]
Anton Korobeynikovc334c282009-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//
Evan Cheng0d639a22011-07-01 21:01:15 +000010// This file implements the SystemZ specific subclass of TargetSubtargetInfo.
Anton Korobeynikovc334c282009-07-16 13:27:25 +000011//
12//===----------------------------------------------------------------------===//
13
14#include "SystemZSubtarget.h"
15#include "SystemZ.h"
Anton Korobeynikov091872cb2009-07-16 14:16:05 +000016#include "llvm/GlobalValue.h"
Anton Korobeynikovc334c282009-07-16 13:27:25 +000017#include "llvm/Target/TargetMachine.h"
18
Evan Cheng54b68e32011-07-01 20:45:01 +000019#define GET_SUBTARGETINFO_CTOR
20#define GET_SUBTARGETINFO_MC_DESC
21#define GET_SUBTARGETINFO_TARGET_DESC
Evan Chengc9c090d2011-07-01 22:36:09 +000022#include "SystemZGenSubtargetInfo.inc"
Evan Cheng54b68e32011-07-01 20:45:01 +000023
Anton Korobeynikovc334c282009-07-16 13:27:25 +000024using namespace llvm;
25
Daniel Dunbar31b44e82009-08-02 22:11:08 +000026SystemZSubtarget::SystemZSubtarget(const std::string &TT,
Evan Chengfe6e4052011-06-30 01:53:36 +000027 const std::string &CPU,
Anton Korobeynikov2d218392009-07-16 14:05:00 +000028 const std::string &FS):
Evan Cheng1a72add62011-07-07 07:07:08 +000029 SystemZGenSubtargetInfo(TT, CPU, FS), HasZ10Insts(false) {
Evan Chengfe6e4052011-06-30 01:53:36 +000030 std::string CPUName = CPU;
31 if (CPUName.empty())
32 CPUName = "z9";
Anton Korobeynikovc334c282009-07-16 13:27:25 +000033
34 // Parse features string.
Evan Cheng1a72add62011-07-07 07:07:08 +000035 ParseSubtargetFeatures(CPUName, FS);
Anton Korobeynikovc334c282009-07-16 13:27:25 +000036}
Anton Korobeynikov091872cb2009-07-16 14:16:05 +000037
38/// True if accessing the GV requires an extra load.
39bool 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}