From: Ian Lance Taylor <iant@golang.org>
To: marxin <mliska@suse.cz>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/4] Remove unused functions and fields.
Date: Thu, 18 Oct 2018 23:55:00 -0000 [thread overview]
Message-ID: <CAKOQZ8zDq9tQC8Ynq_qmRt3DNCTb0bbUSxoXmyZ22VJq3SKpkQ@mail.gmail.com> (raw)
In-Reply-To: <192f112275eb2c7bc74fdd3b91c0b32882695d22.1537774329.git.mliska@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]
On Sat, Sep 22, 2018 at 12:08 PM, marxin <mliska@suse.cz> wrote:
>
> gcc/go/ChangeLog:
>
> 2018-09-24 Martin Liska <mliska@suse.cz>
>
> * gofrontend/escape.cc (Gogo::analyze_escape): Remove
> usage of a parameter.
> (Gogo::assign_connectivity): Likewise.
> (class Escape_analysis_tag): Likewise.
> (Gogo::tag_function): Likewise.
> * gofrontend/expressions.cc (Call_expression::do_type): Likewise.
> * gofrontend/gogo.h (class Gogo): Likewise.
> * gofrontend/types.cc (class Call_multiple_result_type): Likewise.
> (Type::make_call_multiple_result_type): Likewise.
> * gofrontend/types.h (class Type): Likewise.
> * gofrontend/wb.cc (class Check_escape): Likewise.
> (Gogo::add_write_barriers): Likewise.
HI, unfortunately this is wrong. As described in
gcc/go/gofrontend/README, the files in that directory are mirrored
from a separate repository (the same is true of the files in the libgo
directory). You should not make changes to them directly in the GCC
repository. I have reverted these changes, as follows. Sorry.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 5463 bytes --]
Index: gcc/go/gofrontend/escape.cc
===================================================================
--- gcc/go/gofrontend/escape.cc (revision 265293)
+++ gcc/go/gofrontend/escape.cc (working copy)
@@ -979,7 +979,7 @@ Gogo::analyze_escape()
for (std::vector<Named_object*>::iterator fn = stack.begin();
fn != stack.end();
++fn)
- this->tag_function(*fn);
+ this->tag_function(context, *fn);
if (this->debug_escape_level() != 0)
{
@@ -1232,10 +1232,10 @@ Escape_analysis_loop::statement(Block*,
class Escape_analysis_assign : public Traverse
{
public:
- Escape_analysis_assign(Escape_context* context)
+ Escape_analysis_assign(Escape_context* context, Named_object* fn)
: Traverse(traverse_statements
| traverse_expressions),
- context_(context)
+ context_(context), fn_(fn)
{ }
// Model statements within a function as assignments and flows between nodes.
@@ -1272,6 +1272,8 @@ public:
private:
// The escape context for this set of functions.
Escape_context* context_;
+ // The current function being analyzed.
+ Named_object* fn_;
};
// Helper function to detect self assignment like the following.
@@ -2702,7 +2704,7 @@ Gogo::assign_connectivity(Escape_context
int save_depth = context->loop_depth();
context->set_loop_depth(1);
- Escape_analysis_assign ea(context);
+ Escape_analysis_assign ea(context, fn);
Function::Results* res = fn->func_value()->result_variables();
if (res != NULL)
{
@@ -3265,13 +3267,17 @@ Gogo::propagate_escape(Escape_context* c
class Escape_analysis_tag
{
public:
- Escape_analysis_tag()
+ Escape_analysis_tag(Escape_context* context)
+ : context_(context)
{ }
// Add notes to the function's type about the escape information of its
// input parameters.
void
tag(Named_object* fn);
+
+ private:
+ Escape_context* context_;
};
void
@@ -3379,9 +3385,9 @@ Escape_analysis_tag::tag(Named_object* f
// retain analysis results across imports.
void
-Gogo::tag_function(Named_object* fn)
+Gogo::tag_function(Escape_context* context, Named_object* fn)
{
- Escape_analysis_tag eat;
+ Escape_analysis_tag eat(context);
eat.tag(fn);
}
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc (revision 265293)
+++ gcc/go/gofrontend/expressions.cc (working copy)
@@ -10108,7 +10108,7 @@ Call_expression::do_type()
else if (results->size() == 1)
ret = results->begin()->type();
else
- ret = Type::make_call_multiple_result_type();
+ ret = Type::make_call_multiple_result_type(this);
this->type_ = ret;
Index: gcc/go/gofrontend/gogo.h
===================================================================
--- gcc/go/gofrontend/gogo.h (revision 265287)
+++ gcc/go/gofrontend/gogo.h (working copy)
@@ -680,7 +680,7 @@ class Gogo
// Add notes about the escape level of a function's input and output
// parameters for exporting and importing top level functions.
void
- tag_function(Named_object*);
+ tag_function(Escape_context*, Named_object*);
// Reclaim memory of escape analysis Nodes.
void
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc (revision 265293)
+++ gcc/go/gofrontend/types.cc (working copy)
@@ -5441,8 +5441,9 @@ Type::make_nil_type()
class Call_multiple_result_type : public Type
{
public:
- Call_multiple_result_type()
- : Type(TYPE_CALL_MULTIPLE_RESULT)
+ Call_multiple_result_type(Call_expression* call)
+ : Type(TYPE_CALL_MULTIPLE_RESULT),
+ call_(call)
{ }
protected:
@@ -5475,14 +5476,18 @@ class Call_multiple_result_type : public
void
do_mangled_name(Gogo*, std::string*) const
{ go_assert(saw_errors()); }
+
+ private:
+ // The expression being called.
+ Call_expression* call_;
};
// Make a call result type.
Type*
-Type::make_call_multiple_result_type()
+Type::make_call_multiple_result_type(Call_expression* call)
{
- return new Call_multiple_result_type();
+ return new Call_multiple_result_type(call);
}
// Class Struct_field.
Index: gcc/go/gofrontend/types.h
===================================================================
--- gcc/go/gofrontend/types.h (revision 265293)
+++ gcc/go/gofrontend/types.h (working copy)
@@ -511,7 +511,7 @@ class Type
make_nil_type();
static Type*
- make_call_multiple_result_type();
+ make_call_multiple_result_type(Call_expression*);
static Struct_type*
make_struct_type(Struct_field_list* fields, Location);
Index: gcc/go/gofrontend/wb.cc
===================================================================
--- gcc/go/gofrontend/wb.cc (revision 265293)
+++ gcc/go/gofrontend/wb.cc (working copy)
@@ -189,8 +189,9 @@ Mark_address_taken::expression(Expressio
class Check_escape : public Traverse
{
public:
- Check_escape()
- : Traverse(traverse_expressions | traverse_variables)
+ Check_escape(Gogo* gogo)
+ : Traverse(traverse_expressions | traverse_variables),
+ gogo_(gogo)
{ }
int
@@ -198,6 +199,9 @@ class Check_escape : public Traverse
int
variable(Named_object*);
+
+ private:
+ Gogo* gogo_;
};
int
@@ -617,7 +621,7 @@ Gogo::add_write_barriers()
{
this->propagate_writebarrierrec();
- Check_escape chk;
+ Check_escape chk(this);
this->traverse(&chk);
}
next prev parent reply other threads:[~2018-10-18 23:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 7:37 [PATCH 0/4] Clean-up warnings spotted by Rtags marxin
2018-09-24 7:37 ` [PATCH 1/4] Add filter-rtags-warnings.py script marxin
2018-09-24 14:45 ` Jeff Law
2018-09-24 7:37 ` [PATCH 3/4] Fix small coding style issues (PR fortran/87394) marxin
2018-09-24 14:39 ` Jeff Law
2018-09-24 7:37 ` [PATCH 4/4] Fix scaling of a sreal number marxin
2018-09-24 14:42 ` Jeff Law
2018-09-24 7:39 ` [PATCH 2/4] Remove unused functions and fields marxin
2018-09-24 14:42 ` Jeff Law
2018-09-25 7:18 ` Martin Liška
2018-09-25 12:31 ` Richard Biener
2018-09-25 13:40 ` Jeff Law
2018-09-26 9:01 ` Martin Liška
2018-09-27 11:18 ` Bernhard Reutner-Fischer
2018-10-03 16:46 ` Jeff Law
2018-10-03 19:35 ` Bernhard Reutner-Fischer
2018-10-05 2:19 ` Bernhard Reutner-Fischer
2018-10-05 13:41 ` Martin Liška
2018-10-09 8:52 ` [PATCH] Remove dead functions and fix VMS target by moving back some functions Martin Liška
2018-10-09 22:53 ` Martin Jambor
2018-10-10 11:13 ` Martin Liška
2018-10-10 11:17 ` Martin Jambor
2018-10-18 23:55 ` Ian Lance Taylor [this message]
2018-10-22 13:05 ` [PATCH 2/4] Remove unused functions and fields Martin Liška
2018-10-22 17:50 ` Ian Lance Taylor
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=CAKOQZ8zDq9tQC8Ynq_qmRt3DNCTb0bbUSxoXmyZ22VJq3SKpkQ@mail.gmail.com \
--to=iant@golang.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/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: link
Be 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).