cl: compile ssa.Function bugfix

This commit is contained in:
xushiwei
2024-05-04 17:46:33 +08:00
parent c0ef1598c9
commit 9b9da3133d
2 changed files with 10 additions and 10 deletions

View File

@@ -50,7 +50,7 @@ _llgo_0:
call void @main.init()
%0 = alloca { ptr, ptr }, align 8
%1 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 0
store ptr @main.Rand, ptr %1, align 8
store ptr @rand, ptr %1, align 8
%2 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 1
store ptr null, ptr %2, align 8
%3 = load { ptr, ptr }, ptr %0, align 8
@@ -85,6 +85,6 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/go
declare void @"github.com/goplus/llgo/internal/runtime.init"()
declare i32 @main.Rand()
declare i32 @rand()
declare i32 @printf(ptr, ...)

View File

@@ -602,15 +602,15 @@ func (p *context) compileValue(b llssa.Builder, v ssa.Value) llssa.Expr {
}
}
case *ssa.Function:
fn := p.compileFunc(p.pkg, p.goTyps, v, true)
return fn.Expr
/*
fn, ftype := p.funcOf(v)
if ftype >= llgoInstrBase {
panic("can't use llgo instruction as a value")
}
if v.Blocks != nil {
fn := p.compileFunc(p.pkg, p.goTyps, v, true)
return fn.Expr
*/
}
fn, ftype := p.funcOf(v)
if ftype >= llgoInstrBase {
panic("can't use llgo instruction as a value")
}
return fn.Expr
case *ssa.Global:
g := p.varOf(v)
return g.Expr