diff --git a/cl/compile.go b/cl/compile.go index 26f55ebd..907e1d5c 100644 --- a/cl/compile.go +++ b/cl/compile.go @@ -523,6 +523,12 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue nReserve = p.compileValue(b, v.Reserve) } ret = b.MakeMap(p.prog.Type(t), nReserve) + /* + case *ssa.MakeClosure: + fn := p.compileValue(b, v.Fn) + bindings := p.compileValues(b, v.Bindings, 0) + ret = b.MakeClosure(fn, bindings) + */ case *ssa.TypeAssert: x := p.compileValue(b, v.X) ret = b.TypeAssert(x, p.prog.Type(v.AssertedType), v.CommaOk) diff --git a/ssa/expr.go b/ssa/expr.go index e3d92b3d..2948d5fd 100644 --- a/ssa/expr.go +++ b/ssa/expr.go @@ -484,7 +484,7 @@ func (b Builder) Store(ptr, val Expr) Builder { // aggregateValue yields the value of the aggregate X with the fields func (b Builder) aggregateValue(t Type, flds ...llvm.Value) Expr { if debugInstr { - log.Printf("AggregateValue %v, %v\n", t, flds) + log.Printf("AggregateValue %v, %v\n", t.t, flds) } impl := b.impl tll := t.ll @@ -495,6 +495,24 @@ func (b Builder) aggregateValue(t Type, flds ...llvm.Value) Expr { return Expr{llvm.CreateLoad(b.impl, tll, ptr), t} } +/* +// The MakeClosure instruction yields a closure value whose code is +// Fn and whose free variables' values are supplied by Bindings. +// +// Type() returns a (possibly named) *types.Signature. +// +// Example printed form: +// +// t0 = make closure anon@1.2 [x y z] +// t1 = make closure bound$(main.I).add [i] +func (b Builder) MakeClosure(fn Expr, bindings []Expr) Expr { + if debugInstr { + log.Printf("MakeClosure %v, %v\n", fn, bindings) + } + panic("todo") +} +*/ + // The FieldAddr instruction yields the address of Field of *struct X. // // The field is identified by its index within the field list of the