From f538c29d78646c060e391770b6e5e821b99c7685 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 8 Sep 2023 15:40:28 +0200 Subject: [PATCH] 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` --- 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 2f8bc498ddc0..243aab7dcb40 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 25dd3706fd40..3aec68159eae 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 1aca71f1b653..88bdca1adc66 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 -- 2.47.2