diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-05 21:05:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-05 21:05:38 +0000 |
commit | 5a9422664e8646313278d50666e2e4c8427cd5df (patch) | |
tree | d2b034aeb5116f43b6724b61e017131a3bc64a9c /libgo/go | |
parent | 388aa75412ffd1d4cd10dd53d012fdcc1ed47f67 (diff) | |
download | gcc-5a9422664e8646313278d50666e2e4c8427cd5df.zip gcc-5a9422664e8646313278d50666e2e4c8427cd5df.tar.gz gcc-5a9422664e8646313278d50666e2e4c8427cd5df.tar.bz2 |
compiler: inline call expressions and function references
Scan inlinable methods for references to global variables and
functions (forgot to do that earlier).
Track all packages mentioned by exports (that should have been done
earlier too).
Record assembler name in export data, so that we can inline calls to
non-Go functions. Modify gccgoimporter code to skip assembler name.
This increases the number of inlinable functions in the standard
library from 215 to 439.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/180677
From-SVN: r271976
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/go/internal/gccgoimporter/parser.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libgo/go/go/internal/gccgoimporter/parser.go b/libgo/go/go/internal/gccgoimporter/parser.go index 42f43a1..956a9a8 100644 --- a/libgo/go/go/internal/gccgoimporter/parser.go +++ b/libgo/go/go/internal/gccgoimporter/parser.go @@ -539,10 +539,12 @@ func (p *parser) parseNamedType(nlist []int) types.Type { for p.tok == scanner.Ident { p.expectKeyword("func") if p.tok == '/' { - // Skip a /*nointerface*/ comment. + // Skip a /*nointerface*/ or /*asm ID */ comment. p.expect('/') p.expect('*') - p.expect(scanner.Ident) + if p.expect(scanner.Ident) == "asm" { + p.parseUnquotedString() + } p.expect('*') p.expect('/') } @@ -727,6 +729,17 @@ func (p *parser) parseFunctionType(pkg *types.Package, nlist []int) *types.Signa // Func = Name FunctionType [InlineBody] . func (p *parser) parseFunc(pkg *types.Package) *types.Func { + if p.tok == '/' { + // Skip an /*asm ID */ comment. + p.expect('/') + p.expect('*') + if p.expect(scanner.Ident) == "asm" { + p.parseUnquotedString() + } + p.expect('*') + p.expect('/') + } + name := p.parseName() if strings.ContainsRune(name, '$') { // This is a Type$equal or Type$hash function, which we don't want to parse, |