blob: eb4a0962f7eb2ae63cd2d17ea5c9407ed1235689 [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
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#include "SystemZSubtarget.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000011#include "MCTargetDesc/SystemZMCTargetDesc.h"
Ulrich Weigand5f613df2013-05-06 16:15:19 +000012#include "llvm/IR/GlobalValue.h"
13
Chandler Carruthd174b722014-04-22 02:03:14 +000014using namespace llvm;
15
Chandler Carruthe96dd892014-04-21 22:55:11 +000016#define DEBUG_TYPE "systemz-subtarget"
17
Ulrich Weigand5f613df2013-05-06 16:15:19 +000018#define GET_SUBTARGETINFO_TARGET_DESC
19#define GET_SUBTARGETINFO_CTOR
20#include "SystemZGenSubtargetInfo.inc"
21
Eric Christopher0eaa5412014-07-02 22:05:40 +000022// Pin the vtable to this file.
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000023void SystemZSubtarget::anchor() {}
24
Eric Christopher52349952014-07-01 20:19:02 +000025SystemZSubtarget &
26SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
Ulrich Weigand5f613df2013-05-06 16:15:19 +000027 std::string CPUName = CPU;
28 if (CPUName.empty())
Richard Sandifordf834ea12013-10-31 12:14:17 +000029 CPUName = "generic";
Ulrich Weigand5f613df2013-05-06 16:15:19 +000030 // Parse features string.
31 ParseSubtargetFeatures(CPUName, FS);
Eric Christopher52349952014-07-01 20:19:02 +000032 return *this;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000033}
34
Daniel Sandersa73f1fd2015-06-10 12:11:26 +000035SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
Eric Christopher52349952014-07-01 20:19:02 +000036 const std::string &FS,
37 const TargetMachine &TM)
Daniel Sanders50f17232015-09-15 16:17:27 +000038 : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false),
Eric Christopher52349952014-07-01 20:19:02 +000039 HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false),
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000040 HasPopulationCount(false), HasMessageSecurityAssist3(false),
41 HasMessageSecurityAssist4(false), HasResetReferenceBitsMultiple(false),
Ulrich Weigand33a441a2017-05-10 12:42:00 +000042 HasFastSerialization(false), HasInterlockedAccess1(false),
43 HasMiscellaneousExtensions(false),
Ulrich Weigand84404f32016-11-28 14:01:51 +000044 HasExecutionHint(false), HasLoadAndTrap(false),
45 HasTransactionalExecution(false), HasProcessorAssist(false),
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000046 HasDFPZonedConversion(false), HasEnhancedDAT2(false),
Ulrich Weigand84404f32016-11-28 14:01:51 +000047 HasVector(false), HasLoadStoreOnCond2(false),
Ulrich Weigand33a441a2017-05-10 12:42:00 +000048 HasLoadAndZeroRightmostByte(false), HasMessageSecurityAssist5(false),
Ulrich Weigand3f484e62017-05-30 10:15:16 +000049 HasDFPPackedConversion(false),
Ulrich Weigand92c2c672016-11-11 12:46:28 +000050 TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
51 TLInfo(TM, *this), TSInfo(), FrameLowering() {}
Eric Christopher52349952014-07-01 20:19:02 +000052
Ulrich Weigand5f613df2013-05-06 16:15:19 +000053bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000054 CodeModel::Model CM) const {
55 // PC32DBL accesses require the low bit to be clear. Note that a zero
56 // value selects the default alignment and is therefore OK.
57 if (GV->getAlignment() == 1)
58 return false;
59
60 // For the small model, all locally-binding symbols are in range.
61 if (CM == CodeModel::Small)
Rafael Espindola3beef8d2016-06-27 23:15:57 +000062 return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
Ulrich Weigand5f613df2013-05-06 16:15:19 +000063
64 // For Medium and above, assume that the symbol is not within the 4GB range.
65 // Taking the address of locally-defined text would be OK, but that
66 // case isn't easy to detect.
67 return false;
68}