aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/export.h
diff options
context:
space:
mode:
authorChris Manghane <cmang@google.com>2015-04-17 17:10:12 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-04-17 17:10:12 +0000
commitb496063dcd8bf5041e101de4532297803fa997b2 (patch)
treed1dced696fcc3d7e6802d825c7ddf09b50b62bda /gcc/go/gofrontend/export.h
parentc10b5ea0d8b2b268fcb16ae9768dea61c7271735 (diff)
downloadgcc-b496063dcd8bf5041e101de4532297803fa997b2.zip
gcc-b496063dcd8bf5041e101de4532297803fa997b2.tar.gz
gcc-b496063dcd8bf5041e101de4532297803fa997b2.tar.bz2
compiler: Escape analysis.
By Chris Manghane. Comprises three changes to gofrontend repository: compiler: Add escape information to export data. compiler: Stack-allocate non-escaping variables. This change allows variables initialized through make or new to be allocated on the stack via a temporary variable if they do not escape their function. It also improves the analysis to consider situations where variables escape in the standard library and go testsuite such as: *nested composite literals and composite literal arguments *method receivers always escaping *escape via statements in closures referring to enclosing variables *escape via calls with multiple return results compiler: Basic escape analysis for the go frontend. This is an implementation of the algorithm described in "Escape Analysis in Java" by Choi et. al. It relies on dataflow information to discover variable references to one another. Handles assignments to closures and association between closures variables and the variables of the enclosing scope. Dataflow analysis does not discover references through range statements e.g. for _, v := range a will not recognize that all values of v are references to a. * Make-lang.in (GO_OBJS): Add go/escape.o. From-SVN: r222188
Diffstat (limited to 'gcc/go/gofrontend/export.h')
-rw-r--r--gcc/go/gofrontend/export.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/export.h b/gcc/go/gofrontend/export.h
index 0526e9a..92baa72 100644
--- a/gcc/go/gofrontend/export.h
+++ b/gcc/go/gofrontend/export.h
@@ -7,6 +7,7 @@
#ifndef GO_EXPORT_H
#define GO_EXPORT_H
+#include "escape.h"
#include "string-dump.h"
struct sha1_ctx;
@@ -161,6 +162,10 @@ class Export : public String_dump
void
write_type(const Type*);
+ // Write out escape information.
+ void
+ write_escape(const Node::Escapement_lattice& e);
+
private:
Export(const Export&);
Export& operator=(const Export&);