From: Yap Zhi Heng <[email protected]>
Tidying up the inner handlers decls for consistency and for a miniscule linker
optimization.
gcc/rust/ChangeLog:
* backend/rust-intrinsic-handlers.h (Compile::handlers): Remove forward
declaration
for inner namespace since it is no longer needed.
* backend/rust-intrinsic-handlers.cc
(Compile::handlers::inner::unchecked_op):
Declare as static.
(Compile::handlers::inner::expect): Likewise.
(Compile::handlers::inner::try_handler): Likewise.
(Compile::handlers::inner::wrapping_op): Likewise.
(Compile::handlers::inner::op_with_overflow): Likewise.
(Compile::handlers::inner::copy): Likewise.
(Compile::handlers::inner::atomic_store): Likewise.
(Compile::handlers::inner::atomic_load): Likewise.
(Compile::handlers::inner::atomic_binary_op): Likewise.
(Compile::handlers::inner::atomic_compare_exchange): Likewise.
(Compile::handlers::inner::atomic_minmax): Likewise.
(Compile::handlers::inner::prefetch): Likewise.
Signed-off-by: Yap Zhi Heng <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/4f46aa6daf8be3236efdb0f211bbadb5c4c48e50
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/5065
gcc/rust/backend/rust-intrinsic-handlers.cc | 24 ++++++++++-----------
gcc/rust/backend/rust-intrinsic-handlers.h | 22 -------------------
2 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/gcc/rust/backend/rust-intrinsic-handlers.cc
b/gcc/rust/backend/rust-intrinsic-handlers.cc
index f95bed7d8..74d278d33 100644
--- a/gcc/rust/backend/rust-intrinsic-handlers.cc
+++ b/gcc/rust/backend/rust-intrinsic-handlers.cc
@@ -277,7 +277,7 @@ resolve_atomic_builtin (IntrinsicCtx &ctx, const
std::string &prefix)
return decl.value ();
}
-inline void
+static void
unchecked_op (IntrinsicCtx &ctx, tree_code op)
{
auto x = Backend::var_expression (ctx.param_vars[0], UNDEF_LOCATION);
@@ -297,7 +297,7 @@ unchecked_op (IntrinsicCtx &ctx, tree_code op)
ctx.add_statement (return_statement);
}
-inline void
+static void
expect (IntrinsicCtx &ctx, bool likely)
{
tree expr = Backend::var_expression (ctx.param_vars[0], UNDEF_LOCATION);
@@ -323,7 +323,7 @@ expect (IntrinsicCtx &ctx, bool likely)
ctx.add_statement (return_statement);
}
-void
+static void
try_handler (IntrinsicCtx &ctx, bool is_new_api)
{
// The following tricks are needed to make sure the try-catch blocks are not
@@ -402,7 +402,7 @@ try_handler (IntrinsicCtx &ctx, bool is_new_api)
/**
* pub fn wrapping_{add, sub, mul}<T>(lhs: T, rhs: T) -> T;
*/
-void
+static void
wrapping_op (IntrinsicCtx &ctx, tree_code op)
{
// wrapping_<op> intrinsics have two parameter
@@ -427,7 +427,7 @@ wrapping_op (IntrinsicCtx &ctx, tree_code op)
/**
* pub fn add_with_overflow<T>(x: T, y: T) -> (T, bool);
*/
-void
+static void
op_with_overflow (IntrinsicCtx &ctx, tree_code op)
{
// wrapping_<op> intrinsics have two parameter
@@ -510,7 +510,7 @@ op_with_overflow (IntrinsicCtx &ctx, tree_code op)
* fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
* fn copy<T>(src: *const T, dst: *mut T, count: usize);
*/
-void
+static void
copy (IntrinsicCtx &ctx, bool overlaps)
{
// Most intrinsic functions are pure - not `copy_nonoverlapping` and `copy`
@@ -546,7 +546,7 @@ copy (IntrinsicCtx &ctx, bool overlaps)
}
// Compiles atomic_store that has the signature (*mut T, T) -> ()
-void
+static void
atomic_store (IntrinsicCtx &ctx, int ordering)
{
// Most intrinsic functions are pure but not the atomic ones
@@ -577,7 +577,7 @@ atomic_store (IntrinsicCtx &ctx, int ordering)
}
// Compiles atomic_load that has the signature (*const T) -> T
-void
+static void
atomic_load (IntrinsicCtx &ctx, int ordering)
{
// Most intrinsic functions are pure but not the atomic ones
@@ -608,7 +608,7 @@ atomic_load (IntrinsicCtx &ctx, int ordering)
}
// Compiles for atomic builtins that have the signature (*mut T, T) -> T
-void
+static void
atomic_binary_op (IntrinsicCtx &ctx, const std::string &op_name, int ordering)
{
// Most intrinsic functions are pure but not the atomic ones
@@ -642,7 +642,7 @@ atomic_binary_op (IntrinsicCtx &ctx, const std::string
&op_name, int ordering)
}
// Compiles atomic compare exchange with signature (*mut T, T, T) -> (T, bool).
-void
+static void
atomic_compare_exchange (IntrinsicCtx &ctx, bool weak, int success_ordering,
int failure_ordering)
{
@@ -722,7 +722,7 @@ atomic_compare_exchange (IntrinsicCtx &ctx, bool weak, int
success_ordering,
// break;
// } while (true);
// return old_val;
-void
+static void
atomic_minmax (IntrinsicCtx &ctx, AtomicMinMaxKind kind, int ordering)
{
// Most intrinsic functions are pure but not the atomic ones
@@ -1193,7 +1193,7 @@ type_assert (IntrinsicCtx &ctx, TyAssert assert)
}
}
-void
+static void
prefetch (IntrinsicCtx &ctx, Mode mode, Cache cache)
{
// The core library technically allows you to pass any i32 value as a
diff --git a/gcc/rust/backend/rust-intrinsic-handlers.h
b/gcc/rust/backend/rust-intrinsic-handlers.h
index 7654497c0..b57485d13 100644
--- a/gcc/rust/backend/rust-intrinsic-handlers.h
+++ b/gcc/rust/backend/rust-intrinsic-handlers.h
@@ -144,28 +144,6 @@ enum class AtomicMinMaxKind
UnsignedMin,
};
-namespace inner {
-void wrapping_op (IntrinsicCtx &ctx, tree_code op);
-
-void atomic_store (IntrinsicCtx &ctx, int ordering);
-void atomic_load (IntrinsicCtx &ctx, int ordering);
-void atomic_binary_op (IntrinsicCtx &ctx, const std::string &op_name,
- int ordering);
-void atomic_compare_exchange (IntrinsicCtx &ctx, bool weak,
- int success_ordering, int failure_ordering);
-void atomic_minmax (IntrinsicCtx &ctx, AtomicMinMaxKind kind, int ordering);
-inline void copy (IntrinsicCtx &ctx, bool overlaps);
-inline void expect (IntrinsicCtx &ctx, bool likely);
-void try_handler (IntrinsicCtx &ctx, bool is_new_api);
-
-void op_with_overflow (IntrinsicCtx &ctx, tree_code op);
-
-inline void unchecked_op (IntrinsicCtx &ctx, tree_code op);
-
-void prefetch (IntrinsicCtx &ctx, Mode mode, Cache cache);
-
-} // namespace inner
-
void rotate_left (IntrinsicCtx &ctx);
void rotate_right (IntrinsicCtx &ctx);
base-commit: 7b66227880aec8b1fdcb4b17086ea41c99f20629
--
2.56.0