Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / Target / SystemZ / SystemZSubtarget.cpp
blobf6707f9a20ddfc88e2a869b6efc97628e775b9d2
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.
12 //===----------------------------------------------------------------------===//
14 #include "SystemZSubtarget.h"
15 #include "SystemZ.h"
16 #include "llvm/GlobalValue.h"
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetRegistry.h"
20 #define GET_SUBTARGETINFO_ENUM
21 #define GET_SUBTARGETINFO_MC_DESC
22 #define GET_SUBTARGETINFO_TARGET_DESC
23 #define GET_SUBTARGETINFO_CTOR
24 #include "SystemZGenSubtargetInfo.inc"
26 using namespace llvm;
28 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
29 const std::string &CPU,
30 const std::string &FS):
31 SystemZGenSubtargetInfo(TT, CPU, FS), HasZ10Insts(false) {
32 std::string CPUName = CPU;
33 if (CPUName.empty())
34 CPUName = "z9";
36 // Parse features string.
37 ParseSubtargetFeatures(CPUName, FS);
40 /// True if accessing the GV requires an extra load.
41 bool SystemZSubtarget::GVRequiresExtraLoad(const GlobalValue* GV,
42 const TargetMachine& TM,
43 bool isDirectCall) const {
44 if (TM.getRelocationModel() == Reloc::PIC_) {
45 // Extra load is needed for all externally visible.
46 if (isDirectCall)
47 return false;
49 if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
50 return false;
52 return true;
55 return false;
58 MCSubtargetInfo *createSystemZMCSubtargetInfo(StringRef TT, StringRef CPU,
59 StringRef FS) {
60 MCSubtargetInfo *X = new MCSubtargetInfo();
61 InitSystemZMCSubtargetInfo(X, CPU, FS);
62 return X;
65 extern "C" void LLVMInitializeSystemZMCSubtargetInfo() {
66 TargetRegistry::RegisterMCSubtargetInfo(TheSystemZTarget,
67 createSystemZMCSubtargetInfo);