llgo/ssa: use b.CreateUnreachable to panic
This commit is contained in:
@@ -78,7 +78,7 @@ _llgo_1: ; preds = %_llgo_0
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
%10 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"([21 x i8] c"I2Int: type mismatch\00")
|
||||
call void @abort()
|
||||
unreachable
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAny"(ptr %0, ptr %1) {
|
||||
@@ -267,6 +267,4 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @abort()
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/abi.init"()
|
||||
|
||||
@@ -326,10 +326,6 @@ func (p Package) FuncOf(name string) Function {
|
||||
return p.fns[name]
|
||||
}
|
||||
|
||||
func (p Package) rtAbort() Expr {
|
||||
return p.NewFunc("abort", types.NewSignatureType(nil, nil, nil, nil, nil, false)).Expr
|
||||
}
|
||||
|
||||
func (p Package) rtFunc(fnName string) Expr {
|
||||
fn := p.prog.runtime().Scope().Lookup(fnName).(*types.Func)
|
||||
name := FullName(fn.Pkg(), fnName)
|
||||
|
||||
@@ -73,8 +73,7 @@ func (b Builder) Panic(v Expr) {
|
||||
if debugInstr {
|
||||
log.Printf("Panic %v\n", v.impl)
|
||||
}
|
||||
pkg := b.fn.pkg
|
||||
b.Call(pkg.rtAbort()) // TODO(xsw): pass v
|
||||
b.impl.CreateUnreachable() // TODO(xsw): pass v
|
||||
}
|
||||
|
||||
// Return emits a return instruction.
|
||||
|
||||
Reference in New Issue
Block a user