aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/statements.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-11-28 18:08:21 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-11-28 18:08:21 +0000
commit5456f30d92062d234208cd8634e54787f6e2664f (patch)
tree023b9e1979b33d40c37b642607932fe34787f69a /gcc/go/gofrontend/statements.h
parent85041a5b7755dc7b9d74b183e933d89152997886 (diff)
downloadgcc-5456f30d92062d234208cd8634e54787f6e2664f.zip
gcc-5456f30d92062d234208cd8634e54787f6e2664f.tar.gz
gcc-5456f30d92062d234208cd8634e54787f6e2664f.tar.bz2
compiler: inline functions with assignments and return statements
Support inlining functions that contain only assignments and return statements, with expressions of either constants or parameters. Functions that contain other kinds of statements or expressions are not yet inlined. With this change, about 100 functions in the standard library are inlinable. Reviewed-on: https://go-review.googlesource.com/c/150073 From-SVN: r266573
Diffstat (limited to 'gcc/go/gofrontend/statements.h')
-rw-r--r--gcc/go/gofrontend/statements.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index 3b5c68a..621d301 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -631,6 +631,13 @@ class Assignment_statement : public Statement
void
do_check_types(Gogo*);
+ int
+ do_inlining_cost()
+ { return 1; }
+
+ void
+ do_export_statement(Export_function_body*);
+
Statement*
do_flatten(Gogo*, Named_object*, Block*, Statement_inserter*);
@@ -792,6 +799,13 @@ class Return_statement : public Statement
do_may_fall_through() const
{ return false; }
+ int
+ do_inlining_cost()
+ { return 1; }
+
+ void
+ do_export_statement(Export_function_body*);
+
Bstatement*
do_get_backend(Translate_context*);