aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/symbol.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-05-19 15:24:28 +0200
committerRon Evans <[email protected]>2023-05-20 11:24:20 +0200
commit6dba16f28e4a5fb0f0d856309acb3c4ecfbaf3c5 (patch)
treecb27ca1969a2d865f8570e6306ae6838629ff06e /compiler/symbol.go
parentb336a1561f6be666e093a6e3b93e1f9590e6cdd2 (diff)
downloadtinygo-6dba16f28e4a5fb0f0d856309acb3c4ecfbaf3c5.tar.gz
tinygo-6dba16f28e4a5fb0f0d856309acb3c4ecfbaf3c5.zip
compiler: only calculate functionInfo once
This is a small change that's not really important in itself, but it avoids duplicate errors in a future commit that adds error messages to //go:wasmimport.
Diffstat (limited to 'compiler/symbol.go')
-rw-r--r--compiler/symbol.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/symbol.go b/compiler/symbol.go
index de7838173..7d9fcc2ff 100644
--- a/compiler/symbol.go
+++ b/compiler/symbol.go
@@ -239,12 +239,16 @@ func (c *compilerContext) getFunction(fn *ssa.Function) (llvm.Type, llvm.Value)
// present in *ssa.Function, such as the link name and whether it should be
// exported.
func (c *compilerContext) getFunctionInfo(f *ssa.Function) functionInfo {
+ if info, ok := c.functionInfos[f]; ok {
+ return info
+ }
info := functionInfo{
// Pick the default linkName.
linkName: f.RelString(nil),
}
// Check for //go: pragmas, which may change the link name (among others).
info.parsePragmas(f)
+ c.functionInfos[f] = info
return info
}