/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/Basic/Targets/SystemZ.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===--- SystemZ.h - Declare SystemZ target feature support -----*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file declares SystemZ TargetInfo objects. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_SYSTEMZ_H |
14 | | #define LLVM_CLANG_LIB_BASIC_TARGETS_SYSTEMZ_H |
15 | | |
16 | | #include "clang/Basic/TargetInfo.h" |
17 | | #include "clang/Basic/TargetOptions.h" |
18 | | #include "llvm/ADT/Triple.h" |
19 | | #include "llvm/Support/Compiler.h" |
20 | | |
21 | | namespace clang { |
22 | | namespace targets { |
23 | | |
24 | | class LLVM_LIBRARY_VISIBILITY SystemZTargetInfo : public TargetInfo { |
25 | | |
26 | | static const Builtin::Info BuiltinInfo[]; |
27 | | static const char *const GCCRegNames[]; |
28 | | std::string CPU; |
29 | | int ISARevision; |
30 | | bool HasTransactionalExecution; |
31 | | bool HasVector; |
32 | | |
33 | | public: |
34 | | SystemZTargetInfo(const llvm::Triple &Triple, const TargetOptions &) |
35 | | : TargetInfo(Triple), CPU("z10"), ISARevision(8), |
36 | 77 | HasTransactionalExecution(false), HasVector(false) { |
37 | 77 | IntMaxType = SignedLong; |
38 | 77 | Int64Type = SignedLong; |
39 | 77 | TLSSupported = true; |
40 | 77 | IntWidth = IntAlign = 32; |
41 | 77 | LongWidth = LongLongWidth = LongAlign = LongLongAlign = 64; |
42 | 77 | PointerWidth = PointerAlign = 64; |
43 | 77 | LongDoubleWidth = 128; |
44 | 77 | LongDoubleAlign = 64; |
45 | 77 | LongDoubleFormat = &llvm::APFloat::IEEEquad(); |
46 | 77 | DefaultAlignForAttributeAligned = 64; |
47 | 77 | MinGlobalAlign = 16; |
48 | 77 | resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"); |
49 | 77 | MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; |
50 | 77 | } clang::targets::SystemZTargetInfo::SystemZTargetInfo(llvm::Triple const&, clang::TargetOptions const&) Line | Count | Source | 36 | 17 | HasTransactionalExecution(false), HasVector(false) { | 37 | 17 | IntMaxType = SignedLong; | 38 | 17 | Int64Type = SignedLong; | 39 | 17 | TLSSupported = true; | 40 | 17 | IntWidth = IntAlign = 32; | 41 | 17 | LongWidth = LongLongWidth = LongAlign = LongLongAlign = 64; | 42 | 17 | PointerWidth = PointerAlign = 64; | 43 | 17 | LongDoubleWidth = 128; | 44 | 17 | LongDoubleAlign = 64; | 45 | 17 | LongDoubleFormat = &llvm::APFloat::IEEEquad(); | 46 | 17 | DefaultAlignForAttributeAligned = 64; | 47 | 17 | MinGlobalAlign = 16; | 48 | 17 | resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"); | 49 | 17 | MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; | 50 | 17 | } |
clang::targets::SystemZTargetInfo::SystemZTargetInfo(llvm::Triple const&, clang::TargetOptions const&) Line | Count | Source | 36 | 60 | HasTransactionalExecution(false), HasVector(false) { | 37 | 60 | IntMaxType = SignedLong; | 38 | 60 | Int64Type = SignedLong; | 39 | 60 | TLSSupported = true; | 40 | 60 | IntWidth = IntAlign = 32; | 41 | 60 | LongWidth = LongLongWidth = LongAlign = LongLongAlign = 64; | 42 | 60 | PointerWidth = PointerAlign = 64; | 43 | 60 | LongDoubleWidth = 128; | 44 | 60 | LongDoubleAlign = 64; | 45 | 60 | LongDoubleFormat = &llvm::APFloat::IEEEquad(); | 46 | 60 | DefaultAlignForAttributeAligned = 64; | 47 | 60 | MinGlobalAlign = 16; | 48 | 60 | resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"); | 49 | 60 | MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; | 50 | 60 | } |
|
51 | | |
52 | | void getTargetDefines(const LangOptions &Opts, |
53 | | MacroBuilder &Builder) const override; |
54 | | |
55 | | ArrayRef<Builtin::Info> getTargetBuiltins() const override; |
56 | | |
57 | | ArrayRef<const char *> getGCCRegNames() const override; |
58 | | |
59 | 0 | ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { |
60 | 0 | // No aliases. |
61 | 0 | return None; |
62 | 0 | } |
63 | | |
64 | | ArrayRef<TargetInfo::AddlRegName> getGCCAddlRegNames() const override; |
65 | | |
66 | | bool validateAsmConstraint(const char *&Name, |
67 | | TargetInfo::ConstraintInfo &info) const override; |
68 | | |
69 | 58 | const char *getClobbers() const override { |
70 | 58 | // FIXME: Is this really right? |
71 | 58 | return ""; |
72 | 58 | } |
73 | | |
74 | 57 | BuiltinVaListKind getBuiltinVaListKind() const override { |
75 | 57 | return TargetInfo::SystemZBuiltinVaList; |
76 | 57 | } |
77 | | |
78 | | int getISARevision(StringRef Name) const; |
79 | | |
80 | 0 | bool isValidCPUName(StringRef Name) const override { |
81 | 0 | return getISARevision(Name) != -1; |
82 | 0 | } |
83 | | |
84 | | void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override; |
85 | | |
86 | 56 | bool setCPU(const std::string &Name) override { |
87 | 56 | CPU = Name; |
88 | 56 | ISARevision = getISARevision(CPU); |
89 | 56 | return ISARevision != -1; |
90 | 56 | } |
91 | | |
92 | | bool |
93 | | initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, |
94 | | StringRef CPU, |
95 | 3.05k | const std::vector<std::string> &FeaturesVec) const override { |
96 | 3.05k | int ISARevision = getISARevision(CPU); |
97 | 3.05k | if (ISARevision >= 10) |
98 | 3.02k | Features["transactional-execution"] = true; |
99 | 3.05k | if (ISARevision >= 11) |
100 | 2.92k | Features["vector"] = true; |
101 | 3.05k | if (ISARevision >= 12) |
102 | 478 | Features["vector-enhancements-1"] = true; |
103 | 3.05k | if (ISARevision >= 13) |
104 | 151 | Features["vector-enhancements-2"] = true; |
105 | 3.05k | return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); |
106 | 3.05k | } |
107 | | |
108 | | bool handleTargetFeatures(std::vector<std::string> &Features, |
109 | 75 | DiagnosticsEngine &Diags) override { |
110 | 75 | HasTransactionalExecution = false; |
111 | 75 | HasVector = false; |
112 | 120 | for (const auto &Feature : Features) { |
113 | 120 | if (Feature == "+transactional-execution") |
114 | 45 | HasTransactionalExecution = true; |
115 | 75 | else if (Feature == "+vector") |
116 | 42 | HasVector = true; |
117 | 120 | } |
118 | 75 | // If we use the vector ABI, vector types are 64-bit aligned. |
119 | 75 | if (HasVector) { |
120 | 42 | MaxVectorAlign = 64; |
121 | 42 | resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64" |
122 | 42 | "-v128:64-a:8:16-n32:64"); |
123 | 42 | } |
124 | 75 | return true; |
125 | 75 | } |
126 | | |
127 | | bool hasFeature(StringRef Feature) const override; |
128 | | |
129 | | CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { |
130 | | switch (CC) { |
131 | | case CC_C: |
132 | | case CC_Swift: |
133 | | case CC_OpenCLKernel: |
134 | | return CCCR_OK; |
135 | | default: |
136 | | return CCCR_Warning; |
137 | | } |
138 | | } |
139 | | |
140 | 46 | StringRef getABI() const override { |
141 | 46 | if (HasVector) |
142 | 29 | return "vector"; |
143 | 17 | return ""; |
144 | 17 | } |
145 | | |
146 | 1 | const char *getLongDoubleMangling() const override { return "g"; } |
147 | | }; |
148 | | } // namespace targets |
149 | | } // namespace clang |
150 | | #endif // LLVM_CLANG_LIB_BASIC_TARGETS_SYSTEMZ_H |