diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-10 21:34:12 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-10 21:34:12 +0000 |
commit | e898243c23c82247ec01b32f551402ca52f32927 (patch) | |
tree | b0d9c35dc562318a0568ad5a47888711864bc4c1 /gcc/go/gofrontend/expressions.h | |
parent | 35c19de69645b18eeef7dbecfcd98b19f9948c84 (diff) | |
download | gcc-e898243c23c82247ec01b32f551402ca52f32927.zip gcc-e898243c23c82247ec01b32f551402ca52f32927.tar.gz gcc-e898243c23c82247ec01b32f551402ca52f32927.tar.bz2 |
compiler: support inlining functions that use index expressions
Also move the determine_types pass on an inlined function body to one
place, rather than doing it ad hoc as needed.
This adds 79 new inlinable functions in the standard library, such as
bytes.HasPrefix and bytes.LastIndexByte.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/181261
From-SVN: r272133
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r-- | gcc/go/gofrontend/expressions.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 22dd2fc..1595eb1 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -3089,6 +3089,13 @@ class Array_index_expression : public Expression Bexpression* do_get_backend(Translate_context*); + int + do_inlining_cost() const + { return this->end_ != NULL ? 2 : 1; } + + void + do_export(Export_function_body*) const; + void do_dump_expression(Ast_dump_context*) const; @@ -3161,6 +3168,13 @@ class String_index_expression : public Expression Bexpression* do_get_backend(Translate_context*); + int + do_inlining_cost() const + { return this->end_ != NULL ? 2 : 1; } + + void + do_export(Export_function_body*) const; + void do_dump_expression(Ast_dump_context*) const; @@ -3247,6 +3261,13 @@ class Map_index_expression : public Expression Bexpression* do_get_backend(Translate_context*); + int + do_inlining_cost() const + { return 5; } + + void + do_export(Export_function_body*) const; + void do_dump_expression(Ast_dump_context*) const; |