* Go patch committed: Don't pass iota value to lowering pass
@ 2024-01-23 1:31 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2024-01-23 1:31 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 252 bytes --]
This patch to the Go frontend stops passing the iota value to the
lowering pass. It is no longer used. The iota value is now handled
in the determine-types pass. Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 12357 bytes --]
896148947b9ff4845c8bc334f8eff30f91ff3c9a
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index b41ac99f7a8..c2a6032ae80 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-61b29a99dadf33c48a0a063f50f61e877fb419b8
+ddf3758e4a45ca2816fb68f3e4224501a3c4c438
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 a09d33b868e..51ff0206129 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -1007,7 +1007,7 @@ Expression::make_type(Type* type, Location location)
Expression*
Var_expression::do_lower(Gogo* gogo, Named_object* function,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
if (this->variable_->is_variable())
{
@@ -1158,7 +1158,7 @@ Enclosed_var_expression::do_traverse(Traverse*)
Expression*
Enclosed_var_expression::do_lower(Gogo* gogo, Named_object* function,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
gogo->lower_expression(function, inserter, &this->reference_);
return this;
@@ -2097,7 +2097,7 @@ Unknown_expression::do_is_addressable() const
// Lower a reference to an unknown name.
Expression*
-Unknown_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
+Unknown_expression::do_lower(Gogo*, Named_object*, Statement_inserter*)
{
if (this->is_error_expression())
return Expression::make_error(this->location());
@@ -3642,7 +3642,7 @@ Const_expression::do_is_zero_value() const
// predeclared constant iota into an integer value.
Expression*
-Const_expression::do_lower(Gogo* gogo, Named_object*, Statement_inserter*, int)
+Const_expression::do_lower(Gogo* gogo, Named_object*, Statement_inserter*)
{
Location loc = this->location();
@@ -4120,7 +4120,7 @@ class Iota_expression : public Parser_expression
{ }
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int)
+ do_lower(Gogo*, Named_object*, Statement_inserter*)
{ go_unreachable(); }
// There should only ever be one of these.
@@ -4171,7 +4171,7 @@ Type_conversion_expression::do_type()
Expression*
Type_conversion_expression::do_lower(Gogo* gogo, Named_object*,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
Type* type = this->type_;
Expression* val = this->expr_;
@@ -4997,7 +4997,7 @@ Unary_expression::check_operand_address_taken(Gogo*)
// instead.
Expression*
-Unary_expression::do_lower(Gogo* gogo, Named_object*, Statement_inserter*, int)
+Unary_expression::do_lower(Gogo* gogo, Named_object*, Statement_inserter*)
{
Location loc = this->location();
@@ -6677,7 +6677,7 @@ Binary_expression::eval_complex(Operator op, const Numeric_constant* left_nc,
Expression*
Binary_expression::do_lower(Gogo* gogo, Named_object*,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
Location location = this->location();
@@ -8955,7 +8955,7 @@ class Selector_expression : public Parser_expression
do_issue_nil_check();
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_copy()
@@ -9030,7 +9030,7 @@ Selector_expression::do_issue_nil_check()
// Lower a selector expression to the resolved value.
Expression*
-Selector_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
+Selector_expression::do_lower(Gogo*, Named_object*, Statement_inserter*)
{
if (this->is_error_expression() || this->resolved_ == NULL)
return Expression::make_error(this->location());
@@ -9360,7 +9360,7 @@ Builtin_call_expression::do_set_recover_arg(Expression* arg)
Expression*
Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
if (this->is_error_expression())
return this;
@@ -12564,7 +12564,7 @@ Call_expression::do_discarding_value()
Expression*
Call_expression::do_lower(Gogo* gogo, Named_object*,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
if (this->lowered_ != NULL)
return this->lowered_;
@@ -14836,7 +14836,7 @@ Index_expression::do_issue_nil_check()
// expression into an array index, a string index, or a map index.
Expression*
-Index_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
+Index_expression::do_lower(Gogo*, Named_object*, Statement_inserter*)
{
if (this->is_error_expression())
return Expression::make_error(this->location());
@@ -16211,7 +16211,7 @@ Expression::make_map_index(Expression* map, Expression* index,
Expression*
Field_reference_expression::do_lower(Gogo* gogo, Named_object* function,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
Struct_type* struct_type = this->expr_->type()->struct_type();
if (struct_type == NULL)
@@ -18018,7 +18018,7 @@ class Composite_literal_key_expression : public Parser_expression
do_determine_type(Gogo*, const Type_context*);
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_copy()
@@ -18084,7 +18084,7 @@ Composite_literal_key_expression::do_type()
Expression*
Composite_literal_key_expression::do_lower(Gogo*, Named_object*,
- Statement_inserter*, int)
+ Statement_inserter*)
{
if (this->is_error_expression())
return Expression::make_error(this->location());
@@ -18658,7 +18658,7 @@ Composite_literal_expression::do_check_types(Gogo* gogo)
Expression*
Composite_literal_expression::do_lower(Gogo* gogo, Named_object* function,
- Statement_inserter* inserter, int)
+ Statement_inserter* inserter)
{
if (this->is_error_expression() || this->type_->is_error())
return Expression::make_error(this->location());
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index 87637721372..0eddb58bc50 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -990,9 +990,8 @@ class Expression
// which could not be fully parsed into their final form. It
// returns the same Expression or a new one.
Expression*
- lower(Gogo* gogo, Named_object* function, Statement_inserter* inserter,
- int iota_value)
- { return this->do_lower(gogo, function, inserter, iota_value); }
+ lower(Gogo* gogo, Named_object* function, Statement_inserter* inserter)
+ { return this->do_lower(gogo, function, inserter); }
// Flatten an expression. This is called after order_evaluation.
// FUNCTION is the function we are in; it will be NULL for an
@@ -1162,7 +1161,7 @@ class Expression
// Return a lowered expression.
virtual Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int)
+ do_lower(Gogo*, Named_object*, Statement_inserter*)
{ return this; }
// Return a flattened expression.
@@ -1472,7 +1471,7 @@ class Parser_expression : public Expression
protected:
virtual Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int) = 0;
+ do_lower(Gogo*, Named_object*, Statement_inserter*) = 0;
Bexpression*
do_get_backend(Translate_context*)
@@ -1511,7 +1510,7 @@ class Const_expression : public Expression
do_traverse(Traverse*);
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
bool
do_is_constant() const
@@ -1599,7 +1598,7 @@ class Var_expression : public Expression
protected:
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Type*
do_type();
@@ -1663,7 +1662,7 @@ class Enclosed_var_expression : public Expression
do_traverse(Traverse*);
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_flatten(Gogo*, Named_object*, Statement_inserter*);
@@ -1953,7 +1952,7 @@ class Type_conversion_expression : public Expression
do_traverse(Traverse* traverse);
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_flatten(Gogo*, Named_object*, Statement_inserter*);
@@ -2154,7 +2153,7 @@ class Unary_expression : public Expression
{ return Expression::traverse(&this->expr_, traverse); }
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_flatten(Gogo*, Named_object*, Statement_inserter*);
@@ -2315,7 +2314,7 @@ class Binary_expression : public Expression
do_traverse(Traverse* traverse);
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_flatten(Gogo*, Named_object*, Statement_inserter*);
@@ -2440,7 +2439,7 @@ class String_concat_expression : public Expression
{ return this->exprs_->traverse(traverse); }
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int)
+ do_lower(Gogo*, Named_object*, Statement_inserter*)
{ return this; }
Expression*
@@ -2628,7 +2627,7 @@ class Call_expression : public Expression
do_traverse(Traverse*);
virtual Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
virtual Expression*
do_flatten(Gogo*, Named_object*, Statement_inserter*);
@@ -2823,7 +2822,7 @@ class Builtin_call_expression : public Call_expression
protected:
// This overrides Call_expression::do_lower.
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_flatten(Gogo*, Named_object*, Statement_inserter*);
@@ -3169,7 +3168,7 @@ class Unknown_expression : public Parser_expression
do_is_addressable() const;
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_copy()
@@ -3238,7 +3237,7 @@ class Index_expression : public Parser_expression
do_is_addressable() const;
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*s);
Expression*
do_copy()
@@ -3739,7 +3738,7 @@ class Field_reference_expression : public Expression
{ return Expression::traverse(&this->expr_, traverse); }
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Type*
do_type();
@@ -3965,7 +3964,7 @@ class Composite_literal_expression : public Parser_expression
do_check_types(Gogo*);
Expression*
- do_lower(Gogo*, Named_object*, Statement_inserter*, int);
+ do_lower(Gogo*, Named_object*, Statement_inserter*);
Expression*
do_copy();
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 7a6b9e31df0..71988dce3a8 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -2914,7 +2914,7 @@ class Lower_parse_tree : public Traverse
| traverse_functions
| traverse_statements
| traverse_expressions),
- gogo_(gogo), function_(function), iota_value_(-1), inserter_()
+ gogo_(gogo), function_(function), inserter_()
{ }
void
@@ -2941,8 +2941,6 @@ class Lower_parse_tree : public Traverse
Gogo* gogo_;
// The function we are traversing.
Named_object* function_;
- // Value to use for the predeclared constant iota.
- int iota_value_;
// Current statement inserter for use by expressions.
Statement_inserter inserter_;
};
@@ -3086,7 +3084,7 @@ Lower_parse_tree::expression(Expression** pexpr)
{
Expression* e = *pexpr;
Expression* enew = e->lower(this->gogo_, this->function_,
- &this->inserter_, this->iota_value_);
+ &this->inserter_);
if (enew == e)
break;
if (enew->traverse_subexpressions(this) == TRAVERSE_EXIT)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-23 1:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 1:31 Go patch committed: Don't pass iota value to lowering pass Ian Lance Taylor
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).