public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-165] compiler: remove Array_index_expression::is_lvalue_ Date: Fri, 6 May 2022 23:18:39 +0000 (GMT) [thread overview] Message-ID: <20220506231839.A89B83858C53@sourceware.org> (raw) https://gcc.gnu.org/g:fa2d5fc0497b702f37ef18a85535826e910a7307 commit r13-165-gfa2d5fc0497b702f37ef18a85535826e910a7307 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Mar 22 10:51:21 2022 -0700 compiler: remove Array_index_expression::is_lvalue_ As of CL 77510 it is never true. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/394695 Diff: --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/expressions.cc | 13 +++++-------- gcc/go/gofrontend/expressions.h | 16 +--------------- gcc/go/gofrontend/types.cc | 21 +-------------------- gcc/go/gofrontend/types.h | 2 +- 5 files changed, 9 insertions(+), 45 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 4559551ab7b..3ec315f6892 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -fbadca004b1e09db177c8e071706841038d1dd64 +6a33e7e30c89edc12340dc470b44791bb1066feb The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index dce48e03bf4..734ecb9492e 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -7671,8 +7671,7 @@ Expression::comparison(Translate_context* context, Type* result_type, && left_type->array_type()->length() == NULL) { Array_type* at = left_type->array_type(); - bool is_lvalue = false; - left = at->get_value_pointer(context->gogo(), left, is_lvalue); + left = at->get_value_pointer(context->gogo(), left); } else if (left_type->interface_type() != NULL) { @@ -9276,7 +9275,7 @@ Builtin_call_expression::flatten_append(Gogo* gogo, Named_object* function, Type* unsafe_ptr_type = Type::make_pointer_type(Type::make_void_type()); Expression* a1 = Expression::make_type_descriptor(element_type, loc); Expression* a2 = Expression::make_temporary_reference(s1tmp, loc); - a2 = slice_type->array_type()->get_value_pointer(gogo, a2, false); + a2 = slice_type->array_type()->get_value_pointer(gogo, a2); a2 = Expression::make_cast(unsafe_ptr_type, a2, loc); Expression* a3 = Expression::make_temporary_reference(l1tmp, loc); Expression* a4 = Expression::make_temporary_reference(c1tmp, loc); @@ -13848,9 +13847,8 @@ Array_index_expression::do_get_backend(Translate_context* context) } else { - Expression* valptr = - array_type->get_value_pointer(gogo, this->array_, - this->is_lvalue_); + Expression* valptr = array_type->get_value_pointer(gogo, + this->array_); Bexpression* ptr = valptr->get_backend(context); ptr = gogo->backend()->pointer_offset_expression(ptr, start, loc); @@ -13891,8 +13889,7 @@ Array_index_expression::do_get_backend(Translate_context* context) Bexpression* offset = gogo->backend()->conditional_expression(bfn, int_btype, cond, zero, start, loc); - Expression* valptr = array_type->get_value_pointer(gogo, this->array_, - this->is_lvalue_); + Expression* valptr = array_type->get_value_pointer(gogo, this->array_); Bexpression* val = valptr->get_backend(context); val = gogo->backend()->pointer_offset_expression(val, offset, loc); diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 92e8d8d96b4..707c19336d8 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -3055,7 +3055,7 @@ class Array_index_expression : public Expression Expression* end, Expression* cap, Location location) : Expression(EXPRESSION_ARRAY_INDEX, location), array_(array), start_(start), end_(end), cap_(cap), type_(NULL), - is_lvalue_(false), needs_bounds_check_(true), is_flattened_(false) + needs_bounds_check_(true), is_flattened_(false) { } // Return the array. @@ -3087,18 +3087,6 @@ class Array_index_expression : public Expression end() const { return this->end_; } - // Return whether this array index expression appears in an lvalue - // (left hand side of assignment) context. - bool - is_lvalue() const - { return this->is_lvalue_; } - - // Update this array index expression to indicate that it appears - // in a left-hand-side or lvalue context. - void - set_is_lvalue() - { this->is_lvalue_ = true; } - void set_needs_bounds_check(bool b) { this->needs_bounds_check_ = b; } @@ -3174,8 +3162,6 @@ class Array_index_expression : public Expression Expression* cap_; // The type of the expression. Type* type_; - // Whether expr appears in an lvalue context. - bool is_lvalue_; // Whether bounds check is needed. bool needs_bounds_check_; // Whether this has already been flattened. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 3de0bd3ae61..ef656705037 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -7815,7 +7815,7 @@ Array_type::finish_backend_element(Gogo* gogo) // Return an expression for a pointer to the values in ARRAY. Expression* -Array_type::get_value_pointer(Gogo*, Expression* array, bool is_lvalue) const +Array_type::get_value_pointer(Gogo*, Expression* array) const { if (this->length() != NULL) { @@ -7828,25 +7828,6 @@ Array_type::get_value_pointer(Gogo*, Expression* array, bool is_lvalue) const } // Slice. - - if (is_lvalue) - { - Temporary_reference_expression* tref = - array->temporary_reference_expression(); - Var_expression* ve = array->var_expression(); - if (tref != NULL) - { - tref = tref->copy()->temporary_reference_expression(); - tref->set_is_lvalue(); - array = tref; - } - else if (ve != NULL) - { - ve = new Var_expression(ve->named_object(), ve->location()); - array = ve; - } - } - return Expression::make_slice_info(array, Expression::SLICE_INFO_VALUE_POINTER, array->location()); diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index c55345a9d64..6d72e09ecf1 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -2800,7 +2800,7 @@ class Array_type : public Type // Return an expression for the pointer to the values in an array. Expression* - get_value_pointer(Gogo*, Expression* array, bool is_lvalue) const; + get_value_pointer(Gogo*, Expression* array) const; // Return an expression for the length of an array with this type. Expression*
reply other threads:[~2022-05-06 23:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220506231839.A89B83858C53@sourceware.org \ --to=ian@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).