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 "MCTargetDesc/SystemZMCTargetDesc.h"
12 #include "llvm/IR/GlobalValue.h"
16 #define DEBUG_TYPE "systemz-subtarget"
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "SystemZGenSubtargetInfo.inc"
22 // Pin the vtable to this file.
23 void SystemZSubtarget::anchor() {}
26 SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
27 std::string CPUName = CPU;
30 // Parse features string.
31 ParseSubtargetFeatures(CPUName, FS);
35 SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
36 const std::string &FS,
37 const TargetMachine &TM)
38 : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false),
39 HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false),
40 HasPopulationCount(false), HasMessageSecurityAssist4(false),
41 HasFastSerialization(false), HasInterlockedAccess1(false),
42 HasMiscellaneousExtensions(false),
43 HasExecutionHint(false), HasLoadAndTrap(false),
44 HasTransactionalExecution(false), HasProcessorAssist(false),
45 HasDFPZonedConversion(false),
46 HasVector(false), HasLoadStoreOnCond2(false),
47 HasLoadAndZeroRightmostByte(false), HasMessageSecurityAssist5(false),
48 HasDFPPackedConversion(false),
49 TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
50 TLInfo(TM, *this), TSInfo(), FrameLowering() {}
52 bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
53 CodeModel::Model CM) const {
54 // PC32DBL accesses require the low bit to be clear. Note that a zero
55 // value selects the default alignment and is therefore OK.
56 if (GV->getAlignment() == 1)
59 // For the small model, all locally-binding symbols are in range.
60 if (CM == CodeModel::Small)
61 return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
63 // For Medium and above, assume that the symbol is not within the 4GB range.
64 // Taking the address of locally-defined text would be OK, but that
65 // case isn't easy to detect.