aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/func.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-01-18 18:53:07 +0100
committerAyke <[email protected]>2021-01-24 15:39:15 +0100
commitd8cc48b09b6d22d0a145ffaa04879f2b07c69a43 (patch)
tree58b580f5a6a5b6a0dc4e6291e84c25dd1e8e2e76 /compiler/func.go
parent9bd36597d67f76230033adab4c3481536a755f71 (diff)
downloadtinygo-d8cc48b09b6d22d0a145ffaa04879f2b07c69a43.tar.gz
tinygo-d8cc48b09b6d22d0a145ffaa04879f2b07c69a43.zip
compiler: remove ir package
This package was long making the design of the compiler more complicated than it needs to be. Previously this package implemented several optimization passes, but those passes have since moved to work directly with LLVM IR instead of Go SSA. The only remaining pass is the SimpleDCE pass. This commit removes the *ir.Function type that permeated the whole compiler and instead switches to use *ssa.Function directly. The SimpleDCE pass is kept but is far less tightly coupled to the rest of the compiler so that it can easily be removed once the switch to building and caching packages individually happens.
Diffstat (limited to 'compiler/func.go')
-rw-r--r--compiler/func.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/func.go b/compiler/func.go
index 463350aaa..7f5e4398d 100644
--- a/compiler/func.go
+++ b/compiler/func.go
@@ -149,7 +149,7 @@ func (b *builder) parseMakeClosure(expr *ssa.MakeClosure) (llvm.Value, error) {
if len(expr.Bindings) == 0 {
panic("unexpected: MakeClosure without bound variables")
}
- f := b.ir.GetFunction(expr.Fn.(*ssa.Function))
+ f := expr.Fn.(*ssa.Function)
// Collect all bound variables.
boundVars := make([]llvm.Value, len(expr.Bindings))
@@ -164,5 +164,5 @@ func (b *builder) parseMakeClosure(expr *ssa.MakeClosure) (llvm.Value, error) {
context := b.emitPointerPack(boundVars)
// Create the closure.
- return b.createFuncValue(f.LLVMFn, context, f.Signature), nil
+ return b.createFuncValue(b.getFunction(f), context, f.Signature), nil
}