aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-06 18:25:25 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-08 20:13:11 -0800
commit869fb813039e8933a85f5f2a3a53cde156030b0a (patch)
treeac6fbc1784a8cfd0c39e029b8e079de3789ceec7 /gcc/go/go-gcc.cc
parent3ab49b1c822cf8c5748fa4de0ac970c948de6f8a (diff)
downloadgcc-869fb813039e8933a85f5f2a3a53cde156030b0a.zip
gcc-869fb813039e8933a85f5f2a3a53cde156030b0a.tar.gz
gcc-869fb813039e8933a85f5f2a3a53cde156030b0a.tar.bz2
compiler: recognize Go 1.18 runtime/internal/atomic methods
The Go 1.18 library introduces specific types in runtime/internal/atomic. Recognize and optimize the methods on those types, as we do with the functions in runtime/internal/atomic. While we're here avoid getting confused by methods in any other package that we recognize specially. * go-gcc.cc (Gcc_backend::Gcc_backend): Define builtins __atomic_load_1 and __atomic_store_1. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/383654
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 6319960..f3de7a8 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -898,6 +898,20 @@ Gcc_backend::Gcc_backend()
t, 0);
t = build_function_type_list(unsigned_char_type_node,
+ ptr_type_node,
+ integer_type_node,
+ NULL_TREE);
+ this->define_builtin(BUILT_IN_ATOMIC_LOAD_1, "__atomic_load_1", NULL, t, 0);
+
+ t = build_function_type_list(void_type_node,
+ ptr_type_node,
+ unsigned_char_type_node,
+ integer_type_node,
+ NULL_TREE);
+ this->define_builtin(BUILT_IN_ATOMIC_STORE_1, "__atomic_store_1", NULL,
+ t, 0);
+
+ t = build_function_type_list(unsigned_char_type_node,
ptr_type_node,
unsigned_char_type_node,
integer_type_node,