diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-06 23:34:00 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-06 23:34:00 +0000 |
commit | 93cbebde76ac7de2d69b223d99acb39e0370687f (patch) | |
tree | 66c133d573a219583b5c460b329b900c18ee0ac6 /gcc/go/gofrontend/export.h | |
parent | 5e664ed0938357392823d2a43be8a196526dd97c (diff) | |
download | gcc-93cbebde76ac7de2d69b223d99acb39e0370687f.zip gcc-93cbebde76ac7de2d69b223d99acb39e0370687f.tar.gz gcc-93cbebde76ac7de2d69b223d99acb39e0370687f.tar.bz2 |
compiler: permit inlining temporary statements and references
This increases the number of inlinable functions from 439 to 455.
An example is math/bits.Mul32, which uses temporaries to handle the
tuple assignment.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/180837
From-SVN: r272022
Diffstat (limited to 'gcc/go/gofrontend/export.h')
-rw-r--r-- | gcc/go/gofrontend/export.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/export.h b/gcc/go/gofrontend/export.h index e3932d4..92d0180 100644 --- a/gcc/go/gofrontend/export.h +++ b/gcc/go/gofrontend/export.h @@ -20,6 +20,7 @@ class Type; class Package; class Import_init_set; class Backend; +class Temporary_statement; // Codes used for the builtin types. These are all negative to make // them easily distinct from the codes assigned by Export::write_type. @@ -307,7 +308,8 @@ class Export_function_body : public String_dump { public: Export_function_body(Export* exp, int indent) - : exp_(exp), type_context_(NULL), indent_(indent) + : exp_(exp), body_(), type_context_(NULL), next_temporary_index_(0), + temporary_indexes_(), indent_(indent) { } // Write a character to the body. @@ -363,6 +365,14 @@ class Export_function_body : public String_dump package_index(const Package* p) const { return this->exp_->package_index(p); } + // Record a temporary statement and return its index. + unsigned int + record_temporary(const Temporary_statement*); + + // Return the index of a temporary statement. + unsigned int + temporary_index(const Temporary_statement*); + // Return a reference to the completed body. const std::string& body() const @@ -375,6 +385,10 @@ class Export_function_body : public String_dump std::string body_; // Current type context. Used to avoid duplicate type conversions. Type* type_context_; + // Index to give to next temporary statement. + unsigned int next_temporary_index_; + // Map temporary statements to indexes. + Unordered_map(const Temporary_statement*, unsigned int) temporary_indexes_; // Current indentation level: the number of spaces before each statement. int indent_; }; |