From 862ec76377acf7a20009d755f45d8480868c3fc8 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 27 Nov 2018 15:51:01 +0000 Subject: compiler: import inlinable functions from package data Start reading the export data generated by the last change in this series. At this point we will inline direct calls to empty functions and methods defined in different packages. Reviewed-on: https://go-review.googlesource.com/c/150062 From-SVN: r266517 --- gcc/go/gofrontend/expressions.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/go/gofrontend/expressions.cc') diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 75fa19b..db7c981 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -9785,6 +9785,15 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, } } + // If this is a call to an imported function for which we have an + // inlinable function body, add it to the list of functions to give + // to the backend as inlining opportunities. + Func_expression* fe = this->fn_->func_expression(); + if (fe != NULL + && fe->named_object()->is_function_declaration() + && fe->named_object()->func_declaration_value()->has_imported_body()) + gogo->add_imported_inlinable_function(fe->named_object()); + return this; } -- cgit v1.1