Commit 8cc43cb4 by Ian Lance Taylor

Revert SVN revision 264561, incorrectly committed directly to the GCC

repo rather than to the master repo.

From-SVN: r265294
parent 0799a08b
...@@ -979,7 +979,7 @@ Gogo::analyze_escape() ...@@ -979,7 +979,7 @@ Gogo::analyze_escape()
for (std::vector<Named_object*>::iterator fn = stack.begin(); for (std::vector<Named_object*>::iterator fn = stack.begin();
fn != stack.end(); fn != stack.end();
++fn) ++fn)
this->tag_function(*fn); this->tag_function(context, *fn);
if (this->debug_escape_level() != 0) if (this->debug_escape_level() != 0)
{ {
...@@ -1232,10 +1232,10 @@ Escape_analysis_loop::statement(Block*, size_t*, Statement* s) ...@@ -1232,10 +1232,10 @@ Escape_analysis_loop::statement(Block*, size_t*, Statement* s)
class Escape_analysis_assign : public Traverse class Escape_analysis_assign : public Traverse
{ {
public: public:
Escape_analysis_assign(Escape_context* context) Escape_analysis_assign(Escape_context* context, Named_object* fn)
: Traverse(traverse_statements : Traverse(traverse_statements
| traverse_expressions), | traverse_expressions),
context_(context) context_(context), fn_(fn)
{ } { }
// Model statements within a function as assignments and flows between nodes. // Model statements within a function as assignments and flows between nodes.
...@@ -1272,6 +1272,8 @@ public: ...@@ -1272,6 +1272,8 @@ public:
private: private:
// The escape context for this set of functions. // The escape context for this set of functions.
Escape_context* context_; Escape_context* context_;
// The current function being analyzed.
Named_object* fn_;
}; };
// Helper function to detect self assignment like the following. // Helper function to detect self assignment like the following.
...@@ -2702,7 +2704,7 @@ Gogo::assign_connectivity(Escape_context* context, Named_object* fn) ...@@ -2702,7 +2704,7 @@ Gogo::assign_connectivity(Escape_context* context, Named_object* fn)
int save_depth = context->loop_depth(); int save_depth = context->loop_depth();
context->set_loop_depth(1); context->set_loop_depth(1);
Escape_analysis_assign ea(context); Escape_analysis_assign ea(context, fn);
Function::Results* res = fn->func_value()->result_variables(); Function::Results* res = fn->func_value()->result_variables();
if (res != NULL) if (res != NULL)
{ {
...@@ -3265,13 +3267,17 @@ Gogo::propagate_escape(Escape_context* context, Node* dst) ...@@ -3265,13 +3267,17 @@ Gogo::propagate_escape(Escape_context* context, Node* dst)
class Escape_analysis_tag class Escape_analysis_tag
{ {
public: 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 // Add notes to the function's type about the escape information of its
// input parameters. // input parameters.
void void
tag(Named_object* fn); tag(Named_object* fn);
private:
Escape_context* context_;
}; };
void void
...@@ -3379,9 +3385,9 @@ Escape_analysis_tag::tag(Named_object* fn) ...@@ -3379,9 +3385,9 @@ Escape_analysis_tag::tag(Named_object* fn)
// retain analysis results across imports. // retain analysis results across imports.
void 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); eat.tag(fn);
} }
......
...@@ -10108,7 +10108,7 @@ Call_expression::do_type() ...@@ -10108,7 +10108,7 @@ Call_expression::do_type()
else if (results->size() == 1) else if (results->size() == 1)
ret = results->begin()->type(); ret = results->begin()->type();
else else
ret = Type::make_call_multiple_result_type(); ret = Type::make_call_multiple_result_type(this);
this->type_ = ret; this->type_ = ret;
......
...@@ -680,7 +680,7 @@ class Gogo ...@@ -680,7 +680,7 @@ class Gogo
// Add notes about the escape level of a function's input and output // Add notes about the escape level of a function's input and output
// parameters for exporting and importing top level functions. // parameters for exporting and importing top level functions.
void void
tag_function(Named_object*); tag_function(Escape_context*, Named_object*);
// Reclaim memory of escape analysis Nodes. // Reclaim memory of escape analysis Nodes.
void void
......
...@@ -5441,8 +5441,9 @@ Type::make_nil_type() ...@@ -5441,8 +5441,9 @@ Type::make_nil_type()
class Call_multiple_result_type : public Type class Call_multiple_result_type : public Type
{ {
public: public:
Call_multiple_result_type() Call_multiple_result_type(Call_expression* call)
: Type(TYPE_CALL_MULTIPLE_RESULT) : Type(TYPE_CALL_MULTIPLE_RESULT),
call_(call)
{ } { }
protected: protected:
...@@ -5475,14 +5476,18 @@ class Call_multiple_result_type : public Type ...@@ -5475,14 +5476,18 @@ class Call_multiple_result_type : public Type
void void
do_mangled_name(Gogo*, std::string*) const do_mangled_name(Gogo*, std::string*) const
{ go_assert(saw_errors()); } { go_assert(saw_errors()); }
private:
// The expression being called.
Call_expression* call_;
}; };
// Make a call result type. // Make a call result type.
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. // Class Struct_field.
......
...@@ -511,7 +511,7 @@ class Type ...@@ -511,7 +511,7 @@ class Type
make_nil_type(); make_nil_type();
static Type* static Type*
make_call_multiple_result_type(); make_call_multiple_result_type(Call_expression*);
static Struct_type* static Struct_type*
make_struct_type(Struct_field_list* fields, Location); make_struct_type(Struct_field_list* fields, Location);
......
...@@ -189,8 +189,9 @@ Mark_address_taken::expression(Expression** pexpr) ...@@ -189,8 +189,9 @@ Mark_address_taken::expression(Expression** pexpr)
class Check_escape : public Traverse class Check_escape : public Traverse
{ {
public: public:
Check_escape() Check_escape(Gogo* gogo)
: Traverse(traverse_expressions | traverse_variables) : Traverse(traverse_expressions | traverse_variables),
gogo_(gogo)
{ } { }
int int
...@@ -198,6 +199,9 @@ class Check_escape : public Traverse ...@@ -198,6 +199,9 @@ class Check_escape : public Traverse
int int
variable(Named_object*); variable(Named_object*);
private:
Gogo* gogo_;
}; };
int int
...@@ -617,7 +621,7 @@ Gogo::add_write_barriers() ...@@ -617,7 +621,7 @@ Gogo::add_write_barriers()
{ {
this->propagate_writebarrierrec(); this->propagate_writebarrierrec();
Check_escape chk; Check_escape chk(this);
this->traverse(&chk); this->traverse(&chk);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment