File tree 3 files changed +39
-0
lines changed 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,18 @@ static constexpr CPUSuffix Suffixes[] = {
238
238
{{" hexagonv73" }, {" 73" }},
239
239
};
240
240
241
+ std::optional<unsigned > HexagonTargetInfo::getHexagonCPURev (StringRef Name) {
242
+ StringRef Arch = Name;
243
+ Arch.consume_front (" hexagonv" );
244
+ Arch.consume_back (" t" );
245
+
246
+ unsigned Val;
247
+ if (!Arch.getAsInteger (0 , Val))
248
+ return Val;
249
+
250
+ return std::nullopt;
251
+ }
252
+
241
253
const char *HexagonTargetInfo::getHexagonCPUSuffix (StringRef Name) {
242
254
const CPUSuffix *Item = llvm::find_if (
243
255
Suffixes, [Name](const CPUSuffix &S) { return S.Name == Name; });
Original file line number Diff line number Diff line change 17
17
#include " clang/Basic/TargetOptions.h"
18
18
#include " llvm/Support/Compiler.h"
19
19
#include " llvm/TargetParser/Triple.h"
20
+ #include < optional>
20
21
21
22
namespace clang {
22
23
namespace targets {
@@ -115,6 +116,7 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo {
115
116
std::string_view getClobbers () const override { return " " ; }
116
117
117
118
static const char *getHexagonCPUSuffix (StringRef Name);
119
+ static std::optional<unsigned > getHexagonCPURev (StringRef Name);
118
120
119
121
bool isValidCPUName (StringRef Name) const override {
120
122
return getHexagonCPUSuffix (Name);
@@ -139,6 +141,14 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo {
139
141
}
140
142
141
143
bool hasBitIntType () const override { return true ; }
144
+
145
+ std::pair<unsigned , unsigned > hardwareInterferenceSizes () const override {
146
+ std::optional<unsigned > Rev = getHexagonCPURev (CPU);
147
+
148
+ // V73 and later have 64-byte cache lines.
149
+ unsigned CacheLineSizeBytes = Rev >= 73 ? 64 : 32 ;
150
+ return std::make_pair (CacheLineSizeBytes, CacheLineSizeBytes);
151
+ }
142
152
};
143
153
} // namespace targets
144
154
} // namespace clang
Original file line number Diff line number Diff line change 169
169
// CHECK-ATOMIC: #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2
170
170
// CHECK-ATOMIC: #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
171
171
// CHECK-ATOMIC: #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
172
+
173
+ // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-linux-musl \
174
+ // RUN: -target-cpu hexagonv67 | FileCheck \
175
+ // RUN: %s -check-prefix CHECK-INTERFERENCE
176
+ // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \
177
+ // RUN: -target-cpu hexagonv67 | FileCheck \
178
+ // RUN: %s -check-prefix CHECK-INTERFERENCE
179
+ // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \
180
+ // RUN: -target-cpu hexagonv71t | FileCheck \
181
+ // RUN: %s -check-prefix CHECK-INTERFERENCE
182
+ // CHECK-INTERFERENCE: #define __GCC_CONSTRUCTIVE_SIZE 32
183
+ // CHECK-INTERFERENCE: #define __GCC_DESTRUCTIVE_SIZE 32
184
+ // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \
185
+ // RUN: -target-cpu hexagonv73 | FileCheck \
186
+ // RUN: %s -check-prefix CHECK-INTERFERENCE-73
187
+ // CHECK-INTERFERENCE-73: #define __GCC_CONSTRUCTIVE_SIZE 64
188
+ // CHECK-INTERFERENCE-73: #define __GCC_DESTRUCTIVE_SIZE 64
You can’t perform that action at this time.
0 commit comments