ssa: make alias working in go 1.22
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
module github.com/goplus/llgo/compiler
|
module github.com/goplus/llgo/compiler
|
||||||
|
|
||||||
go 1.23
|
go 1.22.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/goplus/gogen v1.16.4
|
github.com/goplus/gogen v1.16.4
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ func (p Program) rtNamed(name string) *types.Named {
|
|||||||
t := p.runtime().Scope().Lookup(name).Type()
|
t := p.runtime().Scope().Lookup(name).Type()
|
||||||
for {
|
for {
|
||||||
if alias, ok := t.(*types.Alias); ok {
|
if alias, ok := t.(*types.Alias); ok {
|
||||||
t = alias.Rhs()
|
t = types.Unalias(alias)
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,6 +388,8 @@ func (p Program) toType(raw types.Type) Type {
|
|||||||
return &aType{llvm.ArrayType(elem.ll, int(t.Len())), typ, vkArray}
|
return &aType{llvm.ArrayType(elem.ll, int(t.Len())), typ, vkArray}
|
||||||
case *types.Chan:
|
case *types.Chan:
|
||||||
return &aType{llvm.PointerType(p.rtChan(), 0), typ, vkChan}
|
return &aType{llvm.PointerType(p.rtChan(), 0), typ, vkChan}
|
||||||
|
case *types.Alias:
|
||||||
|
return p.toType(types.Unalias(t))
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("toLLVMType: todo - %T\n", raw))
|
panic(fmt.Sprintf("toLLVMType: todo - %T\n", raw))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ func (p goTypes) cvtType(typ types.Type) (raw types.Type, cvt bool) {
|
|||||||
return p.cvtTuple(t)
|
return p.cvtTuple(t)
|
||||||
case *types.TypeParam:
|
case *types.TypeParam:
|
||||||
return typ.Underlying(), false
|
return typ.Underlying(), false
|
||||||
|
case *types.Alias:
|
||||||
|
return types.Unalias(t), true
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("cvtType: unexpected type - %T", typ))
|
panic(fmt.Sprintf("cvtType: unexpected type - %T", typ))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user