diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-10 21:02:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-10 21:02:20 +0000 |
commit | fc917b42658000f0c4dc87f6602336eef899fadf (patch) | |
tree | a86e9441caa7fe457bf8274f297f2267ad7a5f0a /gcc/go/gofrontend/export.h | |
parent | d480455f2ddc3b89d8547969be9cda939c41da56 (diff) | |
download | gcc-fc917b42658000f0c4dc87f6602336eef899fadf.zip gcc-fc917b42658000f0c4dc87f6602336eef899fadf.tar.gz gcc-fc917b42658000f0c4dc87f6602336eef899fadf.tar.bz2 |
compiler: permit inlining functions with labels and goto statements
This permits inlining functions with for loops and some switches, as
they are lowered to if and goto statements before exporting them.
This by itself only adds three new inlinable functions in the standard
library: sort.Search, context.(*emptyCtx).String, and
cmd/go/internal/work.(*Builder).disableBuildID.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/181197
From-SVN: r272131
Diffstat (limited to 'gcc/go/gofrontend/export.h')
-rw-r--r-- | gcc/go/gofrontend/export.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/export.h b/gcc/go/gofrontend/export.h index 92d0180..910b1db 100644 --- a/gcc/go/gofrontend/export.h +++ b/gcc/go/gofrontend/export.h @@ -21,6 +21,7 @@ class Package; class Import_init_set; class Backend; class Temporary_statement; +class Unnamed_label; // Codes used for the builtin types. These are all negative to make // them easily distinct from the codes assigned by Export::write_type. @@ -309,7 +310,8 @@ class Export_function_body : public String_dump public: Export_function_body(Export* exp, int indent) : exp_(exp), body_(), type_context_(NULL), next_temporary_index_(0), - temporary_indexes_(), indent_(indent) + temporary_indexes_(), next_label_index_(0), label_indexes_(), + indent_(indent) { } // Write a character to the body. @@ -373,6 +375,11 @@ class Export_function_body : public String_dump unsigned int temporary_index(const Temporary_statement*); + // Return the index of an unnamed label. If it doesn't already have + // an index, give it one. + unsigned int + unnamed_label_index(const Unnamed_label*); + // Return a reference to the completed body. const std::string& body() const @@ -389,6 +396,10 @@ class Export_function_body : public String_dump unsigned int next_temporary_index_; // Map temporary statements to indexes. Unordered_map(const Temporary_statement*, unsigned int) temporary_indexes_; + // Index to give to the next unnamed label. + unsigned int next_label_index_; + // Map unnamed labels to indexes. + Unordered_map(const Unnamed_label*, unsigned int) label_indexes_; // Current indentation level: the number of spaces before each statement. int indent_; }; |