mewmew/uc

all: fix build and update to latest version llir/llvm

Closed this issue · 1 comments

In preparation for the v0.3.0 release of llir/llvm, we should update uc to make use of the latest llir/llvm API.

The build of uc currently fails with the following compile time error:

# github.com/mewmew/uc/irgen
irgen/irgen.go:40:3: m.AppendFunction undefined (type *Module has no field or method AppendFunction)
irgen/irgen.go:65:31: sig.Ret undefined (type *"github.com/llir/llvm/ir/types".FuncType has no field or method Ret)
irgen/irgen.go:65:40: cannot use sig.Params (type []"github.com/llir/llvm/ir/types".Type) as type []*ir.Param in argument to ir.NewFunction
irgen/irgen.go:79:24: invalid operation: f.Function.Name == "main" (mismatched types func() string and string)
irgen/irgen.go:87:19: f.Function.Sig.Ret undefined (type *"github.com/llir/llvm/ir/types".FuncType has no field or method Ret)
irgen/irgen.go:94:26: f.Function.Sig.Ret undefined (type *"github.com/llir/llvm/ir/types".FuncType has no field or method Ret)
irgen/irgen.go:95:9: undefined: "github.com/llir/llvm/ir/types".IsVoid
irgen/lower.go:130:48: undefined: "github.com/llir/llvm/ir/types".Param
irgen/lower.go:158:7: undefined: "github.com/llir/llvm/ir/types".IsInt
irgen/lower.go:159:25: cannot use 0 (type int) as type *"github.com/llir/llvm/ir/types".IntType in argument to constant.NewInt
irgen/lower.go:159:25: too many errors

From 69873ed:

Note, constant.NewGetElementPtr and ir.NewGetElementPtr
currently requires an elemType parameter. The llir/llvm
library will be update to remove this requirement, as
elemType may be inferred from the src and indices
parameters.

Edit: as of rev llir/llvm@d4f4797 llir/llvm has been updated to remove the elemType parameter, which is now inferred from src instead.