ssa: builtin print/println

This commit is contained in:
visualfc
2024-05-15 21:26:53 +08:00
parent 6278718a24
commit 022965b9c7
6 changed files with 507 additions and 172 deletions

View File

@@ -47,6 +47,9 @@ const (
vkPyVarRef
vkTuple
vkSlice
vkArray
vkMap
vkInterface
vkPhisExpr = -1
)
@@ -240,11 +243,11 @@ func (p Program) toType(raw types.Type) Type {
elem := p.rawType(t.Elem())
return &aType{llvm.PointerType(elem.ll, 0), typ, vkPtr}
case *types.Interface:
return &aType{p.rtIface(), typ, vkInvalid}
return &aType{p.rtIface(), typ, vkInterface}
case *types.Slice:
return &aType{p.rtSlice(), typ, vkSlice}
case *types.Map:
return &aType{p.rtMap(), typ, vkInvalid}
return &aType{p.rtMap(), typ, vkMap}
case *types.Struct:
ll, kind := p.toLLVMStruct(t)
return &aType{ll, typ, kind}
@@ -254,7 +257,7 @@ func (p Program) toType(raw types.Type) Type {
return &aType{p.toLLVMFuncPtr(t), typ, vkFuncPtr}
case *types.Array:
elem := p.rawType(t.Elem())
return &aType{llvm.ArrayType(elem.ll, int(t.Len())), typ, vkInvalid}
return &aType{llvm.ArrayType(elem.ll, int(t.Len())), typ, vkArray}
case *types.Chan:
}
panic(fmt.Sprintf("toLLVMType: todo - %T\n", typ))