summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-04 00:10:35 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-08-04 00:10:35 +0000
commit3a7ea224db09c1a0a7e25c6762f40189a331e819 (patch)
tree768c2443a0cfaad5a295f4c64a5ccd42bd2aecc7 /gcc/go
parent84c4c3c0c1328b8d55d16b9e9e1b0c6a65d13a82 (diff)
downloadgcc-3a7ea224db09c1a0a7e25c6762f40189a331e819.tar.gz
escape: Enable escape analysis in gccgo.
Off by default, enabled through -fgo-optimize-allocs. Reviewed-on: https://go-review.googlesource.com/22378 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239109 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/escape.cc9
-rw-r--r--gcc/go/gofrontend/go.cc2
3 files changed, 12 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 58066bd6d31..ba99743f8d2 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-3096ac81185edacbf800783f0f803d1c419dccdd
+4ba387176e8a826dd5dd6cad4caa2f93434d0b14
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/escape.cc b/gcc/go/gofrontend/escape.cc
index 6814c7ea74d..dfe6eb230fc 100644
--- a/gcc/go/gofrontend/escape.cc
+++ b/gcc/go/gofrontend/escape.cc
@@ -14,6 +14,7 @@
#include "statements.h"
#include "escape.h"
#include "ast-dump.h"
+#include "go-optimize.h"
// class Node.
@@ -678,11 +679,19 @@ Escape_note::parse_tag(std::string* tag)
return encoding;
}
+
+// The -fgo-optimize-alloc flag activates this escape analysis.
+
+Go_optimize optimize_allocation_flag("allocs");
+
// Analyze the program flow for escape information.
void
Gogo::analyze_escape()
{
+ if (!optimize_allocation_flag.is_enabled() || saw_errors())
+ return;
+
// Discover strongly connected groups of functions to analyze for escape
// information in this package.
this->discover_analysis_sets();
diff --git a/gcc/go/gofrontend/go.cc b/gcc/go/gofrontend/go.cc
index a0c74228158..a0df2b801bd 100644
--- a/gcc/go/gofrontend/go.cc
+++ b/gcc/go/gofrontend/go.cc
@@ -112,6 +112,8 @@ go_parse_input_files(const char** filenames, unsigned int filename_count,
if (only_check_syntax)
return;
+ ::gogo->analyze_escape();
+
// Export global identifiers as appropriate.
::gogo->do_exports();