aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-04-02 14:38:42 +0100
committergingerBill <bill@gingerbill.org>2022-04-02 14:38:42 +0100
commita232c0888c4b711ceb94563defdeef514eafb28a (patch)
treefab13fa9ecf83f5744c0bc6d71dd53f65782758f /src/types.cpp
parentc3a292a8c7baeef53436ce5cd15c2e18e6c52943 (diff)
`intrinsics.atomic_type_is_lock_free`
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index e10dae1ed..b4dc17256 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -2218,6 +2218,17 @@ bool elem_type_can_be_constant(Type *t) {
return true;
}
+bool is_type_lock_free(Type *t) {
+ t = core_type(t);
+ if (t == t_invalid) {
+ return false;
+ }
+ i64 sz = type_size_of(t);
+ // TODO(bill): Figure this out correctly
+ return sz <= build_context.max_align;
+}
+
+
bool is_type_comparable(Type *t) {
t = base_type(t);