aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-gcc.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-08-03 11:54:54 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-04 15:48:37 +0100
commit94e53f8e55e93da8db3d948c3f16d23b7c4ba7a6 (patch)
tree6a7063460808979f86fa0e4f799bb3c915615a03 /gcc/rust/rust-gcc.cc
parent2dc902baa1388841096e16e660082a8e79fce17e (diff)
downloadgcc-94e53f8e55e93da8db3d948c3f16d23b7c4ba7a6.zip
gcc-94e53f8e55e93da8db3d948c3f16d23b7c4ba7a6.tar.gz
gcc-94e53f8e55e93da8db3d948c3f16d23b7c4ba7a6.tar.bz2
Refactor indirect_expression from the gcc-backend wrapper
This brings out the indirect expression out of our gcc wrapper, it also just simplifies down to the normal build_indirect_expr_loc calls. Which does not require specifiying the type since we can reuse TREE_TYPE. This also simplifies the address_expression to just address_expr_with_loc and grabs the type from TREE_TYPE as well.
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r--gcc/rust/rust-gcc.cc24
1 files changed, 0 insertions, 24 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 4fea6fb..27196e8 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -201,8 +201,6 @@ public:
tree var_expression (Bvariable *var, Location);
- tree indirect_expression (tree, tree expr, bool known_valid, Location);
-
tree integer_constant_expression (tree type, mpz_t val);
tree float_constant_expression (tree type, mpfr_t val);
@@ -1053,28 +1051,6 @@ Gcc_backend::var_expression (Bvariable *var, Location location)
return var->get_tree (location);
}
-// An expression that indirectly references an expression.
-
-tree
-Gcc_backend::indirect_expression (tree type_tree, tree expr_tree,
- bool known_valid, Location location)
-{
- if (expr_tree == error_mark_node || type_tree == error_mark_node)
- return error_mark_node;
-
- // If the type of EXPR is a recursive pointer type, then we
- // need to insert a cast before indirecting.
- tree target_type_tree = TREE_TYPE (TREE_TYPE (expr_tree));
- if (VOID_TYPE_P (target_type_tree))
- expr_tree = fold_convert_loc (location.gcc_location (),
- build_pointer_type (type_tree), expr_tree);
-
- tree ret = build_fold_indirect_ref_loc (location.gcc_location (), expr_tree);
- if (known_valid)
- TREE_THIS_NOTRAP (ret) = 1;
- return ret;
-}
-
// Return a typed value as a constant integer.
tree