llvmValues
This commit is contained in:
18
ssa/expr.go
18
ssa/expr.go
@@ -366,16 +366,18 @@ func checkExpr(v Expr, t types.Type, b Builder) Expr {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func llvmValues(vals []Expr, params *types.Tuple, b Builder) []llvm.Value {
|
func llvmValues(vals []Expr, params *types.Tuple, b Builder) (ret []llvm.Value) {
|
||||||
n := params.Len()
|
n := params.Len()
|
||||||
ret := make([]llvm.Value, len(vals))
|
if n > 0 {
|
||||||
for i, v := range vals {
|
ret = make([]llvm.Value, len(vals))
|
||||||
if i < n {
|
for i, v := range vals {
|
||||||
v = checkExpr(v, params.At(i).Type(), b)
|
if i < n {
|
||||||
|
v = checkExpr(v, params.At(i).Type(), b)
|
||||||
|
}
|
||||||
|
ret[i] = v.impl
|
||||||
}
|
}
|
||||||
ret[i] = v.impl
|
|
||||||
}
|
}
|
||||||
return ret
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func llvmDelayValues(f func(i int) Expr, n int) []llvm.Value {
|
func llvmDelayValues(f func(i int) Expr, n int) []llvm.Value {
|
||||||
@@ -590,7 +592,7 @@ func (b Builder) Index(x, idx Expr, addr func(Expr) Expr) Expr {
|
|||||||
var ptr Expr
|
var ptr Expr
|
||||||
switch t := x.raw.Type.Underlying().(type) {
|
switch t := x.raw.Type.Underlying().(type) {
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
if t.Info()&types.IsString == 0 {
|
if t.Kind() != types.String {
|
||||||
panic(fmt.Errorf("invalid operation: cannot index %v", t))
|
panic(fmt.Errorf("invalid operation: cannot index %v", t))
|
||||||
}
|
}
|
||||||
telem = prog.rawType(types.Typ[types.Byte])
|
telem = prog.rawType(types.Typ[types.Byte])
|
||||||
|
|||||||
Reference in New Issue
Block a user