aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/expressions.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-11-26 21:44:20 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-11-26 21:44:20 +0000
commit1e4cc1d4b097f346b4cda611782fe83eda0df18f (patch)
tree2d4e3368b005eaf1e957c8b3437f6e03d7026f42 /gcc/go/gofrontend/expressions.h
parent50e99db39196a0567e844f35ce1cd0f36d066b8f (diff)
downloadgcc-1e4cc1d4b097f346b4cda611782fe83eda0df18f.zip
gcc-1e4cc1d4b097f346b4cda611782fe83eda0df18f.tar.gz
gcc-1e4cc1d4b097f346b4cda611782fe83eda0df18f.tar.bz2
compiler: initial support for exporting function bodies
Create a framework for putting function bodies in export data. At present only empty functions will be put there, and they will be ignored on import. Later patches will get this to the point of supporting inlining of (some) functions defined in other packages. Reviewed-on: https://go-review.googlesource.com/c/150061 From-SVN: r266490
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r--gcc/go/gofrontend/expressions.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index f53cc6e..33ea9b2 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -939,6 +939,11 @@ class Expression
copy()
{ return this->do_copy(); }
+ // Return the cost of this statement for inlining purposes.
+ int
+ inlining_cost()
+ { return this->do_inlining_cost(); }
+
// Return whether the expression is addressable--something which may
// be used as the operand of the unary & operator.
bool
@@ -1084,6 +1089,13 @@ class Expression
virtual Expression*
do_copy() = 0;
+ // Child class implements determining the cost of this statement for
+ // inlining. The default cost is high, so we only need to define
+ // this method for expressions that can be inlined.
+ virtual int
+ do_inlining_cost()
+ { return 0x100000; }
+
// Child class implements whether the expression is addressable.
virtual bool
do_is_addressable() const