[gcc r14-8008] gccrs: Shorten `make_unsigned_long_tree` code and remove `Backend::integer_constant_expression`
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 18:13:04 GMT 2024
https://gcc.gnu.org/g:f538c29d78646c060e391770b6e5e821b99c7685
commit r14-8008-gf538c29d78646c060e391770b6e5e821b99c7685
Author: Guillaume Gomez <guillaume1.gomez@gmail.com>
Date: Fri Sep 8 15:40:28 2023 +0200
gccrs: Shorten `make_unsigned_long_tree` code and remove `Backend::integer_constant_expression`
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc: Simplify `make_unsigned_long_tree`
* rust-backend.h: Remove `integer_constant_expression`
* rust-gcc.cc: Remove `integer_constant_expression`
Diff:
---
gcc/rust/backend/rust-compile-intrinsic.cc | 5 +----
gcc/rust/rust-backend.h | 4 ----
gcc/rust/rust-gcc.cc | 13 -------------
3 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc
index 2f8bc498ddc..243aab7dcb4 100644
--- a/gcc/rust/backend/rust-compile-intrinsic.cc
+++ b/gcc/rust/backend/rust-compile-intrinsic.cc
@@ -736,10 +736,7 @@ copy_nonoverlapping_handler (Context *ctx, TyTy::FnType *fntype)
static tree
make_unsigned_long_tree (unsigned long value)
{
- mpz_t mpz_value;
- mpz_init_set_ui (mpz_value, value);
-
- return Backend::integer_constant_expression (integer_type_node, mpz_value);
+ return build_int_cst (integer_type_node, value);
}
static tree
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index 25dd3706fd4..3aec68159ea 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -182,10 +182,6 @@ tree zero_expression (tree);
tree
var_expression (Bvariable *var, location_t);
-// Return an expression for the multi-precision integer VAL in BTYPE.
-tree
-integer_constant_expression (tree btype, mpz_t val);
-
// Return an expression for the floating point value VAL in BTYPE.
tree
float_constant_expression (tree btype, mpfr_t val);
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 1aca71f1b65..88bdca1adc6 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -800,19 +800,6 @@ Backend::var_expression (Bvariable *var, location_t location)
return var->get_tree (location);
}
-// Return a typed value as a constant integer.
-// This function does not release the memory of @val
-
-tree
-Backend::integer_constant_expression (tree t, mpz_t val)
-{
- if (t == error_mark_node)
- return error_mark_node;
-
- tree ret = wide_int_to_tree (t, wi::from_mpz (t, val, true));
- return ret;
-}
-
// Return a typed value as a constant floating-point number.
tree
More information about the Gcc-cvs
mailing list