ssa: comment unused coroutine builders

This commit is contained in:
Li Jie
2024-08-05 16:43:36 +08:00
parent bb03df7059
commit b04ac8df30
2 changed files with 37 additions and 25 deletions

View File

@@ -202,6 +202,7 @@ func (p Program) tyCoID() *types.Signature {
return p.coIDTy return p.coIDTy
} }
/*
// declare token @llvm.coro.id.async(i32 <context size>, i32 <align>, ptr <context arg>, ptr <async function pointer>) // declare token @llvm.coro.id.async(i32 <context size>, i32 <align>, ptr <context arg>, ptr <async function pointer>)
func (p Program) tyCoIDAsync() *types.Signature { func (p Program) tyCoIDAsync() *types.Signature {
if p.coIDAsyncTy == nil { if p.coIDAsyncTy == nil {
@@ -240,6 +241,7 @@ func (p Program) tyCoIDRetconOnce() *types.Signature {
} }
return p.coIDRetconOnceTy return p.coIDRetconOnceTy
} }
*/
// declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>) // declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
func (p Program) tyCoEnd() *types.Signature { func (p Program) tyCoEnd() *types.Signature {
@@ -254,6 +256,7 @@ func (p Program) tyCoEnd() *types.Signature {
return p.coEndTy return p.coEndTy
} }
/*
// TODO(lijie): varargs // TODO(lijie): varargs
// declare token @llvm.coro.end.results(...) // declare token @llvm.coro.end.results(...)
func (p Program) tyCoEndResults() *types.Signature { func (p Program) tyCoEndResults() *types.Signature {
@@ -265,6 +268,7 @@ func (p Program) tyCoEndResults() *types.Signature {
func (p Program) tyCoEndAsync() *types.Signature { func (p Program) tyCoEndAsync() *types.Signature {
panic("not implemented") panic("not implemented")
} }
*/
// declare i8 @llvm.coro.suspend(token <save>, i1 <final>) // declare i8 @llvm.coro.suspend(token <save>, i1 <final>)
func (p Program) tyCoSuspend() *types.Signature { func (p Program) tyCoSuspend() *types.Signature {
@@ -279,6 +283,7 @@ func (p Program) tyCoSuspend() *types.Signature {
return p.coSuspendTy return p.coSuspendTy
} }
/*
// declare token @llvm.coro.save(ptr <handle>) // declare token @llvm.coro.save(ptr <handle>)
func (p Program) tyCoSave() *types.Signature { func (p Program) tyCoSave() *types.Signature {
if p.coSaveTy == nil { if p.coSaveTy == nil {
@@ -353,6 +358,7 @@ func (p Program) tyCoAwaitSuspendHandle() *types.Signature {
} }
return p.coAwaitSuspendHandleTy return p.coAwaitSuspendHandleTy
} }
*/
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@@ -551,6 +557,7 @@ func (b Builder) CoID(align Expr, promise, coroAddr, fnAddrs Expr) Expr {
return b.Call(fn, align, promise, coroAddr, fnAddrs) return b.Call(fn, align, promise, coroAddr, fnAddrs)
} }
/*
// declare token @llvm.coro.id.async(i32 <context size>, i32 <align>, ptr <context arg>, ptr <async function pointer>) // declare token @llvm.coro.id.async(i32 <context size>, i32 <align>, ptr <context arg>, ptr <async function pointer>)
func (b Builder) CoIDAsync(contextSize, align, contextArg, asyncFnPtr Expr) Expr { func (b Builder) CoIDAsync(contextSize, align, contextArg, asyncFnPtr Expr) Expr {
if contextSize.Type != b.Prog.Int32() { if contextSize.Type != b.Prog.Int32() {
@@ -574,6 +581,7 @@ func (b Builder) CoIDRetconOnce(size, align, buffer, prototype, alloc, dealloc E
fn := b.Pkg.cFunc("llvm.coro.id.retcon.once", b.Prog.tyCoIDRetconOnce()) fn := b.Pkg.cFunc("llvm.coro.id.retcon.once", b.Prog.tyCoIDRetconOnce())
return b.Call(fn, size, align, buffer, prototype, alloc, dealloc) return b.Call(fn, size, align, buffer, prototype, alloc, dealloc)
} }
*/
// declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>) // declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
func (b Builder) CoEnd(hdl Expr, unwind Expr, resultToken Expr) Expr { func (b Builder) CoEnd(hdl Expr, unwind Expr, resultToken Expr) Expr {
@@ -581,6 +589,7 @@ func (b Builder) CoEnd(hdl Expr, unwind Expr, resultToken Expr) Expr {
return b.Call(fn, hdl, unwind, resultToken) return b.Call(fn, hdl, unwind, resultToken)
} }
/*
// declare token @llvm.coro.end.results(...) // declare token @llvm.coro.end.results(...)
func (b Builder) CoEndResults(args []Expr) Expr { func (b Builder) CoEndResults(args []Expr) Expr {
fn := b.Pkg.cFunc("llvm.coro.end.results", b.Prog.tyCoEndResults()) fn := b.Pkg.cFunc("llvm.coro.end.results", b.Prog.tyCoEndResults())
@@ -593,6 +602,7 @@ func (b Builder) CoEndAsync(handle, unwind Expr, args ...Expr) Expr {
vargs := append([]Expr{handle, unwind}, args...) vargs := append([]Expr{handle, unwind}, args...)
return b.Call(fn, vargs...) return b.Call(fn, vargs...)
} }
*/
// declare i8 @llvm.coro.suspend(token <save>, i1 <final>) // declare i8 @llvm.coro.suspend(token <save>, i1 <final>)
func (b Builder) coSuspend(save, final Expr) Expr { func (b Builder) coSuspend(save, final Expr) Expr {
@@ -629,6 +639,7 @@ func (b Builder) CoReturn(args ...Expr) {
b.SetBlock(nextBlk) b.SetBlock(nextBlk)
} }
/*
// declare token @llvm.coro.save(ptr <handle>) // declare token @llvm.coro.save(ptr <handle>)
func (b Builder) CoSave(hdl Expr) Expr { func (b Builder) CoSave(hdl Expr) Expr {
fn := b.Pkg.cFunc("llvm.coro.save", b.Prog.tyCoSave()) fn := b.Pkg.cFunc("llvm.coro.save", b.Prog.tyCoSave())
@@ -664,6 +675,7 @@ func (b Builder) CoAwaitSuspendHandle(awaiter, handle, f Expr) {
fn := b.Pkg.cFunc("llvm.coro.await.suspend.handle", b.Prog.tyCoAwaitSuspendHandle()) fn := b.Pkg.cFunc("llvm.coro.await.suspend.handle", b.Prog.tyCoAwaitSuspendHandle())
b.Call(fn, awaiter, handle, f) b.Call(fn, awaiter, handle, f)
} }
*/
func (b Builder) CoYield(setValueFn Function, value Expr, final Expr) { func (b Builder) CoYield(setValueFn Function, value Expr, final Expr) {
if !b.async { if !b.async {

View File

@@ -202,31 +202,31 @@ type aProgram struct {
coPromiseTy *types.Signature coPromiseTy *types.Signature
// coroutine structure intrinsics (ordered by LLVM coroutine doc) // coroutine structure intrinsics (ordered by LLVM coroutine doc)
coSizeI32Ty *types.Signature coSizeI32Ty *types.Signature
coSizeI64Ty *types.Signature coSizeI64Ty *types.Signature
coAlignI32Ty *types.Signature coAlignI32Ty *types.Signature
coAlignI64Ty *types.Signature coAlignI64Ty *types.Signature
coBeginTy *types.Signature coBeginTy *types.Signature
coFreeTy *types.Signature coFreeTy *types.Signature
coAllocTy *types.Signature coAllocTy *types.Signature
coNoopTy *types.Signature coNoopTy *types.Signature
coFrameTy *types.Signature coFrameTy *types.Signature
coIDTy *types.Signature coIDTy *types.Signature
coIDAsyncTy *types.Signature // coIDAsyncTy *types.Signature
coIDRetconTy *types.Signature // coIDRetconTy *types.Signature
coIDRetconOnceTy *types.Signature // coIDRetconOnceTy *types.Signature
coEndTy *types.Signature coEndTy *types.Signature
coEndResultsTy *types.Signature // coEndResultsTy *types.Signature
coEndAsyncTy *types.Signature // coEndAsyncTy *types.Signature
coSuspendTy *types.Signature coSuspendTy *types.Signature
coSaveTy *types.Signature // coSaveTy *types.Signature
coSuspendAsyncTy *types.Signature // coSuspendAsyncTy *types.Signature
coPrepareAsyncTy *types.Signature // coPrepareAsyncTy *types.Signature
coSuspendRetconTy *types.Signature // coSuspendRetconTy *types.Signature
coAwaitSuspendFunctionTy *types.Signature // coAwaitSuspendFunctionTy *types.Signature
coAwaitSuspendVoidTy *types.Signature // coAwaitSuspendVoidTy *types.Signature
coAwaitSuspendBoolTy *types.Signature // coAwaitSuspendBoolTy *types.Signature
coAwaitSuspendHandleTy *types.Signature // coAwaitSuspendHandleTy *types.Signature
paramObjPtr_ *types.Var paramObjPtr_ *types.Var