From d8cc48b09b6d22d0a145ffaa04879f2b07c69a43 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 18 Jan 2021 18:53:07 +0100 Subject: 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. --- compiler/func.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/func.go') 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 } -- cgit v1.2.3