]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Shorten `make_unsigned_long_tree` code and remove `Backend::integer_constant_e...
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 8 Sep 2023 13:40:28 +0000 (15:40 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:04:35 +0000 (19:04 +0100)
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
gcc/rust/rust-backend.h
gcc/rust/rust-gcc.cc

index 2f8bc498ddc0606310070c2e10bcae0d8b8f9396..243aab7dcb401802f659b329bbc375320fffb578 100644 (file)
@@ -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
index 25dd3706fd40b4f01fcb12903888a14cc880163c..3aec68159eae64a4a3dccec5f54297b49d1d9788 100644 (file)
@@ -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);
index 1aca71f1b6532d375b9a4eaa18988b3c398d27dc..88bdca1adc6652fbda4995fd107257bb158c5749 100644 (file)
@@ -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