1 //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "SystemZSubtarget.h"
11 #include "llvm/IR/GlobalValue.h"
12 #include "MCTargetDesc/SystemZMCTargetDesc.h"
14 #define GET_SUBTARGETINFO_TARGET_DESC
15 #define GET_SUBTARGETINFO_CTOR
16 #include "SystemZGenSubtargetInfo.inc"
20 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
21 const std::string &CPU,
22 const std::string &FS)
23 : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false),
24 HasLoadStoreOnCond(false), TargetTriple(TT) {
25 std::string CPUName = CPU;
29 // Parse features string.
30 ParseSubtargetFeatures(CPUName, FS);
33 // Return true if GV binds locally under reloc model RM.
34 static bool bindsLocally(const GlobalValue *GV, Reloc::Model RM) {
35 // For non-PIC, all symbols bind locally.
36 if (RM == Reloc::Static)
39 return GV->hasLocalLinkage() || !GV->hasDefaultVisibility();
42 bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
44 CodeModel::Model CM) const {
45 // PC32DBL accesses require the low bit to be clear. Note that a zero
46 // value selects the default alignment and is therefore OK.
47 if (GV->getAlignment() == 1)
50 // For the small model, all locally-binding symbols are in range.
51 if (CM == CodeModel::Small)
52 return bindsLocally(GV, RM);
54 // For Medium and above, assume that the symbol is not within the 4GB range.
55 // Taking the address of locally-defined text would be OK, but that
56 // case isn't easy to detect.