newParams
This commit is contained in:
15
ssa/decl.go
15
ssa/decl.go
@@ -107,17 +107,15 @@ type aFunction struct {
|
|||||||
prog Program
|
prog Program
|
||||||
|
|
||||||
params []Type
|
params []Type
|
||||||
ret Type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Function = *aFunction
|
type Function = *aFunction
|
||||||
|
|
||||||
func newFunction(fn llvm.Value, t Type, prog Program) Function {
|
func newFunction(fn llvm.Value, t Type, prog Program) Function {
|
||||||
params, ret := newParamsAndRet(t, prog)
|
return &aFunction{Expr{fn, t}, prog, newParams(t, prog)}
|
||||||
return &aFunction{Expr{fn, t}, prog, params, ret}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newParamsAndRet(fn Type, prog Program) (params []Type, ret Type) {
|
func newParams(fn Type, prog Program) (params []Type) {
|
||||||
sig := fn.t.(*types.Signature)
|
sig := fn.t.(*types.Signature)
|
||||||
in := sig.Params()
|
in := sig.Params()
|
||||||
if n := in.Len(); n > 0 {
|
if n := in.Len(); n > 0 {
|
||||||
@@ -126,15 +124,6 @@ func newParamsAndRet(fn Type, prog Program) (params []Type, ret Type) {
|
|||||||
params[i] = prog.llvmType(in.At(i).Type())
|
params[i] = prog.llvmType(in.At(i).Type())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out := sig.Results()
|
|
||||||
switch n := out.Len(); n {
|
|
||||||
case 0:
|
|
||||||
ret = prog.Void()
|
|
||||||
case 1:
|
|
||||||
ret = prog.llvmType(out.At(0).Type())
|
|
||||||
default:
|
|
||||||
ret = &aType{prog.toLLVMTuple(out), out, vkTuple}
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user