1 //===--- SystemZ.h - Declare SystemZ target feature support -----*- C++ -*-===//
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 // This file declares SystemZ TargetInfo objects.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_SYSTEMZ_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_SYSTEMZ_H
17 #include "clang/Basic/TargetInfo.h"
18 #include "clang/Basic/TargetOptions.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/Compiler.h"
25 class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo {
27 static const Builtin::Info BuiltinInfo[];
28 static const char *const GCCRegNames[];
31 bool HasTransactionalExecution;
35 SystemZTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
36 : TargetInfo(Triple), CPU("z10"), ISARevision(8),
37 HasTransactionalExecution(false), HasVector(false) {
38 IntMaxType = SignedLong;
39 Int64Type = SignedLong;
41 IntWidth = IntAlign = 32;
42 LongWidth = LongLongWidth = LongAlign = LongLongAlign = 64;
43 PointerWidth = PointerAlign = 64;
44 LongDoubleWidth = 128;
46 LongDoubleFormat = &llvm::APFloat::IEEEquad();
47 DefaultAlignForAttributeAligned = 64;
49 resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64");
50 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
53 void getTargetDefines(const LangOptions &Opts,
54 MacroBuilder &Builder) const override;
56 ArrayRef<Builtin::Info> getTargetBuiltins() const override;
58 ArrayRef<const char *> getGCCRegNames() const override;
60 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
65 bool validateAsmConstraint(const char *&Name,
66 TargetInfo::ConstraintInfo &info) const override;
68 const char *getClobbers() const override {
69 // FIXME: Is this really right?
73 BuiltinVaListKind getBuiltinVaListKind() const override {
74 return TargetInfo::SystemZBuiltinVaList;
77 int getISARevision(const StringRef &Name) const;
79 bool isValidCPUName(StringRef Name) const override {
80 return getISARevision(Name) != -1;
83 bool setCPU(const std::string &Name) override {
85 ISARevision = getISARevision(CPU);
86 return ISARevision != -1;
90 initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
92 const std::vector<std::string> &FeaturesVec) const override {
93 int ISARevision = getISARevision(CPU);
94 if (ISARevision >= 10)
95 Features["transactional-execution"] = true;
96 if (ISARevision >= 11)
97 Features["vector"] = true;
98 if (ISARevision >= 12)
99 Features["vector-enhancements-1"] = true;
100 return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
103 bool handleTargetFeatures(std::vector<std::string> &Features,
104 DiagnosticsEngine &Diags) override {
105 HasTransactionalExecution = false;
107 for (const auto &Feature : Features) {
108 if (Feature == "+transactional-execution")
109 HasTransactionalExecution = true;
110 else if (Feature == "+vector")
113 // If we use the vector ABI, vector types are 64-bit aligned.
116 resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64"
117 "-v128:64-a:8:16-n32:64");
122 bool hasFeature(StringRef Feature) const override;
124 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
128 case CC_OpenCLKernel:
135 StringRef getABI() const override {
141 bool useFloat128ManglingForLongDouble() const override { return true; }
143 } // namespace targets
145 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_SYSTEMZ_H