1*9880d681SAndroid Build Coastguard Worker //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker #include "SystemZSubtarget.h"
11*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/SystemZMCTargetDesc.h"
12*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/GlobalValue.h"
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker using namespace llvm;
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker #define DEBUG_TYPE "systemz-subtarget"
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_TARGET_DESC
19*9880d681SAndroid Build Coastguard Worker #define GET_SUBTARGETINFO_CTOR
20*9880d681SAndroid Build Coastguard Worker #include "SystemZGenSubtargetInfo.inc"
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker // Pin the vtable to this file.
anchor()23*9880d681SAndroid Build Coastguard Worker void SystemZSubtarget::anchor() {}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker SystemZSubtarget &
initializeSubtargetDependencies(StringRef CPU,StringRef FS)26*9880d681SAndroid Build Coastguard Worker SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
27*9880d681SAndroid Build Coastguard Worker std::string CPUName = CPU;
28*9880d681SAndroid Build Coastguard Worker if (CPUName.empty())
29*9880d681SAndroid Build Coastguard Worker CPUName = "generic";
30*9880d681SAndroid Build Coastguard Worker // Parse features string.
31*9880d681SAndroid Build Coastguard Worker ParseSubtargetFeatures(CPUName, FS);
32*9880d681SAndroid Build Coastguard Worker return *this;
33*9880d681SAndroid Build Coastguard Worker }
34*9880d681SAndroid Build Coastguard Worker
SystemZSubtarget(const Triple & TT,const std::string & CPU,const std::string & FS,const TargetMachine & TM)35*9880d681SAndroid Build Coastguard Worker SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
36*9880d681SAndroid Build Coastguard Worker const std::string &FS,
37*9880d681SAndroid Build Coastguard Worker const TargetMachine &TM)
38*9880d681SAndroid Build Coastguard Worker : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false),
39*9880d681SAndroid Build Coastguard Worker HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false),
40*9880d681SAndroid Build Coastguard Worker HasPopulationCount(false), HasFastSerialization(false),
41*9880d681SAndroid Build Coastguard Worker HasInterlockedAccess1(false), HasMiscellaneousExtensions(false),
42*9880d681SAndroid Build Coastguard Worker HasTransactionalExecution(false), HasProcessorAssist(false),
43*9880d681SAndroid Build Coastguard Worker HasVector(false), HasLoadStoreOnCond2(false), TargetTriple(TT),
44*9880d681SAndroid Build Coastguard Worker InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
45*9880d681SAndroid Build Coastguard Worker TSInfo(), FrameLowering() {}
46*9880d681SAndroid Build Coastguard Worker
isPC32DBLSymbol(const GlobalValue * GV,CodeModel::Model CM) const47*9880d681SAndroid Build Coastguard Worker bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
48*9880d681SAndroid Build Coastguard Worker CodeModel::Model CM) const {
49*9880d681SAndroid Build Coastguard Worker // PC32DBL accesses require the low bit to be clear. Note that a zero
50*9880d681SAndroid Build Coastguard Worker // value selects the default alignment and is therefore OK.
51*9880d681SAndroid Build Coastguard Worker if (GV->getAlignment() == 1)
52*9880d681SAndroid Build Coastguard Worker return false;
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker // For the small model, all locally-binding symbols are in range.
55*9880d681SAndroid Build Coastguard Worker if (CM == CodeModel::Small)
56*9880d681SAndroid Build Coastguard Worker return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker // For Medium and above, assume that the symbol is not within the 4GB range.
59*9880d681SAndroid Build Coastguard Worker // Taking the address of locally-defined text would be OK, but that
60*9880d681SAndroid Build Coastguard Worker // case isn't easy to detect.
61*9880d681SAndroid Build Coastguard Worker return false;
62*9880d681SAndroid Build Coastguard Worker }
63