Anton Korobeynikov | 4403b93 | 2009-07-16 13:27:25 +0000 | [diff] [blame] | 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 TargetSubtarget. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "SystemZSubtarget.h" |
| 15 | #include "SystemZ.h" |
| 16 | #include "SystemZGenSubtarget.inc" |
Anton Korobeynikov | 6fe326c | 2009-07-16 14:16:05 +0000 | [diff] [blame] | 17 | #include "llvm/GlobalValue.h" |
Anton Korobeynikov | 4403b93 | 2009-07-16 13:27:25 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetMachine.h" |
| 19 | |
| 20 | using namespace llvm; |
| 21 | |
Daniel Dunbar | 3be0340 | 2009-08-02 22:11:08 +0000 | [diff] [blame] | 22 | SystemZSubtarget::SystemZSubtarget(const std::string &TT, |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame^] | 23 | const std::string &CPU, |
Anton Korobeynikov | 747052c | 2009-07-16 14:05:00 +0000 | [diff] [blame] | 24 | const std::string &FS): |
| 25 | HasZ10Insts(false) { |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame^] | 26 | std::string CPUName = CPU; |
| 27 | if (CPUName.empty()) |
| 28 | CPUName = "z9"; |
Anton Korobeynikov | 4403b93 | 2009-07-16 13:27:25 +0000 | [diff] [blame] | 29 | |
| 30 | // Parse features string. |
Evan Cheng | 276365d | 2011-06-30 01:53:36 +0000 | [diff] [blame^] | 31 | ParseSubtargetFeatures(FS, CPUName); |
Anton Korobeynikov | 4403b93 | 2009-07-16 13:27:25 +0000 | [diff] [blame] | 32 | } |
Anton Korobeynikov | 6fe326c | 2009-07-16 14:16:05 +0000 | [diff] [blame] | 33 | |
| 34 | /// True if accessing the GV requires an extra load. |
| 35 | bool SystemZSubtarget::GVRequiresExtraLoad(const GlobalValue* GV, |
| 36 | const TargetMachine& TM, |
| 37 | bool isDirectCall) const { |
| 38 | if (TM.getRelocationModel() == Reloc::PIC_) { |
| 39 | // Extra load is needed for all externally visible. |
| 40 | if (isDirectCall) |
| 41 | return false; |
| 42 | |
| 43 | if (GV->hasLocalLinkage() || GV->hasHiddenVisibility()) |
| 44 | return false; |
| 45 | |
| 46 | return true; |
| 47 | } |
| 48 | |
| 49 | return false; |
| 50 | } |