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