Commit 8a14b86b by Ian Lance Taylor

escape: Enable escape analysis in gccgo.

    
    Off by default, enabled through -fgo-optimize-allocs.
    
    Reviewed-on: https://go-review.googlesource.com/22378

From-SVN: r239109
parent 2f9436e9
3096ac81185edacbf800783f0f803d1c419dccdd 4ba387176e8a826dd5dd6cad4caa2f93434d0b14
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "statements.h" #include "statements.h"
#include "escape.h" #include "escape.h"
#include "ast-dump.h" #include "ast-dump.h"
#include "go-optimize.h"
// class Node. // class Node.
...@@ -678,11 +679,19 @@ Escape_note::parse_tag(std::string* tag) ...@@ -678,11 +679,19 @@ Escape_note::parse_tag(std::string* tag)
return encoding; return encoding;
} }
// The -fgo-optimize-alloc flag activates this escape analysis.
Go_optimize optimize_allocation_flag("allocs");
// Analyze the program flow for escape information. // Analyze the program flow for escape information.
void void
Gogo::analyze_escape() Gogo::analyze_escape()
{ {
if (!optimize_allocation_flag.is_enabled() || saw_errors())
return;
// Discover strongly connected groups of functions to analyze for escape // Discover strongly connected groups of functions to analyze for escape
// information in this package. // information in this package.
this->discover_analysis_sets(); this->discover_analysis_sets();
......
...@@ -112,6 +112,8 @@ go_parse_input_files(const char** filenames, unsigned int filename_count, ...@@ -112,6 +112,8 @@ go_parse_input_files(const char** filenames, unsigned int filename_count,
if (only_check_syntax) if (only_check_syntax)
return; return;
::gogo->analyze_escape();
// Export global identifiers as appropriate. // Export global identifiers as appropriate.
::gogo->do_exports(); ::gogo->do_exports();
......
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