From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 4DA4F3857357; Tue, 16 Jan 2024 18:13:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DA4F3857357 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705428810; bh=cSnVwlVHrMU5+iSI9PpIz+tY3d9HTd/w2KH2tQH02wk=; h=From:To:Subject:Date:From; b=hj3f8c2A2bhIJh19E5ksmLwVSs9/SF3gZP0AgkbgmW3XyK6ttO9Qh9dnCkMgl+y+U jw91/M3sOWR0iSHuxZ/n1l/pK/jpXBI6R+eW/cB5/fief7AhrrqDpsCfh9XkvtIsFR TSxcSs421n5/ueFdEJBy5AXEjHHcvoDnB4VvsFKs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8013] gccrs: Remove unused complex number support X-Act-Checkin: gcc X-Git-Author: Owen Avery X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 879ba4e8ca4bb584d43fd5b3e273cd9cb29efbf2 X-Git-Newrev: bf6fcd8790588d81c3634d4075691b8ac28135b4 Message-Id: <20240116181330.4DA4F3857357@sourceware.org> Date: Tue, 16 Jan 2024 18:13:30 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bf6fcd8790588d81c3634d4075691b8ac28135b4 commit r14-8013-gbf6fcd8790588d81c3634d4075691b8ac28135b4 Author: Owen Avery Date: Tue Sep 12 21:42:01 2023 -0400 gccrs: Remove unused complex number support gcc/rust/ChangeLog: * rust-backend.h (complex_type): Remove. (complex_constant_expression): Remove. (real_part_expression): Remove. (imag_part_expression): Remove. (complex_expression): Remove. * rust-gcc.cc (complex_type): Remove. (complex_constant_expression): Remove. (real_part_expression): Remove. (imag_part_expression): Remove. (complex_expression): Remove. Signed-off-by: Owen Avery Diff: --- gcc/rust/rust-backend.h | 20 ----------- gcc/rust/rust-gcc.cc | 90 ------------------------------------------------- 2 files changed, 110 deletions(-) diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index 3aec68159ea..5a1bbd874e9 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -94,10 +94,6 @@ integer_type (bool is_unsigned, int bits); tree float_type (int bits); -// Get an unnamed complex type with the given number of bits (64 or 128). -tree -complex_type (int bits); - // Get a pointer type. tree pointer_type (tree to_type); @@ -186,10 +182,6 @@ var_expression (Bvariable *var, location_t); tree float_constant_expression (tree btype, mpfr_t val); -// Return an expression for the complex value VAL in BTYPE. -tree -complex_constant_expression (tree btype, mpc_t val); - // Return an expression for the string value VAL. tree string_constant_expression (const std::string &val); @@ -206,18 +198,6 @@ wchar_constant_expression (wchar_t c); tree boolean_constant_expression (bool val); -// Return an expression for the real part of BCOMPLEX. -tree -real_part_expression (tree bcomplex, location_t); - -// Return an expression for the imaginary part of BCOMPLEX. -tree -imag_part_expression (tree bcomplex, location_t); - -// Return an expression for the complex number (BREAL, BIMAG). -tree -complex_expression (tree breal, tree bimag, location_t); - // Return an expression that converts EXPR to TYPE. tree convert_expression (tree type, tree expr, location_t); diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 68b80fd0f09..be6e4ae5498 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -420,28 +420,6 @@ float_type (int bits) return type; } -// Get an unnamed complex type. - -tree -complex_type (int bits) -{ - tree type; - if (bits == FLOAT_TYPE_SIZE * 2) - type = complex_float_type_node; - else if (bits == DOUBLE_TYPE_SIZE * 2) - type = complex_double_type_node; - else if (bits == LONG_DOUBLE_TYPE_SIZE * 2) - type = complex_long_double_type_node; - else - { - type = make_node (REAL_TYPE); - TYPE_PRECISION (type) = bits / 2; - layout_type (type); - type = build_complex_type (type); - } - return type; -} - // Get a pointer type. tree @@ -818,30 +796,6 @@ float_constant_expression (tree t, mpfr_t val) return ret; } -// Return a typed real and imaginary value as a constant complex number. - -tree -complex_constant_expression (tree t, mpc_t val) -{ - tree ret; - if (t == error_mark_node) - return error_mark_node; - - REAL_VALUE_TYPE r1; - real_from_mpfr (&r1, mpc_realref (val), TREE_TYPE (t), GMP_RNDN); - REAL_VALUE_TYPE r2; - real_convert (&r2, TYPE_MODE (TREE_TYPE (t)), &r1); - - REAL_VALUE_TYPE r3; - real_from_mpfr (&r3, mpc_imagref (val), TREE_TYPE (t), GMP_RNDN); - REAL_VALUE_TYPE r4; - real_convert (&r4, TYPE_MODE (TREE_TYPE (t)), &r3); - - ret = build_complex (t, build_real (TREE_TYPE (t), r2), - build_real (TREE_TYPE (t), r4)); - return ret; -} - // Make a constant string expression. tree @@ -877,50 +831,6 @@ boolean_constant_expression (bool val) return val ? boolean_true_node : boolean_false_node; } -// Return the real part of a complex expression. - -tree -real_part_expression (tree complex_tree, location_t location) -{ - if (complex_tree == error_mark_node) - return error_mark_node; - gcc_assert (COMPLEX_FLOAT_TYPE_P (TREE_TYPE (complex_tree))); - tree ret - = fold_build1_loc (location, REALPART_EXPR, - TREE_TYPE (TREE_TYPE (complex_tree)), complex_tree); - return ret; -} - -// Return the imaginary part of a complex expression. - -tree -imag_part_expression (tree complex_tree, location_t location) -{ - if (complex_tree == error_mark_node) - return error_mark_node; - gcc_assert (COMPLEX_FLOAT_TYPE_P (TREE_TYPE (complex_tree))); - tree ret - = fold_build1_loc (location, IMAGPART_EXPR, - TREE_TYPE (TREE_TYPE (complex_tree)), complex_tree); - return ret; -} - -// Make a complex expression given its real and imaginary parts. - -tree -complex_expression (tree real_tree, tree imag_tree, location_t location) -{ - if (real_tree == error_mark_node || imag_tree == error_mark_node) - return error_mark_node; - gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (real_tree)) - == TYPE_MAIN_VARIANT (TREE_TYPE (imag_tree))); - gcc_assert (SCALAR_FLOAT_TYPE_P (TREE_TYPE (real_tree))); - tree ret = fold_build2_loc (location, COMPLEX_EXPR, - build_complex_type (TREE_TYPE (real_tree)), - real_tree, imag_tree); - return ret; -} - // An expression that converts an expression to a different type. tree