llgo/ssa: rtType, rtFunc
This commit is contained in:
16
cl/_testcgo/any/in.go
Normal file
16
cl/_testcgo/any/in.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import _ "unsafe"
|
||||
|
||||
func incVal(a any) int {
|
||||
return a.(int) + 1
|
||||
}
|
||||
|
||||
//go:linkname printf C.printf
|
||||
func printf(format *int8, __llgo_va_list ...any)
|
||||
|
||||
var format = [...]int8{'H', 'e', 'l', 'l', 'o', ' ', '%', 'd', '\n', 0}
|
||||
|
||||
func main() {
|
||||
printf(&format[0], incVal(100))
|
||||
}
|
||||
0
cl/_testcgo/any/out.ll
Normal file
0
cl/_testcgo/any/out.ll
Normal file
@@ -329,6 +329,9 @@ func (p *context) compileInstrAndValue(b llssa.Builder, iv instrAndValue) (ret l
|
||||
return
|
||||
}
|
||||
panic("todo")
|
||||
case *ssa.TypeAssert:
|
||||
x := p.compileValue(b, v.X)
|
||||
ret = b.TypeAssert(x, p.prog.Type(v.AssertedType), v.CommaOk)
|
||||
default:
|
||||
panic(fmt.Sprintf("compileInstrAndValue: unknown instr - %T\n", iv))
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func testCompile(t *testing.T, src, expected string) {
|
||||
}
|
||||
|
||||
func TestFromTestcgo(t *testing.T) {
|
||||
cltest.FromDir(t, "", "./_testcgo", true)
|
||||
cltest.FromDir(t, "any", "./_testcgo", true)
|
||||
}
|
||||
|
||||
func TestFromTestdata(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user