diff options
author | Nia Waldvogel <[email protected]> | 2021-12-31 14:53:19 -0500 |
---|---|---|
committer | Nia <[email protected]> | 2022-01-19 14:42:02 -0500 |
commit | c6ae1c58fcb2f2a70a6d31e7319a1e9dadfe715f (patch) | |
tree | 73f1e52e0cff4a784a1fad830d335d82bba026c9 | |
parent | 0c2fefa09b4b7751d9b325e2418c8813b5929537 (diff) | |
download | tinygo-c6ae1c58fcb2f2a70a6d31e7319a1e9dadfe715f.tar.gz tinygo-c6ae1c58fcb2f2a70a6d31e7319a1e9dadfe715f.zip |
compiler: remove parentHandle from calling convention
This removes the parentHandle argument from the internal calling convention.
It was formerly used to implment coroutines.
Now that coroutines have been removed, it is no longer necessary.
38 files changed, 443 insertions, 487 deletions
diff --git a/builder/build.go b/builder/build.go index 20eb3f16c..42a3dd333 100644 --- a/builder/build.go +++ b/builder/build.go @@ -428,7 +428,6 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil llvmInitFn.SetUnnamedAddr(true) transform.AddStandardAttributes(llvmInitFn, config) llvmInitFn.Param(0).SetName("context") - llvmInitFn.Param(1).SetName("parentHandle") block := mod.Context().AddBasicBlock(llvmInitFn, "entry") irbuilder := mod.Context().NewBuilder() defer irbuilder.Dispose() @@ -439,7 +438,7 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil if pkgInit.IsNil() { panic("init not found for " + pkg.Pkg.Path()) } - irbuilder.CreateCall(pkgInit, []llvm.Value{llvm.Undef(i8ptrType), llvm.Undef(i8ptrType)}, "") + irbuilder.CreateCall(pkgInit, []llvm.Value{llvm.Undef(i8ptrType)}, "") } irbuilder.CreateRetVoid() diff --git a/compiler/calls.go b/compiler/calls.go index 4c5b1fb47..d4659fdf4 100644 --- a/compiler/calls.go +++ b/compiler/calls.go @@ -40,8 +40,7 @@ func (b *builder) createRuntimeCall(fnName string, args []llvm.Value, name strin if llvmFn.IsNil() { panic("trying to call non-existent function: " + fn.RelString(nil)) } - args = append(args, llvm.Undef(b.i8ptrType)) // unused context parameter - args = append(args, llvm.ConstPointerNull(b.i8ptrType)) // coroutine handle + args = append(args, llvm.Undef(b.i8ptrType)) // unused context parameter return b.createCall(llvmFn, args, name) } diff --git a/compiler/compiler.go b/compiler/compiler.go index 21d8074d6..da7d752b5 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -967,9 +967,7 @@ func (b *builder) createFunction() { // method). var context llvm.Value if !b.info.exported { - parentHandle := b.llvmFn.LastParam() - parentHandle.SetName("parentHandle") - context = llvm.PrevParam(parentHandle) + context = b.llvmFn.LastParam() context.SetName("context") } if len(b.fn.FreeVars) != 0 { @@ -1505,9 +1503,6 @@ func (b *builder) createFunctionCall(instr *ssa.CallCommon) (llvm.Value, error) // This function takes a context parameter. // Add it to the end of the parameter list. params = append(params, context) - - // Parent coroutine handle. - params = append(params, llvm.Undef(b.i8ptrType)) } return b.createCall(callee, params, ""), nil diff --git a/compiler/defer.go b/compiler/defer.go index 6edcc1423..1207ce649 100644 --- a/compiler/defer.go +++ b/compiler/defer.go @@ -343,9 +343,6 @@ func (b *builder) createRunDefers() { forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType)) } - // Parent coroutine handle. - forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType)) - b.createCall(fnPtr, forwardParams, "") case *ssa.Function: @@ -374,9 +371,6 @@ func (b *builder) createRunDefers() { // Add the context parameter. We know it is ignored by the receiving // function, but we have to pass one anyway. forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType)) - - // Parent coroutine handle. - forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType)) } // Call real function. @@ -403,9 +397,6 @@ func (b *builder) createRunDefers() { forwardParams = append(forwardParams, forwardParam) } - // Parent coroutine handle. - forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType)) - // Call deferred function. b.createCall(b.getFunction(fn), forwardParams, "") case *ssa.Builtin: diff --git a/compiler/func.go b/compiler/func.go index efb4ac4eb..75656cb7c 100644 --- a/compiler/func.go +++ b/compiler/func.go @@ -115,7 +115,6 @@ func (c *compilerContext) getRawFuncType(typ *types.Signature) llvm.Type { } // All functions take these parameters at the end. paramTypes = append(paramTypes, c.i8ptrType) // context - paramTypes = append(paramTypes, c.i8ptrType) // parent coroutine // Make a func type out of the signature. return llvm.PointerType(llvm.FunctionType(returnType, paramTypes, false), c.funcPtrAddrSpace) diff --git a/compiler/goroutine.go b/compiler/goroutine.go index 06ada25fa..a9b83c7cb 100644 --- a/compiler/goroutine.go +++ b/compiler/goroutine.go @@ -90,17 +90,8 @@ func (b *builder) createGo(instr *ssa.Go) { // * The function pointer (for tasks). var context llvm.Value funcPtr, context = b.decodeFuncValue(b.getValue(instr.Call.Value), instr.Call.Value.Type().Underlying().(*types.Signature)) - params = append(params, context) // context parameter + params = append(params, context, funcPtr) hasContext = true - switch b.Scheduler { - case "none": - // There are no additional parameters needed for the goroutine start operation. - case "tasks", "asyncify": - // Add the function pointer as a parameter to start the goroutine. - params = append(params, funcPtr) - default: - panic("unknown scheduler type") - } prefix = b.fn.RelString(nil) } @@ -113,7 +104,7 @@ func (b *builder) createGo(instr *ssa.Go) { // section that contains the stack size (and is modified after // linking). stackSizeFn := b.getFunction(b.program.ImportedPackage("internal/task").Members["getGoroutineStackSize"].(*ssa.Function)) - stackSize = b.createCall(stackSizeFn, []llvm.Value{callee, llvm.Undef(b.i8ptrType), llvm.Undef(b.i8ptrType)}, "stacksize") + stackSize = b.createCall(stackSizeFn, []llvm.Value{callee, llvm.Undef(b.i8ptrType)}, "stacksize") } else { // The stack size is fixed at compile time. By emitting it here as a // constant, it can be optimized. @@ -123,7 +114,7 @@ func (b *builder) createGo(instr *ssa.Go) { stackSize = llvm.ConstInt(b.uintptrType, b.DefaultStackSize, false) } start := b.getFunction(b.program.ImportedPackage("internal/task").Members["start"].(*ssa.Function)) - b.createCall(start, []llvm.Value{callee, paramBundle, stackSize, llvm.Undef(b.i8ptrType), llvm.ConstPointerNull(b.i8ptrType)}, "") + b.createCall(start, []llvm.Value{callee, paramBundle, stackSize, llvm.Undef(b.i8ptrType)}, "") } // createGoroutineStartWrapper creates a wrapper for the task-based @@ -202,7 +193,6 @@ func (c *compilerContext) createGoroutineStartWrapper(fn llvm.Value, prefix stri // Create the list of params for the call. paramTypes := fn.Type().ElementType().ParamTypes() - paramTypes = paramTypes[:len(paramTypes)-1] // strip parentHandle parameter if !hasContext { paramTypes = paramTypes[:len(paramTypes)-1] // strip context parameter } @@ -210,14 +200,13 @@ func (c *compilerContext) createGoroutineStartWrapper(fn llvm.Value, prefix stri if !hasContext { params = append(params, llvm.Undef(c.i8ptrType)) // add dummy context parameter } - params = append(params, llvm.Undef(c.i8ptrType)) // add dummy parentHandle parameter // Create the call. builder.CreateCall(fn, params, "") if c.Scheduler == "asyncify" { builder.CreateCall(deadlock, []llvm.Value{ - llvm.Undef(c.i8ptrType), llvm.Undef(c.i8ptrType), + llvm.Undef(c.i8ptrType), }, "") } @@ -273,25 +262,19 @@ func (c *compilerContext) createGoroutineStartWrapper(fn llvm.Value, prefix stri // Get the list of parameters, with the extra parameters at the end. paramTypes := fn.Type().ElementType().ParamTypes() - paramTypes[len(paramTypes)-1] = fn.Type() // the last element is the function pointer + paramTypes = append(paramTypes, fn.Type()) // the last element is the function pointer params := llvmutil.EmitPointerUnpack(builder, c.mod, wrapper.Param(0), paramTypes) // Get the function pointer. fnPtr := params[len(params)-1] - - // The last parameter in the packed object has somewhat of a dual role. - // Inside the parameter bundle it's the function pointer, stored right - // after the context pointer. But in the IR call instruction, it's the - // parentHandle function that's always undef. Thus, make the parameter - // undef here. - params[len(params)-1] = llvm.Undef(c.i8ptrType) + params = params[:len(params)-1] // Create the call. builder.CreateCall(fnPtr, params, "") if c.Scheduler == "asyncify" { builder.CreateCall(deadlock, []llvm.Value{ - llvm.Undef(c.i8ptrType), llvm.Undef(c.i8ptrType), + llvm.Undef(c.i8ptrType), }, "") } } diff --git a/compiler/interface.go b/compiler/interface.go index 418b746ac..c8b76039d 100644 --- a/compiler/interface.go +++ b/compiler/interface.go @@ -530,7 +530,6 @@ func (c *compilerContext) getInterfaceInvokeWrapper(fn *ssa.Function, llvmFn llv wrapFnType := llvm.FunctionType(fnType.ReturnType(), paramTypes, false) wrapper = llvm.AddFunction(c.mod, wrapperName, wrapFnType) c.addStandardAttributes(wrapper) - wrapper.LastParam().SetName("parentHandle") wrapper.SetLinkage(llvm.LinkOnceODRLinkage) wrapper.SetUnnamedAddr(true) diff --git a/compiler/llvmutil/wordpack.go b/compiler/llvmutil/wordpack.go index 3783fb9b6..541a20d8a 100644 --- a/compiler/llvmutil/wordpack.go +++ b/compiler/llvmutil/wordpack.go @@ -97,15 +97,13 @@ func EmitPointerPack(builder llvm.Builder, mod llvm.Module, prefix string, needs packedHeapAlloc := builder.CreateCall(alloc, []llvm.Value{ sizeValue, llvm.ConstNull(i8ptrType), - llvm.Undef(i8ptrType), // unused context parameter - llvm.ConstPointerNull(i8ptrType), // coroutine handle + llvm.Undef(i8ptrType), // unused context parameter }, "") if needsStackObjects { trackPointer := mod.NamedFunction("runtime.trackPointer") builder.CreateCall(trackPointer, []llvm.Value{ packedHeapAlloc, - llvm.Undef(i8ptrType), // unused context parameter - llvm.ConstPointerNull(i8ptrType), // coroutine handle + llvm.Undef(i8ptrType), // unused context parameter }, "") } packedAlloc := builder.CreateBitCast(packedHeapAlloc, llvm.PointerType(packedType, 0), "") diff --git a/compiler/symbol.go b/compiler/symbol.go index 4218d5d5c..fb3b6d43e 100644 --- a/compiler/symbol.go +++ b/compiler/symbol.go @@ -84,7 +84,6 @@ func (c *compilerContext) getFunction(fn *ssa.Function) llvm.Value { // closures and bound methods, but should be optimized away when not used. if !info.exported { paramInfos = append(paramInfos, paramInfo{llvmType: c.i8ptrType, name: "context", flags: 0}) - paramInfos = append(paramInfos, paramInfo{llvmType: c.i8ptrType, name: "parentHandle", flags: 0}) } var paramTypes []llvm.Type diff --git a/compiler/testdata/basic.ll b/compiler/testdata/basic.ll index 569b2f7f6..ae142abcd 100644 --- a/compiler/testdata/basic.ll +++ b/compiler/testdata/basic.ll @@ -6,38 +6,38 @@ target triple = "wasm32-unknown-wasi" %main.kv = type { float } %main.kv.0 = type { i8 } -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden i32 @main.addInt(i32 %x, i32 %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.addInt(i32 %x, i32 %y, i8* %context) unnamed_addr #0 { entry: %0 = add i32 %x, %y ret i32 %0 } ; Function Attrs: nounwind -define hidden i1 @main.equalInt(i32 %x, i32 %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.equalInt(i32 %x, i32 %y, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq i32 %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden i32 @main.divInt(i32 %x, i32 %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.divInt(i32 %x, i32 %y, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq i32 %y, 0 br i1 %0, label %divbyzero.throw, label %divbyzero.next divbyzero.throw: ; preds = %entry - call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0 + call void @runtime.divideByZeroPanic(i8* undef) #0 unreachable divbyzero.next: ; preds = %entry @@ -49,16 +49,16 @@ divbyzero.next: ; preds = %entry ret i32 %5 } -declare void @runtime.divideByZeroPanic(i8*, i8*) +declare void @runtime.divideByZeroPanic(i8*) ; Function Attrs: nounwind -define hidden i32 @main.divUint(i32 %x, i32 %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.divUint(i32 %x, i32 %y, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq i32 %y, 0 br i1 %0, label %divbyzero.throw, label %divbyzero.next divbyzero.throw: ; preds = %entry - call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0 + call void @runtime.divideByZeroPanic(i8* undef) #0 unreachable divbyzero.next: ; preds = %entry @@ -67,13 +67,13 @@ divbyzero.next: ; preds = %entry } ; Function Attrs: nounwind -define hidden i32 @main.remInt(i32 %x, i32 %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.remInt(i32 %x, i32 %y, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq i32 %y, 0 br i1 %0, label %divbyzero.throw, label %divbyzero.next divbyzero.throw: ; preds = %entry - call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0 + call void @runtime.divideByZeroPanic(i8* undef) #0 unreachable divbyzero.next: ; preds = %entry @@ -86,13 +86,13 @@ divbyzero.next: ; preds = %entry } ; Function Attrs: nounwind -define hidden i32 @main.remUint(i32 %x, i32 %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.remUint(i32 %x, i32 %y, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq i32 %y, 0 br i1 %0, label %divbyzero.throw, label %divbyzero.next divbyzero.throw: ; preds = %entry - call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0 + call void @runtime.divideByZeroPanic(i8* undef) #0 unreachable divbyzero.next: ; preds = %entry @@ -101,61 +101,61 @@ divbyzero.next: ; preds = %entry } ; Function Attrs: nounwind -define hidden i1 @main.floatEQ(float %x, float %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.floatEQ(float %x, float %y, i8* %context) unnamed_addr #0 { entry: %0 = fcmp oeq float %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden i1 @main.floatNE(float %x, float %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.floatNE(float %x, float %y, i8* %context) unnamed_addr #0 { entry: %0 = fcmp une float %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden i1 @main.floatLower(float %x, float %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.floatLower(float %x, float %y, i8* %context) unnamed_addr #0 { entry: %0 = fcmp olt float %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden i1 @main.floatLowerEqual(float %x, float %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.floatLowerEqual(float %x, float %y, i8* %context) unnamed_addr #0 { entry: %0 = fcmp ole float %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden i1 @main.floatGreater(float %x, float %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.floatGreater(float %x, float %y, i8* %context) unnamed_addr #0 { entry: %0 = fcmp ogt float %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden i1 @main.floatGreaterEqual(float %x, float %y, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.floatGreaterEqual(float %x, float %y, i8* %context) unnamed_addr #0 { entry: %0 = fcmp oge float %x, %y ret i1 %0 } ; Function Attrs: nounwind -define hidden float @main.complexReal(float %x.r, float %x.i, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden float @main.complexReal(float %x.r, float %x.i, i8* %context) unnamed_addr #0 { entry: ret float %x.r } ; Function Attrs: nounwind -define hidden float @main.complexImag(float %x.r, float %x.i, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden float @main.complexImag(float %x.r, float %x.i, i8* %context) unnamed_addr #0 { entry: ret float %x.i } ; Function Attrs: nounwind -define hidden { float, float } @main.complexAdd(float %x.r, float %x.i, float %y.r, float %y.i, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { float, float } @main.complexAdd(float %x.r, float %x.i, float %y.r, float %y.i, i8* %context) unnamed_addr #0 { entry: %0 = fadd float %x.r, %y.r %1 = fadd float %x.i, %y.i @@ -165,7 +165,7 @@ entry: } ; Function Attrs: nounwind -define hidden { float, float } @main.complexSub(float %x.r, float %x.i, float %y.r, float %y.i, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { float, float } @main.complexSub(float %x.r, float %x.i, float %y.r, float %y.i, i8* %context) unnamed_addr #0 { entry: %0 = fsub float %x.r, %y.r %1 = fsub float %x.i, %y.i @@ -175,7 +175,7 @@ entry: } ; Function Attrs: nounwind -define hidden { float, float } @main.complexMul(float %x.r, float %x.i, float %y.r, float %y.i, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { float, float } @main.complexMul(float %x.r, float %x.i, float %y.r, float %y.i, i8* %context) unnamed_addr #0 { entry: %0 = fmul float %x.r, %y.r %1 = fmul float %x.i, %y.i @@ -189,14 +189,14 @@ entry: } ; Function Attrs: nounwind -define hidden void @main.foo(%main.kv* dereferenceable_or_null(4) %a, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.foo(%main.kv* dereferenceable_or_null(4) %a, i8* %context) unnamed_addr #0 { entry: - call void @"main.foo$1"(%main.kv.0* null, i8* undef, i8* undef) + call void @"main.foo$1"(%main.kv.0* null, i8* undef) ret void } ; Function Attrs: nounwind -define hidden void @"main.foo$1"(%main.kv.0* dereferenceable_or_null(1) %b, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @"main.foo$1"(%main.kv.0* dereferenceable_or_null(1) %b, i8* %context) unnamed_addr #0 { entry: ret void } diff --git a/compiler/testdata/channel.ll b/compiler/testdata/channel.ll index 86c6417de..c452a3463 100644 --- a/compiler/testdata/channel.ll +++ b/compiler/testdata/channel.ll @@ -11,18 +11,18 @@ target triple = "wasm32-unknown-wasi" %"internal/task.stackState" = type { i32, i32 } %runtime.chanSelectState = type { %runtime.channel*, i8* } -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.chanIntSend(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.chanIntSend(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context) unnamed_addr #0 { entry: %chan.blockedList = alloca %runtime.channelBlockedList, align 8 %chan.value = alloca i32, align 4 @@ -31,7 +31,7 @@ entry: store i32 3, i32* %chan.value, align 4 %chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8* call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) - call void @runtime.chanSend(%runtime.channel* %ch, i8* nonnull %chan.value.bitcast, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef, i8* null) #0 + call void @runtime.chanSend(%runtime.channel* %ch, i8* nonnull %chan.value.bitcast, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef) #0 call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %chan.value.bitcast) ret void @@ -40,13 +40,13 @@ entry: ; Function Attrs: argmemonly nofree nosync nounwind willreturn declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1 -declare void @runtime.chanSend(%runtime.channel* dereferenceable_or_null(32), i8*, %runtime.channelBlockedList* dereferenceable_or_null(24), i8*, i8*) +declare void @runtime.chanSend(%runtime.channel* dereferenceable_or_null(32), i8*, %runtime.channelBlockedList* dereferenceable_or_null(24), i8*) ; Function Attrs: argmemonly nofree nosync nounwind willreturn declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1 ; Function Attrs: nounwind -define hidden void @main.chanIntRecv(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.chanIntRecv(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context) unnamed_addr #0 { entry: %chan.blockedList = alloca %runtime.channelBlockedList, align 8 %chan.value = alloca i32, align 4 @@ -54,41 +54,41 @@ entry: call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %chan.value.bitcast) %chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8* call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) - %0 = call i1 @runtime.chanRecv(%runtime.channel* %ch, i8* nonnull %chan.value.bitcast, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef, i8* null) #0 + %0 = call i1 @runtime.chanRecv(%runtime.channel* %ch, i8* nonnull %chan.value.bitcast, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef) #0 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %chan.value.bitcast) call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) ret void } -declare i1 @runtime.chanRecv(%runtime.channel* dereferenceable_or_null(32), i8*, %runtime.channelBlockedList* dereferenceable_or_null(24), i8*, i8*) +declare i1 @runtime.chanRecv(%runtime.channel* dereferenceable_or_null(32), i8*, %runtime.channelBlockedList* dereferenceable_or_null(24), i8*) ; Function Attrs: nounwind -define hidden void @main.chanZeroSend(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.chanZeroSend(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context) unnamed_addr #0 { entry: %complit = alloca {}, align 8 %chan.blockedList = alloca %runtime.channelBlockedList, align 8 %0 = bitcast {}* %complit to i8* - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 %chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8* call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) - call void @runtime.chanSend(%runtime.channel* %ch, i8* null, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef, i8* null) #0 + call void @runtime.chanSend(%runtime.channel* %ch, i8* null, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef) #0 call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) ret void } ; Function Attrs: nounwind -define hidden void @main.chanZeroRecv(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.chanZeroRecv(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context) unnamed_addr #0 { entry: %chan.blockedList = alloca %runtime.channelBlockedList, align 8 %chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8* call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) - %0 = call i1 @runtime.chanRecv(%runtime.channel* %ch, i8* null, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef, i8* null) #0 + %0 = call i1 @runtime.chanRecv(%runtime.channel* %ch, i8* null, %runtime.channelBlockedList* nonnull %chan.blockedList, i8* undef) #0 call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast) ret void } ; Function Attrs: nounwind -define hidden void @main.selectZeroRecv(%runtime.channel* dereferenceable_or_null(32) %ch1, %runtime.channel* dereferenceable_or_null(32) %ch2, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.selectZeroRecv(%runtime.channel* dereferenceable_or_null(32) %ch1, %runtime.channel* dereferenceable_or_null(32) %ch2, i8* %context) unnamed_addr #0 { entry: %select.states.alloca = alloca [2 x %runtime.chanSelectState], align 8 %select.send.value = alloca i32, align 4 @@ -105,7 +105,7 @@ entry: %.repack4 = getelementptr inbounds [2 x %runtime.chanSelectState], [2 x %runtime.chanSelectState]* %select.states.alloca, i32 0, i32 1, i32 1 store i8* null, i8** %.repack4, align 4 %select.states = getelementptr inbounds [2 x %runtime.chanSelectState], [2 x %runtime.chanSelectState]* %select.states.alloca, i32 0, i32 0 - %select.result = call { i32, i1 } @runtime.tryChanSelect(i8* undef, %runtime.chanSelectState* nonnull %select.states, i32 2, i32 2, i8* undef, i8* null) #0 + %select.result = call { i32, i1 } @runtime.tryChanSelect(i8* undef, %runtime.chanSelectState* nonnull %select.states, i32 2, i32 2, i8* undef) #0 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %select.states.alloca.bitcast) %1 = extractvalue { i32, i1 } %select.result, 0 %2 = icmp eq i32 %1, 0 @@ -122,7 +122,7 @@ select.body: ; preds = %select.next br label %select.done } -declare { i32, i1 } @runtime.tryChanSelect(i8*, %runtime.chanSelectState*, i32, i32, i8*, i8*) +declare { i32, i1 } @runtime.tryChanSelect(i8*, %runtime.chanSelectState*, i32, i32, i8*) attributes #0 = { nounwind } attributes #1 = { argmemonly nofree nosync nounwind willreturn } diff --git a/compiler/testdata/float.ll b/compiler/testdata/float.ll index 15bf39d75..dc09464e4 100644 --- a/compiler/testdata/float.ll +++ b/compiler/testdata/float.ll @@ -3,18 +3,18 @@ source_filename = "float.go" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-wasi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden i32 @main.f32tou32(float %v, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.f32tou32(float %v, i8* %context) unnamed_addr #0 { entry: %positive = fcmp oge float %v, 0.000000e+00 %withinmax = fcmp ole float %v, 0x41EFFFFFC0000000 @@ -26,25 +26,25 @@ entry: } ; Function Attrs: nounwind -define hidden float @main.maxu32f(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden float @main.maxu32f(i8* %context) unnamed_addr #0 { entry: ret float 0x41F0000000000000 } ; Function Attrs: nounwind -define hidden i32 @main.maxu32tof32(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.maxu32tof32(i8* %context) unnamed_addr #0 { entry: ret i32 -1 } ; Function Attrs: nounwind -define hidden { i32, i32, i32, i32 } @main.inftoi32(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32, i32, i32, i32 } @main.inftoi32(i8* %context) unnamed_addr #0 { entry: ret { i32, i32, i32, i32 } { i32 -1, i32 0, i32 2147483647, i32 -2147483648 } } ; Function Attrs: nounwind -define hidden i32 @main.u32tof32tou32(i32 %v, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.u32tof32tou32(i32 %v, i8* %context) unnamed_addr #0 { entry: %0 = uitofp i32 %v to float %withinmax = fcmp ole float %0, 0x41EFFFFFC0000000 @@ -54,7 +54,7 @@ entry: } ; Function Attrs: nounwind -define hidden float @main.f32tou32tof32(float %v, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden float @main.f32tou32tof32(float %v, i8* %context) unnamed_addr #0 { entry: %positive = fcmp oge float %v, 0.000000e+00 %withinmax = fcmp ole float %v, 0x41EFFFFFC0000000 @@ -67,7 +67,7 @@ entry: } ; Function Attrs: nounwind -define hidden i8 @main.f32tou8(float %v, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8 @main.f32tou8(float %v, i8* %context) unnamed_addr #0 { entry: %positive = fcmp oge float %v, 0.000000e+00 %withinmax = fcmp ole float %v, 2.550000e+02 @@ -79,7 +79,7 @@ entry: } ; Function Attrs: nounwind -define hidden i8 @main.f32toi8(float %v, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8 @main.f32toi8(float %v, i8* %context) unnamed_addr #0 { entry: %abovemin = fcmp oge float %v, -1.280000e+02 %belowmax = fcmp ole float %v, 1.270000e+02 diff --git a/compiler/testdata/func.ll b/compiler/testdata/func.ll index f56779c59..f0e42a32d 100644 --- a/compiler/testdata/func.ll +++ b/compiler/testdata/func.ll @@ -3,43 +3,43 @@ source_filename = "func.go" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-wasi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.foo(i8* %callback.context, void ()* %callback.funcptr, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.foo(i8* %callback.context, void ()* %callback.funcptr, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq void ()* %callback.funcptr, null br i1 %0, label %fpcall.throw, label %fpcall.next fpcall.throw: ; preds = %entry - call void @runtime.nilPanic(i8* undef, i8* null) #0 + call void @runtime.nilPanic(i8* undef) #0 unreachable fpcall.next: ; preds = %entry - %1 = bitcast void ()* %callback.funcptr to void (i32, i8*, i8*)* - call void %1(i32 3, i8* %callback.context, i8* undef) #0 + %1 = bitcast void ()* %callback.funcptr to void (i32, i8*)* + call void %1(i32 3, i8* %callback.context) #0 ret void } -declare void @runtime.nilPanic(i8*, i8*) +declare void @runtime.nilPanic(i8*) ; Function Attrs: nounwind -define hidden void @main.bar(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.bar(i8* %context) unnamed_addr #0 { entry: - call void @main.foo(i8* undef, void ()* bitcast (void (i32, i8*, i8*)* @main.someFunc to void ()*), i8* undef, i8* undef) + call void @main.foo(i8* undef, void ()* bitcast (void (i32, i8*)* @main.someFunc to void ()*), i8* undef) ret void } ; Function Attrs: nounwind -define hidden void @main.someFunc(i32 %arg0, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.someFunc(i32 %arg0, i8* %context) unnamed_addr #0 { entry: ret void } diff --git a/compiler/testdata/gc.ll b/compiler/testdata/gc.ll index 79f0bce57..a0b033f04 100644 --- a/compiler/testdata/gc.ll +++ b/compiler/testdata/gc.ll @@ -26,91 +26,91 @@ target triple = "wasm32-unknown-wasi" @"reflect/types.type:basic:complex128" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* null, i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* @"reflect/types.type:pointer:basic:complex128", i32 0 } @"reflect/types.type:pointer:basic:complex128" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:basic:complex128", i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* null, i32 0 } -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.newScalar(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.newScalar(i8* %context) unnamed_addr #0 { entry: - %new = call i8* @runtime.alloc(i32 1, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new, i8* undef, i8* null) #0 + %new = call i8* @runtime.alloc(i32 1, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new, i8* undef) #0 store i8* %new, i8** @main.scalar1, align 4 - %new1 = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new1, i8* undef, i8* null) #0 + %new1 = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new1, i8* undef) #0 store i8* %new1, i8** bitcast (i32** @main.scalar2 to i8**), align 4 - %new2 = call i8* @runtime.alloc(i32 8, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new2, i8* undef, i8* null) #0 + %new2 = call i8* @runtime.alloc(i32 8, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new2, i8* undef) #0 store i8* %new2, i8** bitcast (i64** @main.scalar3 to i8**), align 4 - %new3 = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new3, i8* undef, i8* null) #0 + %new3 = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new3, i8* undef) #0 store i8* %new3, i8** bitcast (float** @main.scalar4 to i8**), align 4 ret void } ; Function Attrs: nounwind -define hidden void @main.newArray(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.newArray(i8* %context) unnamed_addr #0 { entry: - %new = call i8* @runtime.alloc(i32 3, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new, i8* undef, i8* null) #0 + %new = call i8* @runtime.alloc(i32 3, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new, i8* undef) #0 store i8* %new, i8** bitcast ([3 x i8]** @main.array1 to i8**), align 4 - %new1 = call i8* @runtime.alloc(i32 71, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new1, i8* undef, i8* null) #0 + %new1 = call i8* @runtime.alloc(i32 71, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new1, i8* undef) #0 store i8* %new1, i8** bitcast ([71 x i8]** @main.array2 to i8**), align 4 - %new2 = call i8* @runtime.alloc(i32 12, i8* nonnull inttoptr (i32 67 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new2, i8* undef, i8* null) #0 + %new2 = call i8* @runtime.alloc(i32 12, i8* nonnull inttoptr (i32 67 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new2, i8* undef) #0 store i8* %new2, i8** bitcast ([3 x i8*]** @main.array3 to i8**), align 4 ret void } ; Function Attrs: nounwind -define hidden void @main.newStruct(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.newStruct(i8* %context) unnamed_addr #0 { entry: - %new = call i8* @runtime.alloc(i32 0, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new, i8* undef, i8* null) #0 + %new = call i8* @runtime.alloc(i32 0, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new, i8* undef) #0 store i8* %new, i8** bitcast ({}** @main.struct1 to i8**), align 4 - %new1 = call i8* @runtime.alloc(i32 8, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new1, i8* undef, i8* null) #0 + %new1 = call i8* @runtime.alloc(i32 8, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new1, i8* undef) #0 store i8* %new1, i8** bitcast ({ i32, i32 }** @main.struct2 to i8**), align 4 - %new2 = call i8* @runtime.alloc(i32 248, i8* bitcast ({ i32, [8 x i8] }* @"runtime/gc.layout:62-2000000000000001" to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new2, i8* undef, i8* null) #0 + %new2 = call i8* @runtime.alloc(i32 248, i8* bitcast ({ i32, [8 x i8] }* @"runtime/gc.layout:62-2000000000000001" to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new2, i8* undef) #0 store i8* %new2, i8** bitcast ({ i8*, [60 x i32], i8* }** @main.struct3 to i8**), align 4 - %new3 = call i8* @runtime.alloc(i32 248, i8* bitcast ({ i32, [8 x i8] }* @"runtime/gc.layout:62-0001" to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %new3, i8* undef, i8* null) #0 + %new3 = call i8* @runtime.alloc(i32 248, i8* bitcast ({ i32, [8 x i8] }* @"runtime/gc.layout:62-0001" to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %new3, i8* undef) #0 store i8* %new3, i8** bitcast ({ i8*, [61 x i32] }** @main.struct4 to i8**), align 4 ret void } ; Function Attrs: nounwind -define hidden { i8*, void ()* }* @main.newFuncValue(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i8*, void ()* }* @main.newFuncValue(i8* %context) unnamed_addr #0 { entry: - %new = call i8* @runtime.alloc(i32 8, i8* nonnull inttoptr (i32 197 to i8*), i8* undef, i8* null) #0 + %new = call i8* @runtime.alloc(i32 8, i8* nonnull inttoptr (i32 197 to i8*), i8* undef) #0 %0 = bitcast i8* %new to { i8*, void ()* }* - call void @runtime.trackPointer(i8* nonnull %new, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %new, i8* undef) #0 ret { i8*, void ()* }* %0 } ; Function Attrs: nounwind -define hidden void @main.makeSlice(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.makeSlice(i8* %context) unnamed_addr #0 { entry: - %makeslice = call i8* @runtime.alloc(i32 5, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %makeslice, i8* undef, i8* null) #0 + %makeslice = call i8* @runtime.alloc(i32 5, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice, i8* undef) #0 store i8* %makeslice, i8** getelementptr inbounds ({ i8*, i32, i32 }, { i8*, i32, i32 }* @main.slice1, i32 0, i32 0), align 8 store i32 5, i32* getelementptr inbounds ({ i8*, i32, i32 }, { i8*, i32, i32 }* @main.slice1, i32 0, i32 1), align 4 store i32 5, i32* getelementptr inbounds ({ i8*, i32, i32 }, { i8*, i32, i32 }* @main.slice1, i32 0, i32 2), align 8 - %makeslice1 = call i8* @runtime.alloc(i32 20, i8* nonnull inttoptr (i32 67 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %makeslice1, i8* undef, i8* null) #0 + %makeslice1 = call i8* @runtime.alloc(i32 20, i8* nonnull inttoptr (i32 67 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice1, i8* undef) #0 store i8* %makeslice1, i8** bitcast ({ i32**, i32, i32 }* @main.slice2 to i8**), align 8 store i32 5, i32* getelementptr inbounds ({ i32**, i32, i32 }, { i32**, i32, i32 }* @main.slice2, i32 0, i32 1), align 4 store i32 5, i32* getelementptr inbounds ({ i32**, i32, i32 }, { i32**, i32, i32 }* @main.slice2, i32 0, i32 2), align 8 - %makeslice3 = call i8* @runtime.alloc(i32 60, i8* nonnull inttoptr (i32 71 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %makeslice3, i8* undef, i8* null) #0 + %makeslice3 = call i8* @runtime.alloc(i32 60, i8* nonnull inttoptr (i32 71 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice3, i8* undef) #0 store i8* %makeslice3, i8** bitcast ({ { i8*, i32, i32 }*, i32, i32 }* @main.slice3 to i8**), align 8 store i32 5, i32* getelementptr inbounds ({ { i8*, i32, i32 }*, i32, i32 }, { { i8*, i32, i32 }*, i32, i32 }* @main.slice3, i32 0, i32 1), align 4 store i32 5, i32* getelementptr inbounds ({ { i8*, i32, i32 }*, i32, i32 }, { { i8*, i32, i32 }*, i32, i32 }* @main.slice3, i32 0, i32 2), align 8 @@ -118,17 +118,17 @@ entry: } ; Function Attrs: nounwind -define hidden %runtime._interface @main.makeInterface(double %v.r, double %v.i, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._interface @main.makeInterface(double %v.r, double %v.i, i8* %context) unnamed_addr #0 { entry: - %0 = call i8* @runtime.alloc(i32 16, i8* null, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 + %0 = call i8* @runtime.alloc(i32 16, i8* null, i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 %.repack = bitcast i8* %0 to double* store double %v.r, double* %.repack, align 8 %.repack1 = getelementptr inbounds i8, i8* %0, i32 8 %1 = bitcast i8* %.repack1 to double* store double %v.i, double* %1, align 8 %2 = insertvalue %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:complex128" to i32), i8* undef }, i8* %0, 1 - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 ret %runtime._interface %2 } diff --git a/compiler/testdata/go1.17.ll b/compiler/testdata/go1.17.ll index 5b50cb50d..99864f877 100644 --- a/compiler/testdata/go1.17.ll +++ b/compiler/testdata/go1.17.ll @@ -3,41 +3,41 @@ source_filename = "go1.17.go" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-wasi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden i8* @main.Add32(i8* %p, i32 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8* @main.Add32(i8* %p, i32 %len, i8* %context) unnamed_addr #0 { entry: %0 = getelementptr i8, i8* %p, i32 %len - call void @runtime.trackPointer(i8* %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %0, i8* undef) #0 ret i8* %0 } ; Function Attrs: nounwind -define hidden i8* @main.Add64(i8* %p, i64 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8* @main.Add64(i8* %p, i64 %len, i8* %context) unnamed_addr #0 { entry: %0 = trunc i64 %len to i32 %1 = getelementptr i8, i8* %p, i32 %0 - call void @runtime.trackPointer(i8* %1, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %1, i8* undef) #0 ret i8* %1 } ; Function Attrs: nounwind -define hidden [4 x i32]* @main.SliceToArray(i32* %s.data, i32 %s.len, i32 %s.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden [4 x i32]* @main.SliceToArray(i32* %s.data, i32 %s.len, i32 %s.cap, i8* %context) unnamed_addr #0 { entry: %0 = icmp ult i32 %s.len, 4 br i1 %0, label %slicetoarray.throw, label %slicetoarray.next slicetoarray.throw: ; preds = %entry - call void @runtime.sliceToArrayPointerPanic(i8* undef, i8* null) #0 + call void @runtime.sliceToArrayPointerPanic(i8* undef) #0 unreachable slicetoarray.next: ; preds = %entry @@ -45,13 +45,13 @@ slicetoarray.next: ; preds = %entry ret [4 x i32]* %1 } -declare void @runtime.sliceToArrayPointerPanic(i8*, i8*) +declare void @runtime.sliceToArrayPointerPanic(i8*) ; Function Attrs: nounwind -define hidden [4 x i32]* @main.SliceToArrayConst(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden [4 x i32]* @main.SliceToArrayConst(i8* %context) unnamed_addr #0 { entry: - %makeslice = call i8* @runtime.alloc(i32 24, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %makeslice, i8* undef, i8* null) #0 + %makeslice = call i8* @runtime.alloc(i32 24, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice, i8* undef) #0 br i1 false, label %slicetoarray.throw, label %slicetoarray.next slicetoarray.throw: ; preds = %entry @@ -63,7 +63,7 @@ slicetoarray.next: ; preds = %entry } ; Function Attrs: nounwind -define hidden { i32*, i32, i32 } @main.SliceInt(i32* dereferenceable_or_null(4) %ptr, i32 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32*, i32, i32 } @main.SliceInt(i32* dereferenceable_or_null(4) %ptr, i32 %len, i8* %context) unnamed_addr #0 { entry: %0 = icmp ugt i32 %len, 1073741823 %1 = icmp eq i32* %ptr, null @@ -73,7 +73,7 @@ entry: br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next unsafe.Slice.throw: ; preds = %entry - call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0 + call void @runtime.unsafeSlicePanic(i8* undef) #0 unreachable unsafe.Slice.next: ; preds = %entry @@ -81,14 +81,14 @@ unsafe.Slice.next: ; preds = %entry %6 = insertvalue { i32*, i32, i32 } %5, i32 %len, 1 %7 = insertvalue { i32*, i32, i32 } %6, i32 %len, 2 %8 = bitcast i32* %ptr to i8* - call void @runtime.trackPointer(i8* %8, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %8, i8* undef) #0 ret { i32*, i32, i32 } %7 } -declare void @runtime.unsafeSlicePanic(i8*, i8*) +declare void @runtime.unsafeSlicePanic(i8*) ; Function Attrs: nounwind -define hidden { i8*, i32, i32 } @main.SliceUint16(i8* dereferenceable_or_null(1) %ptr, i16 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i8*, i32, i32 } @main.SliceUint16(i8* dereferenceable_or_null(1) %ptr, i16 %len, i8* %context) unnamed_addr #0 { entry: %0 = icmp eq i8* %ptr, null %1 = icmp ne i16 %len, 0 @@ -96,7 +96,7 @@ entry: br i1 %2, label %unsafe.Slice.throw, label %unsafe.Slice.next unsafe.Slice.throw: ; preds = %entry - call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0 + call void @runtime.unsafeSlicePanic(i8* undef) #0 unreachable unsafe.Slice.next: ; preds = %entry @@ -104,12 +104,12 @@ unsafe.Slice.next: ; preds = %entry %4 = insertvalue { i8*, i32, i32 } undef, i8* %ptr, 0 %5 = insertvalue { i8*, i32, i32 } %4, i32 %3, 1 %6 = insertvalue { i8*, i32, i32 } %5, i32 %3, 2 - call void @runtime.trackPointer(i8* %ptr, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %ptr, i8* undef) #0 ret { i8*, i32, i32 } %6 } ; Function Attrs: nounwind -define hidden { i32*, i32, i32 } @main.SliceUint64(i32* dereferenceable_or_null(4) %ptr, i64 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32*, i32, i32 } @main.SliceUint64(i32* dereferenceable_or_null(4) %ptr, i64 %len, i8* %context) unnamed_addr #0 { entry: %0 = icmp ugt i64 %len, 1073741823 %1 = icmp eq i32* %ptr, null @@ -119,7 +119,7 @@ entry: br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next unsafe.Slice.throw: ; preds = %entry - call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0 + call void @runtime.unsafeSlicePanic(i8* undef) #0 unreachable unsafe.Slice.next: ; preds = %entry @@ -128,12 +128,12 @@ unsafe.Slice.next: ; preds = %entry %7 = insertvalue { i32*, i32, i32 } %6, i32 %5, 1 %8 = insertvalue { i32*, i32, i32 } %7, i32 %5, 2 %9 = bitcast i32* %ptr to i8* - call void @runtime.trackPointer(i8* %9, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %9, i8* undef) #0 ret { i32*, i32, i32 } %8 } ; Function Attrs: nounwind -define hidden { i32*, i32, i32 } @main.SliceInt64(i32* dereferenceable_or_null(4) %ptr, i64 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32*, i32, i32 } @main.SliceInt64(i32* dereferenceable_or_null(4) %ptr, i64 %len, i8* %context) unnamed_addr #0 { entry: %0 = icmp ugt i64 %len, 1073741823 %1 = icmp eq i32* %ptr, null @@ -143,7 +143,7 @@ entry: br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next unsafe.Slice.throw: ; preds = %entry - call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0 + call void @runtime.unsafeSlicePanic(i8* undef) #0 unreachable unsafe.Slice.next: ; preds = %entry @@ -152,7 +152,7 @@ unsafe.Slice.next: ; preds = %entry %7 = insertvalue { i32*, i32, i32 } %6, i32 %5, 1 %8 = insertvalue { i32*, i32, i32 } %7, i32 %5, 2 %9 = bitcast i32* %ptr to i8* - call void @runtime.trackPointer(i8* %9, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %9, i8* undef) #0 ret { i32*, i32, i32 } %8 } diff --git a/compiler/testdata/goroutine-cortex-m-qemu-tasks.ll b/compiler/testdata/goroutine-cortex-m-qemu-tasks.ll index 6224f256a..24c4ffb2b 100644 --- a/compiler/testdata/goroutine-cortex-m-qemu-tasks.ll +++ b/compiler/testdata/goroutine-cortex-m-qemu-tasks.ll @@ -12,46 +12,46 @@ target triple = "thumbv7m-unknown-unknown-eabi" @"main$string" = internal unnamed_addr constant [4 x i8] c"test", align 1 -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.regularFunctionGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.regularFunctionGoroutine(i8* %context) unnamed_addr #0 { entry: - %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* undef, i8* undef) #0 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 %stacksize, i8* undef, i8* null) #0 + %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* undef) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 %stacksize, i8* undef) #0 ret void } -declare void @main.regularFunction(i32, i8*, i8*) +declare void @main.regularFunction(i32, i8*) ; Function Attrs: nounwind define linkonce_odr void @"main.regularFunction$gowrapper"(i8* %0) unnamed_addr #1 { entry: %unpack.int = ptrtoint i8* %0 to i32 - call void @main.regularFunction(i32 %unpack.int, i8* undef, i8* undef) #0 + call void @main.regularFunction(i32 %unpack.int, i8* undef) #0 ret void } -declare i32 @"internal/task.getGoroutineStackSize"(i32, i8*, i8*) +declare i32 @"internal/task.getGoroutineStackSize"(i32, i8*) -declare void @"internal/task.start"(i32, i8*, i32, i8*, i8*) +declare void @"internal/task.start"(i32, i8*, i32, i8*) ; Function Attrs: nounwind -define hidden void @main.inlineFunctionGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.inlineFunctionGoroutine(i8* %context) unnamed_addr #0 { entry: - %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* undef, i8* undef) #0 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 %stacksize, i8* undef, i8* null) #0 + %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* undef) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 %stacksize, i8* undef) #0 ret void } ; Function Attrs: nounwind -define hidden void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #0 { entry: ret void } @@ -60,31 +60,31 @@ entry: define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(i8* %0) unnamed_addr #2 { entry: %unpack.int = ptrtoint i8* %0 to i32 - call void @"main.inlineFunctionGoroutine$1"(i32 %unpack.int, i8* undef, i8* undef) + call void @"main.inlineFunctionGoroutine$1"(i32 %unpack.int, i8* undef) ret void } ; Function Attrs: nounwind -define hidden void @main.closureFunctionGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.closureFunctionGoroutine(i8* %context) unnamed_addr #0 { entry: - %n = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 + %n = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 %0 = bitcast i8* %n to i32* store i32 3, i32* %0, align 4 - %1 = call i8* @runtime.alloc(i32 8, i8* null, i8* undef, i8* null) #0 + %1 = call i8* @runtime.alloc(i32 8, i8* null, i8* undef) #0 %2 = bitcast i8* %1 to i32* store i32 5, i32* %2, align 4 %3 = getelementptr inbounds i8, i8* %1, i32 4 %4 = bitcast i8* %3 to i8** store i8* %n, i8** %4, align 4 - %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.closureFunctionGoroutine$1$gowrapper" to i32), i8* undef, i8* undef) #0 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.closureFunctionGoroutine$1$gowrapper" to i32), i8* nonnull %1, i32 %stacksize, i8* undef, i8* null) #0 + %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.closureFunctionGoroutine$1$gowrapper" to i32), i8* undef) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.closureFunctionGoroutine$1$gowrapper" to i32), i8* nonnull %1, i32 %stacksize, i8* undef) #0 %5 = load i32, i32* %0, align 4 - call void @runtime.printint32(i32 %5, i8* undef, i8* null) #0 + call void @runtime.printint32(i32 %5, i8* undef) #0 ret void } ; Function Attrs: nounwind -define hidden void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #0 { entry: %unpack.ptr = bitcast i8* %context to i32* store i32 7, i32* %unpack.ptr, align 4 @@ -99,16 +99,16 @@ entry: %3 = getelementptr inbounds i8, i8* %0, i32 4 %4 = bitcast i8* %3 to i8** %5 = load i8*, i8** %4, align 4 - call void @"main.closureFunctionGoroutine$1"(i32 %2, i8* %5, i8* undef) + call void @"main.closureFunctionGoroutine$1"(i32 %2, i8* %5) ret void } -declare void @runtime.printint32(i32, i8*, i8*) +declare void @runtime.printint32(i32, i8*) ; Function Attrs: nounwind -define hidden void @main.funcGoroutine(i8* %fn.context, void ()* %fn.funcptr, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.funcGoroutine(i8* %fn.context, void ()* %fn.funcptr, i8* %context) unnamed_addr #0 { entry: - %0 = call i8* @runtime.alloc(i32 12, i8* null, i8* undef, i8* null) #0 + %0 = call i8* @runtime.alloc(i32 12, i8* null, i8* undef) #0 %1 = bitcast i8* %0 to i32* store i32 5, i32* %1, align 4 %2 = getelementptr inbounds i8, i8* %0, i32 4 @@ -117,8 +117,8 @@ entry: %4 = getelementptr inbounds i8, i8* %0, i32 8 %5 = bitcast i8* %4 to void ()** store void ()* %fn.funcptr, void ()** %5, align 4 - %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @main.funcGoroutine.gowrapper to i32), i8* undef, i8* undef) #0 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @main.funcGoroutine.gowrapper to i32), i8* nonnull %0, i32 %stacksize, i8* undef, i8* null) #0 + %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @main.funcGoroutine.gowrapper to i32), i8* undef) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @main.funcGoroutine.gowrapper to i32), i8* nonnull %0, i32 %stacksize, i8* undef) #0 ret void } @@ -131,40 +131,40 @@ entry: %4 = bitcast i8* %3 to i8** %5 = load i8*, i8** %4, align 4 %6 = getelementptr inbounds i8, i8* %0, i32 8 - %7 = bitcast i8* %6 to void (i32, i8*, i8*)** - %8 = load void (i32, i8*, i8*)*, void (i32, i8*, i8*)** %7, align 4 - call void %8(i32 %2, i8* %5, i8* undef) #0 + %7 = bitcast i8* %6 to void (i32, i8*)** + %8 = load void (i32, i8*)*, void (i32, i8*)** %7, align 4 + call void %8(i32 %2, i8* %5) #0 ret void } ; Function Attrs: nounwind -define hidden void @main.recoverBuiltinGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.recoverBuiltinGoroutine(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.copyBuiltinGoroutine(i8* %dst.data, i32 %dst.len, i32 %dst.cap, i8* %src.data, i32 %src.len, i32 %src.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.copyBuiltinGoroutine(i8* %dst.data, i32 %dst.len, i32 %dst.cap, i8* %src.data, i32 %src.len, i32 %src.cap, i8* %context) unnamed_addr #0 { entry: - %copy.n = call i32 @runtime.sliceCopy(i8* %dst.data, i8* %src.data, i32 %dst.len, i32 %src.len, i32 1, i8* undef, i8* null) #0 + %copy.n = call i32 @runtime.sliceCopy(i8* %dst.data, i8* %src.data, i32 %dst.len, i32 %src.len, i32 1, i8* undef) #0 ret void } -declare i32 @runtime.sliceCopy(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i32, i8*, i8*) +declare i32 @runtime.sliceCopy(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i32, i8*) ; Function Attrs: nounwind -define hidden void @main.closeBuiltinGoroutine(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.closeBuiltinGoroutine(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context) unnamed_addr #0 { entry: - call void @runtime.chanClose(%runtime.channel* %ch, i8* undef, i8* null) #0 + call void @runtime.chanClose(%runtime.channel* %ch, i8* undef) #0 ret void } -declare void @runtime.chanClose(%runtime.channel* dereferenceable_or_null(32), i8*, i8*) +declare void @runtime.chanClose(%runtime.channel* dereferenceable_or_null(32), i8*) ; Function Attrs: nounwind -define hidden void @main.startInterfaceMethod(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.startInterfaceMethod(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: - %0 = call i8* @runtime.alloc(i32 16, i8* null, i8* undef, i8* null) #0 + %0 = call i8* @runtime.alloc(i32 16, i8* null, i8* undef) #0 %1 = bitcast i8* %0 to i8** store i8* %itf.value, i8** %1, align 4 %2 = getelementptr inbounds i8, i8* %0, i32 4 @@ -176,12 +176,12 @@ entry: %4 = getelementptr inbounds i8, i8* %0, i32 12 %5 = bitcast i8* %4 to i32* store i32 %itf.typecode, i32* %5, align 4 - %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), i8* undef, i8* undef) #0 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), i8* nonnull %0, i32 %stacksize, i8* undef, i8* null) #0 + %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), i8* undef) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), i8* nonnull %0, i32 %stacksize, i8* undef) #0 ret void } -declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8*, i8*, i32, i32, i8*, i8*) #5 +declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8*, i8*, i32, i32, i8*) #5 ; Function Attrs: nounwind define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(i8* %0) unnamed_addr #6 { @@ -197,7 +197,7 @@ entry: %9 = getelementptr inbounds i8, i8* %0, i32 12 %10 = bitcast i8* %9 to i32* %11 = load i32, i32* %10, align 4 - call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8* %2, i8* %5, i32 %8, i32 %11, i8* undef, i8* undef) #0 + call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8* %2, i8* %5, i32 %8, i32 %11, i8* undef) #0 ret void } diff --git a/compiler/testdata/goroutine-wasm-asyncify.ll b/compiler/testdata/goroutine-wasm-asyncify.ll index 76473cda4..32c404dc1 100644 --- a/compiler/testdata/goroutine-wasm-asyncify.ll +++ b/compiler/testdata/goroutine-wasm-asyncify.ll @@ -13,47 +13,47 @@ target triple = "wasm32-unknown-wasi" @"main$string" = internal unnamed_addr constant [4 x i8] c"test", align 1 -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.regularFunctionGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.regularFunctionGoroutine(i8* %context) unnamed_addr #0 { entry: - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 16384, i8* undef, i8* null) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 16384, i8* undef) #0 ret void } -declare void @main.regularFunction(i32, i8*, i8*) +declare void @main.regularFunction(i32, i8*) -declare void @runtime.deadlock(i8*, i8*) +declare void @runtime.deadlock(i8*) ; Function Attrs: nounwind define linkonce_odr void @"main.regularFunction$gowrapper"(i8* %0) unnamed_addr #1 { entry: %unpack.int = ptrtoint i8* %0 to i32 - call void @main.regularFunction(i32 %unpack.int, i8* undef, i8* undef) #0 - call void @runtime.deadlock(i8* undef, i8* undef) #0 + call void @main.regularFunction(i32 %unpack.int, i8* undef) #0 + call void @runtime.deadlock(i8* undef) #0 unreachable } -declare void @"internal/task.start"(i32, i8*, i32, i8*, i8*) +declare void @"internal/task.start"(i32, i8*, i32, i8*) ; Function Attrs: nounwind -define hidden void @main.inlineFunctionGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.inlineFunctionGoroutine(i8* %context) unnamed_addr #0 { entry: - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 16384, i8* undef, i8* null) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* nonnull inttoptr (i32 5 to i8*), i32 16384, i8* undef) #0 ret void } ; Function Attrs: nounwind -define hidden void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @"main.inlineFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #0 { entry: ret void } @@ -62,35 +62,35 @@ entry: define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(i8* %0) unnamed_addr #2 { entry: %unpack.int = ptrtoint i8* %0 to i32 - call void @"main.inlineFunctionGoroutine$1"(i32 %unpack.int, i8* undef, i8* undef) - call void @runtime.deadlock(i8* undef, i8* undef) #0 + call void @"main.inlineFunctionGoroutine$1"(i32 %unpack.int, i8* undef) + call void @runtime.deadlock(i8* undef) #0 unreachable } ; Function Attrs: nounwind -define hidden void @main.closureFunctionGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.closureFunctionGoroutine(i8* %context) unnamed_addr #0 { entry: - %n = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 + %n = call i8* @runtime.alloc(i32 4, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 %0 = bitcast i8* %n to i32* - call void @runtime.trackPointer(i8* nonnull %n, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %n, i8* undef) #0 store i32 3, i32* %0, align 4 - call void @runtime.trackPointer(i8* nonnull %n, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* bitcast (void (i32, i8*, i8*)* @"main.closureFunctionGoroutine$1" to i8*), i8* undef, i8* null) #0 - %1 = call i8* @runtime.alloc(i32 8, i8* null, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %1, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %n, i8* undef) #0 + call void @runtime.trackPointer(i8* bitcast (void (i32, i8*)* @"main.closureFunctionGoroutine$1" to i8*), i8* undef) #0 + %1 = call i8* @runtime.alloc(i32 8, i8* null, i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %1, i8* undef) #0 %2 = bitcast i8* %1 to i32* store i32 5, i32* %2, align 4 %3 = getelementptr inbounds i8, i8* %1, i32 4 %4 = bitcast i8* %3 to i8** store i8* %n, i8** %4, align 4 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.closureFunctionGoroutine$1$gowrapper" to i32), i8* nonnull %1, i32 16384, i8* undef, i8* null) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"main.closureFunctionGoroutine$1$gowrapper" to i32), i8* nonnull %1, i32 16384, i8* undef) #0 %5 = load i32, i32* %0, align 4 - call void @runtime.printint32(i32 %5, i8* undef, i8* null) #0 + call void @runtime.printint32(i32 %5, i8* undef) #0 ret void } ; Function Attrs: nounwind -define hidden void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @"main.closureFunctionGoroutine$1"(i32 %x, i8* %context) unnamed_addr #0 { entry: %unpack.ptr = bitcast i8* %context to i32* store i32 7, i32* %unpack.ptr, align 4 @@ -105,18 +105,18 @@ entry: %3 = getelementptr inbounds i8, i8* %0, i32 4 %4 = bitcast i8* %3 to i8** %5 = load i8*, i8** %4, align 4 - call void @"main.closureFunctionGoroutine$1"(i32 %2, i8* %5, i8* undef) - call void @runtime.deadlock(i8* undef, i8* undef) #0 + call void @"main.closureFunctionGoroutine$1"(i32 %2, i8* %5) + call void @runtime.deadlock(i8* undef) #0 unreachable } -declare void @runtime.printint32(i32, i8*, i8*) +declare void @runtime.printint32(i32, i8*) ; Function Attrs: nounwind -define hidden void @main.funcGoroutine(i8* %fn.context, void ()* %fn.funcptr, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.funcGoroutine(i8* %fn.context, void ()* %fn.funcptr, i8* %context) unnamed_addr #0 { entry: - %0 = call i8* @runtime.alloc(i32 12, i8* null, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 + %0 = call i8* @runtime.alloc(i32 12, i8* null, i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 %1 = bitcast i8* %0 to i32* store i32 5, i32* %1, align 4 %2 = getelementptr inbounds i8, i8* %0, i32 4 @@ -125,7 +125,7 @@ entry: %4 = getelementptr inbounds i8, i8* %0, i32 8 %5 = bitcast i8* %4 to void ()** store void ()* %fn.funcptr, void ()** %5, align 4 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @main.funcGoroutine.gowrapper to i32), i8* nonnull %0, i32 16384, i8* undef, i8* null) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @main.funcGoroutine.gowrapper to i32), i8* nonnull %0, i32 16384, i8* undef) #0 ret void } @@ -138,42 +138,42 @@ entry: %4 = bitcast i8* %3 to i8** %5 = load i8*, i8** %4, align 4 %6 = getelementptr inbounds i8, i8* %0, i32 8 - %7 = bitcast i8* %6 to void (i32, i8*, i8*)** - %8 = load void (i32, i8*, i8*)*, void (i32, i8*, i8*)** %7, align 4 - call void %8(i32 %2, i8* %5, i8* undef) #0 - call void @runtime.deadlock(i8* undef, i8* undef) #0 + %7 = bitcast i8* %6 to void (i32, i8*)** + %8 = load void (i32, i8*)*, void (i32, i8*)** %7, align 4 + call void %8(i32 %2, i8* %5) #0 + call void @runtime.deadlock(i8* undef) #0 unreachable } ; Function Attrs: nounwind -define hidden void @main.recoverBuiltinGoroutine(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.recoverBuiltinGoroutine(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.copyBuiltinGoroutine(i8* %dst.data, i32 %dst.len, i32 %dst.cap, i8* %src.data, i32 %src.len, i32 %src.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.copyBuiltinGoroutine(i8* %dst.data, i32 %dst.len, i32 %dst.cap, i8* %src.data, i32 %src.len, i32 %src.cap, i8* %context) unnamed_addr #0 { entry: - %copy.n = call i32 @runtime.sliceCopy(i8* %dst.data, i8* %src.data, i32 %dst.len, i32 %src.len, i32 1, i8* undef, i8* null) #0 + %copy.n = call i32 @runtime.sliceCopy(i8* %dst.data, i8* %src.data, i32 %dst.len, i32 %src.len, i32 1, i8* undef) #0 ret void } -declare i32 @runtime.sliceCopy(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i32, i8*, i8*) +declare i32 @runtime.sliceCopy(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i32, i8*) ; Function Attrs: nounwind -define hidden void @main.closeBuiltinGoroutine(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.closeBuiltinGoroutine(%runtime.channel* dereferenceable_or_null(32) %ch, i8* %context) unnamed_addr #0 { entry: - call void @runtime.chanClose(%runtime.channel* %ch, i8* undef, i8* null) #0 + call void @runtime.chanClose(%runtime.channel* %ch, i8* undef) #0 ret void } -declare void @runtime.chanClose(%runtime.channel* dereferenceable_or_null(32), i8*, i8*) +declare void @runtime.chanClose(%runtime.channel* dereferenceable_or_null(32), i8*) ; Function Attrs: nounwind -define hidden void @main.startInterfaceMethod(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.startInterfaceMethod(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: - %0 = call i8* @runtime.alloc(i32 16, i8* null, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 + %0 = call i8* @runtime.alloc(i32 16, i8* null, i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 %1 = bitcast i8* %0 to i8** store i8* %itf.value, i8** %1, align 4 %2 = getelementptr inbounds i8, i8* %0, i32 4 @@ -185,11 +185,11 @@ entry: %4 = getelementptr inbounds i8, i8* %0, i32 12 %5 = bitcast i8* %4 to i32* store i32 %itf.typecode, i32* %5, align 4 - call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), i8* nonnull %0, i32 16384, i8* undef, i8* null) #0 + call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), i8* nonnull %0, i32 16384, i8* undef) #0 ret void } -declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8*, i8*, i32, i32, i8*, i8*) #5 +declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8*, i8*, i32, i32, i8*) #5 ; Function Attrs: nounwind define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(i8* %0) unnamed_addr #6 { @@ -205,8 +205,8 @@ entry: %9 = getelementptr inbounds i8, i8* %0, i32 12 %10 = bitcast i8* %9 to i32* %11 = load i32, i32* %10, align 4 - call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8* %2, i8* %5, i32 %8, i32 %11, i8* undef, i8* undef) #0 - call void @runtime.deadlock(i8* undef, i8* undef) #0 + call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(i8* %2, i8* %5, i32 %8, i32 %11, i8* undef) #0 + call void @runtime.deadlock(i8* undef) #0 unreachable } diff --git a/compiler/testdata/interface.ll b/compiler/testdata/interface.ll index c9ff0a90e..b53297b7f 100644 --- a/compiler/testdata/interface.ll +++ b/compiler/testdata/interface.ll @@ -22,52 +22,52 @@ target triple = "wasm32-unknown-wasi" @"reflect/types.interface:interface{String() string}$interface" = linkonce_odr constant [1 x i8*] [i8* @"reflect/methods.String() string"] @"reflect/types.typeid:basic:int" = external constant i8 -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden %runtime._interface @main.simpleType(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._interface @main.simpleType(i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* null, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* null, i8* undef) #0 ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* null } } ; Function Attrs: nounwind -define hidden %runtime._interface @main.pointerType(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._interface @main.pointerType(i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* null, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* null, i8* undef) #0 ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:basic:int" to i32), i8* null } } ; Function Attrs: nounwind -define hidden %runtime._interface @main.interfaceType(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._interface @main.interfaceType(i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* null, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* null, i8* undef) #0 ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:named:error" to i32), i8* null } } declare i1 @"interface:{Error:func:{}{basic:string}}.$typeassert"(i32) #1 ; Function Attrs: nounwind -define hidden %runtime._interface @main.anonymousInterfaceType(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._interface @main.anonymousInterfaceType(i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* null, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* null, i8* undef) #0 ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:interface:{String:func:{}{basic:string}}" to i32), i8* null } } declare i1 @"interface:{String:func:{}{basic:string}}.$typeassert"(i32) #2 ; Function Attrs: nounwind -define hidden i1 @main.isInt(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.isInt(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: - %typecode = call i1 @runtime.typeAssert(i32 %itf.typecode, i8* nonnull @"reflect/types.typeid:basic:int", i8* undef, i8* null) #0 + %typecode = call i1 @runtime.typeAssert(i32 %itf.typecode, i8* nonnull @"reflect/types.typeid:basic:int", i8* undef) #0 br i1 %typecode, label %typeassert.ok, label %typeassert.next typeassert.ok: ; preds = %entry @@ -77,10 +77,10 @@ typeassert.next: ; preds = %typeassert.ok, %ent ret i1 %typecode } -declare i1 @runtime.typeAssert(i32, i8* dereferenceable_or_null(1), i8*, i8*) +declare i1 @runtime.typeAssert(i32, i8* dereferenceable_or_null(1), i8*) ; Function Attrs: nounwind -define hidden i1 @main.isError(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.isError(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: %0 = call i1 @"interface:{Error:func:{}{basic:string}}.$typeassert"(i32 %itf.typecode) #0 br i1 %0, label %typeassert.ok, label %typeassert.next @@ -93,7 +93,7 @@ typeassert.next: ; preds = %typeassert.ok, %ent } ; Function Attrs: nounwind -define hidden i1 @main.isStringer(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.isStringer(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: %0 = call i1 @"interface:{String:func:{}{basic:string}}.$typeassert"(i32 %itf.typecode) #0 br i1 %0, label %typeassert.ok, label %typeassert.next @@ -106,24 +106,24 @@ typeassert.next: ; preds = %typeassert.ok, %ent } ; Function Attrs: nounwind -define hidden i8 @main.callFooMethod(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8 @main.callFooMethod(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: - %0 = call i8 @"interface:{String:func:{}{basic:string},main.foo:func:{basic:int}{basic:uint8}}.foo$invoke"(i8* %itf.value, i32 3, i32 %itf.typecode, i8* undef, i8* undef) #0 + %0 = call i8 @"interface:{String:func:{}{basic:string},main.foo:func:{basic:int}{basic:uint8}}.foo$invoke"(i8* %itf.value, i32 3, i32 %itf.typecode, i8* undef) #0 ret i8 %0 } -declare i8 @"interface:{String:func:{}{basic:string},main.foo:func:{basic:int}{basic:uint8}}.foo$invoke"(i8*, i32, i32, i8*, i8*) #3 +declare i8 @"interface:{String:func:{}{basic:string},main.foo:func:{basic:int}{basic:uint8}}.foo$invoke"(i8*, i32, i32, i8*) #3 ; Function Attrs: nounwind -define hidden %runtime._string @main.callErrorMethod(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._string @main.callErrorMethod(i32 %itf.typecode, i8* %itf.value, i8* %context) unnamed_addr #0 { entry: - %0 = call %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(i8* %itf.value, i32 %itf.typecode, i8* undef, i8* undef) #0 + %0 = call %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(i8* %itf.value, i32 %itf.typecode, i8* undef) #0 %1 = extractvalue %runtime._string %0, 0 - call void @runtime.trackPointer(i8* %1, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %1, i8* undef) #0 ret %runtime._string %0 } -declare %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(i8*, i32, i8*, i8*) #4 +declare %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(i8*, i32, i8*) #4 attributes #0 = { nounwind } attributes #1 = { "tinygo-methods"="reflect/methods.Error() string" } diff --git a/compiler/testdata/intrinsics-cortex-m-qemu.ll b/compiler/testdata/intrinsics-cortex-m-qemu.ll index cc088a6a8..d88da5ae7 100644 --- a/compiler/testdata/intrinsics-cortex-m-qemu.ll +++ b/compiler/testdata/intrinsics-cortex-m-qemu.ll @@ -3,30 +3,30 @@ source_filename = "intrinsics.go" target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "thumbv7m-unknown-unknown-eabi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden double @main.mySqrt(double %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden double @main.mySqrt(double %x, i8* %context) unnamed_addr #0 { entry: - %0 = call double @math.Sqrt(double %x, i8* undef, i8* undef) #0 + %0 = call double @math.Sqrt(double %x, i8* undef) #0 ret double %0 } -declare double @math.Sqrt(double, i8*, i8*) +declare double @math.Sqrt(double, i8*) ; Function Attrs: nounwind -define hidden double @main.myTrunc(double %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden double @main.myTrunc(double %x, i8* %context) unnamed_addr #0 { entry: - %0 = call double @math.Trunc(double %x, i8* undef, i8* undef) #0 + %0 = call double @math.Trunc(double %x, i8* undef) #0 ret double %0 } -declare double @math.Trunc(double, i8*, i8*) +declare double @math.Trunc(double, i8*) attributes #0 = { nounwind } diff --git a/compiler/testdata/intrinsics-wasm.ll b/compiler/testdata/intrinsics-wasm.ll index e24e61c30..bf1069e89 100644 --- a/compiler/testdata/intrinsics-wasm.ll +++ b/compiler/testdata/intrinsics-wasm.ll @@ -3,18 +3,18 @@ source_filename = "intrinsics.go" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-wasi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden double @main.mySqrt(double %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden double @main.mySqrt(double %x, i8* %context) unnamed_addr #0 { entry: %0 = call double @llvm.sqrt.f64(double %x) ret double %0 @@ -24,7 +24,7 @@ entry: declare double @llvm.sqrt.f64(double) #1 ; Function Attrs: nounwind -define hidden double @main.myTrunc(double %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden double @main.myTrunc(double %x, i8* %context) unnamed_addr #0 { entry: %0 = call double @llvm.trunc.f64(double %x) ret double %0 diff --git a/compiler/testdata/pointer.ll b/compiler/testdata/pointer.ll index e236db83d..0ce68e214 100644 --- a/compiler/testdata/pointer.ll +++ b/compiler/testdata/pointer.ll @@ -3,75 +3,75 @@ source_filename = "pointer.go" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-wasi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden [0 x i32] @main.pointerDerefZero([0 x i32]* %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden [0 x i32] @main.pointerDerefZero([0 x i32]* %x, i8* %context) unnamed_addr #0 { entry: ret [0 x i32] zeroinitializer } ; Function Attrs: nounwind -define hidden i32* @main.pointerCastFromUnsafe(i8* %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32* @main.pointerCastFromUnsafe(i8* %x, i8* %context) unnamed_addr #0 { entry: %0 = bitcast i8* %x to i32* - call void @runtime.trackPointer(i8* %x, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %x, i8* undef) #0 ret i32* %0 } ; Function Attrs: nounwind -define hidden i8* @main.pointerCastToUnsafe(i32* dereferenceable_or_null(4) %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8* @main.pointerCastToUnsafe(i32* dereferenceable_or_null(4) %x, i8* %context) unnamed_addr #0 { entry: %0 = bitcast i32* %x to i8* - call void @runtime.trackPointer(i8* %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %0, i8* undef) #0 ret i8* %0 } ; Function Attrs: nounwind -define hidden i8* @main.pointerCastToUnsafeNoop(i8* dereferenceable_or_null(1) %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8* @main.pointerCastToUnsafeNoop(i8* dereferenceable_or_null(1) %x, i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* %x, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %x, i8* undef) #0 ret i8* %x } ; Function Attrs: nounwind -define hidden i8* @main.pointerUnsafeGEPFixedOffset(i8* dereferenceable_or_null(1) %ptr, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8* @main.pointerUnsafeGEPFixedOffset(i8* dereferenceable_or_null(1) %ptr, i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* %ptr, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %ptr, i8* undef) #0 %0 = getelementptr inbounds i8, i8* %ptr, i32 10 - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0 ret i8* %0 } ; Function Attrs: nounwind -define hidden i8* @main.pointerUnsafeGEPByteOffset(i8* dereferenceable_or_null(1) %ptr, i32 %offset, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8* @main.pointerUnsafeGEPByteOffset(i8* dereferenceable_or_null(1) %ptr, i32 %offset, i8* %context) unnamed_addr #0 { entry: - call void @runtime.trackPointer(i8* %ptr, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %ptr, i8* undef) #0 %0 = getelementptr inbounds i8, i8* %ptr, i32 %offset - call void @runtime.trackPointer(i8* %0, i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %0, i8* undef) #0 + call void @runtime.trackPointer(i8* %0, i8* undef) #0 ret i8* %0 } ; Function Attrs: nounwind -define hidden i32* @main.pointerUnsafeGEPIntOffset(i32* dereferenceable_or_null(4) %ptr, i32 %offset, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32* @main.pointerUnsafeGEPIntOffset(i32* dereferenceable_or_null(4) %ptr, i32 %offset, i8* %context) unnamed_addr #0 { entry: %0 = bitcast i32* %ptr to i8* - call void @runtime.trackPointer(i8* %0, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %0, i8* undef) #0 %1 = getelementptr i32, i32* %ptr, i32 %offset %2 = bitcast i32* %1 to i8* - call void @runtime.trackPointer(i8* %2, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %2, i8* undef) #0 %3 = bitcast i32* %1 to i8* - call void @runtime.trackPointer(i8* %3, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %3, i8* undef) #0 ret i32* %1 } diff --git a/compiler/testdata/pragma.ll b/compiler/testdata/pragma.ll index ee189c3f5..8d1e3a42f 100644 --- a/compiler/testdata/pragma.ll +++ b/compiler/testdata/pragma.ll @@ -10,12 +10,12 @@ target triple = "wasm32-unknown-wasi" @undefinedGlobalNotInSection = external global i32, align 4 @main.multipleGlobalPragmas = hidden global i32 0, section ".global_section", align 1024 -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } @@ -27,27 +27,27 @@ entry: } ; Function Attrs: nounwind -define hidden void @somepkg.someFunction1(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @somepkg.someFunction1(i8* %context) unnamed_addr #0 { entry: ret void } -declare void @somepkg.someFunction2(i8*, i8*) +declare void @somepkg.someFunction2(i8*) ; Function Attrs: inlinehint nounwind -define hidden void @main.inlineFunc(i8* %context, i8* %parentHandle) unnamed_addr #2 { +define hidden void @main.inlineFunc(i8* %context) unnamed_addr #2 { entry: ret void } ; Function Attrs: noinline nounwind -define hidden void @main.noinlineFunc(i8* %context, i8* %parentHandle) unnamed_addr #3 { +define hidden void @main.noinlineFunc(i8* %context) unnamed_addr #3 { entry: ret void } ; Function Attrs: nounwind -define hidden void @main.functionInSection(i8* %context, i8* %parentHandle) unnamed_addr #0 section ".special_function_section" { +define hidden void @main.functionInSection(i8* %context) unnamed_addr #0 section ".special_function_section" { entry: ret void } @@ -58,7 +58,7 @@ entry: ret void } -declare void @main.undefinedFunctionNotInSection(i8*, i8*) +declare void @main.undefinedFunctionNotInSection(i8*) attributes #0 = { nounwind } attributes #1 = { nounwind "wasm-export-name"="extern_func" } diff --git a/compiler/testdata/slice.ll b/compiler/testdata/slice.ll index 98d2b1287..514b4e4f3 100644 --- a/compiler/testdata/slice.ll +++ b/compiler/testdata/slice.ll @@ -3,36 +3,36 @@ source_filename = "slice.go" target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-wasi" -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden i32 @main.sliceLen(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.sliceLen(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i8* %context) unnamed_addr #0 { entry: ret i32 %ints.len } ; Function Attrs: nounwind -define hidden i32 @main.sliceCap(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.sliceCap(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i8* %context) unnamed_addr #0 { entry: ret i32 %ints.cap } ; Function Attrs: nounwind -define hidden i32 @main.sliceElement(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i32 %index, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.sliceElement(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i32 %index, i8* %context) unnamed_addr #0 { entry: %.not = icmp ult i32 %index, %ints.len br i1 %.not, label %lookup.next, label %lookup.throw lookup.throw: ; preds = %entry - call void @runtime.lookupPanic(i8* undef, i8* null) #0 + call void @runtime.lookupPanic(i8* undef) #0 unreachable lookup.next: ; preds = %entry @@ -41,13 +41,13 @@ lookup.next: ; preds = %entry ret i32 %1 } -declare void @runtime.lookupPanic(i8*, i8*) +declare void @runtime.lookupPanic(i8*) ; Function Attrs: nounwind -define hidden { i32*, i32, i32 } @main.sliceAppendValues(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32*, i32, i32 } @main.sliceAppendValues(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i8* %context) unnamed_addr #0 { entry: - %varargs = call i8* @runtime.alloc(i32 12, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 - call void @runtime.trackPointer(i8* nonnull %varargs, i8* undef, i8* null) #0 + %varargs = call i8* @runtime.alloc(i32 12, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 + call void @runtime.trackPointer(i8* nonnull %varargs, i8* undef) #0 %0 = bitcast i8* %varargs to i32* store i32 1, i32* %0, align 4 %1 = getelementptr inbounds i8, i8* %varargs, i32 4 @@ -57,7 +57,7 @@ entry: %4 = bitcast i8* %3 to i32* store i32 3, i32* %4, align 4 %append.srcPtr = bitcast i32* %ints.data to i8* - %append.new = call { i8*, i32, i32 } @runtime.sliceAppend(i8* %append.srcPtr, i8* nonnull %varargs, i32 %ints.len, i32 %ints.cap, i32 3, i32 4, i8* undef, i8* null) #0 + %append.new = call { i8*, i32, i32 } @runtime.sliceAppend(i8* %append.srcPtr, i8* nonnull %varargs, i32 %ints.len, i32 %ints.cap, i32 3, i32 4, i8* undef) #0 %append.newPtr = extractvalue { i8*, i32, i32 } %append.new, 0 %append.newBuf = bitcast i8* %append.newPtr to i32* %append.newLen = extractvalue { i8*, i32, i32 } %append.new, 1 @@ -65,18 +65,18 @@ entry: %5 = insertvalue { i32*, i32, i32 } undef, i32* %append.newBuf, 0 %6 = insertvalue { i32*, i32, i32 } %5, i32 %append.newLen, 1 %7 = insertvalue { i32*, i32, i32 } %6, i32 %append.newCap, 2 - call void @runtime.trackPointer(i8* %append.newPtr, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %append.newPtr, i8* undef) #0 ret { i32*, i32, i32 } %7 } -declare { i8*, i32, i32 } @runtime.sliceAppend(i8*, i8* nocapture readonly, i32, i32, i32, i32, i8*, i8*) +declare { i8*, i32, i32 } @runtime.sliceAppend(i8*, i8* nocapture readonly, i32, i32, i32, i32, i8*) ; Function Attrs: nounwind -define hidden { i32*, i32, i32 } @main.sliceAppendSlice(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i32* %added.data, i32 %added.len, i32 %added.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32*, i32, i32 } @main.sliceAppendSlice(i32* %ints.data, i32 %ints.len, i32 %ints.cap, i32* %added.data, i32 %added.len, i32 %added.cap, i8* %context) unnamed_addr #0 { entry: %append.srcPtr = bitcast i32* %ints.data to i8* %append.srcPtr1 = bitcast i32* %added.data to i8* - %append.new = call { i8*, i32, i32 } @runtime.sliceAppend(i8* %append.srcPtr, i8* %append.srcPtr1, i32 %ints.len, i32 %ints.cap, i32 %added.len, i32 4, i8* undef, i8* null) #0 + %append.new = call { i8*, i32, i32 } @runtime.sliceAppend(i8* %append.srcPtr, i8* %append.srcPtr1, i32 %ints.len, i32 %ints.cap, i32 %added.len, i32 4, i8* undef) #0 %append.newPtr = extractvalue { i8*, i32, i32 } %append.new, 0 %append.newBuf = bitcast i8* %append.newPtr to i32* %append.newLen = extractvalue { i8*, i32, i32 } %append.new, 1 @@ -84,102 +84,102 @@ entry: %0 = insertvalue { i32*, i32, i32 } undef, i32* %append.newBuf, 0 %1 = insertvalue { i32*, i32, i32 } %0, i32 %append.newLen, 1 %2 = insertvalue { i32*, i32, i32 } %1, i32 %append.newCap, 2 - call void @runtime.trackPointer(i8* %append.newPtr, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* %append.newPtr, i8* undef) #0 ret { i32*, i32, i32 } %2 } ; Function Attrs: nounwind -define hidden i32 @main.sliceCopy(i32* %dst.data, i32 %dst.len, i32 %dst.cap, i32* %src.data, i32 %src.len, i32 %src.cap, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.sliceCopy(i32* %dst.data, i32 %dst.len, i32 %dst.cap, i32* %src.data, i32 %src.len, i32 %src.cap, i8* %context) unnamed_addr #0 { entry: %copy.dstPtr = bitcast i32* %dst.data to i8* %copy.srcPtr = bitcast i32* %src.data to i8* - %copy.n = call i32 @runtime.sliceCopy(i8* %copy.dstPtr, i8* %copy.srcPtr, i32 %dst.len, i32 %src.len, i32 4, i8* undef, i8* null) #0 + %copy.n = call i32 @runtime.sliceCopy(i8* %copy.dstPtr, i8* %copy.srcPtr, i32 %dst.len, i32 %src.len, i32 4, i8* undef) #0 ret i32 %copy.n } -declare i32 @runtime.sliceCopy(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i32, i8*, i8*) +declare i32 @runtime.sliceCopy(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i32, i8*) ; Function Attrs: nounwind -define hidden { i8*, i32, i32 } @main.makeByteSlice(i32 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i8*, i32, i32 } @main.makeByteSlice(i32 %len, i8* %context) unnamed_addr #0 { entry: %slice.maxcap = icmp slt i32 %len, 0 br i1 %slice.maxcap, label %slice.throw, label %slice.next slice.throw: ; preds = %entry - call void @runtime.slicePanic(i8* undef, i8* null) #0 + call void @runtime.slicePanic(i8* undef) #0 unreachable slice.next: ; preds = %entry - %makeslice.buf = call i8* @runtime.alloc(i32 %len, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 + %makeslice.buf = call i8* @runtime.alloc(i32 %len, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 %0 = insertvalue { i8*, i32, i32 } undef, i8* %makeslice.buf, 0 %1 = insertvalue { i8*, i32, i32 } %0, i32 %len, 1 %2 = insertvalue { i8*, i32, i32 } %1, i32 %len, 2 - call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef) #0 ret { i8*, i32, i32 } %2 } -declare void @runtime.slicePanic(i8*, i8*) +declare void @runtime.slicePanic(i8*) ; Function Attrs: nounwind -define hidden { i16*, i32, i32 } @main.makeInt16Slice(i32 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i16*, i32, i32 } @main.makeInt16Slice(i32 %len, i8* %context) unnamed_addr #0 { entry: %slice.maxcap = icmp slt i32 %len, 0 br i1 %slice.maxcap, label %slice.throw, label %slice.next slice.throw: ; preds = %entry - call void @runtime.slicePanic(i8* undef, i8* null) #0 + call void @runtime.slicePanic(i8* undef) #0 unreachable slice.next: ; preds = %entry %makeslice.cap = shl i32 %len, 1 - %makeslice.buf = call i8* @runtime.alloc(i32 %makeslice.cap, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 + %makeslice.buf = call i8* @runtime.alloc(i32 %makeslice.cap, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 %makeslice.array = bitcast i8* %makeslice.buf to i16* %0 = insertvalue { i16*, i32, i32 } undef, i16* %makeslice.array, 0 %1 = insertvalue { i16*, i32, i32 } %0, i32 %len, 1 %2 = insertvalue { i16*, i32, i32 } %1, i32 %len, 2 - call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef) #0 ret { i16*, i32, i32 } %2 } ; Function Attrs: nounwind -define hidden { [3 x i8]*, i32, i32 } @main.makeArraySlice(i32 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { [3 x i8]*, i32, i32 } @main.makeArraySlice(i32 %len, i8* %context) unnamed_addr #0 { entry: %slice.maxcap = icmp ugt i32 %len, 1431655765 br i1 %slice.maxcap, label %slice.throw, label %slice.next slice.throw: ; preds = %entry - call void @runtime.slicePanic(i8* undef, i8* null) #0 + call void @runtime.slicePanic(i8* undef) #0 unreachable slice.next: ; preds = %entry %makeslice.cap = mul i32 %len, 3 - %makeslice.buf = call i8* @runtime.alloc(i32 %makeslice.cap, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 + %makeslice.buf = call i8* @runtime.alloc(i32 %makeslice.cap, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 %makeslice.array = bitcast i8* %makeslice.buf to [3 x i8]* %0 = insertvalue { [3 x i8]*, i32, i32 } undef, [3 x i8]* %makeslice.array, 0 %1 = insertvalue { [3 x i8]*, i32, i32 } %0, i32 %len, 1 %2 = insertvalue { [3 x i8]*, i32, i32 } %1, i32 %len, 2 - call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef) #0 ret { [3 x i8]*, i32, i32 } %2 } ; Function Attrs: nounwind -define hidden { i32*, i32, i32 } @main.makeInt32Slice(i32 %len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden { i32*, i32, i32 } @main.makeInt32Slice(i32 %len, i8* %context) unnamed_addr #0 { entry: %slice.maxcap = icmp ugt i32 %len, 1073741823 br i1 %slice.maxcap, label %slice.throw, label %slice.next slice.throw: ; preds = %entry - call void @runtime.slicePanic(i8* undef, i8* null) #0 + call void @runtime.slicePanic(i8* undef) #0 unreachable slice.next: ; preds = %entry %makeslice.cap = shl i32 %len, 2 - %makeslice.buf = call i8* @runtime.alloc(i32 %makeslice.cap, i8* nonnull inttoptr (i32 3 to i8*), i8* undef, i8* null) #0 + %makeslice.buf = call i8* @runtime.alloc(i32 %makeslice.cap, i8* nonnull inttoptr (i32 3 to i8*), i8* undef) #0 %makeslice.array = bitcast i8* %makeslice.buf to i32* %0 = insertvalue { i32*, i32, i32 } undef, i32* %makeslice.array, 0 %1 = insertvalue { i32*, i32, i32 } %0, i32 %len, 1 %2 = insertvalue { i32*, i32, i32 } %1, i32 %len, 2 - call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef, i8* null) #0 + call void @runtime.trackPointer(i8* nonnull %makeslice.buf, i8* undef) #0 ret { i32*, i32, i32 } %2 } diff --git a/compiler/testdata/string.ll b/compiler/testdata/string.ll index ecbb6f0f5..da3556c4d 100644 --- a/compiler/testdata/string.ll +++ b/compiler/testdata/string.ll @@ -7,42 +7,42 @@ target triple = "wasm32-unknown-wasi" @"main$string" = internal unnamed_addr constant [3 x i8] c"foo", align 1 -declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*, i8*) +declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*) -declare void @runtime.trackPointer(i8* nocapture readonly, i8*, i8*) +declare void @runtime.trackPointer(i8* nocapture readonly, i8*) ; Function Attrs: nounwind -define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden void @main.init(i8* %context) unnamed_addr #0 { entry: ret void } ; Function Attrs: nounwind -define hidden %runtime._string @main.someString(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._string @main.someString(i8* %context) unnamed_addr #0 { entry: ret %runtime._string { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @"main$string", i32 0, i32 0), i32 3 } } ; Function Attrs: nounwind -define hidden %runtime._string @main.zeroLengthString(i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden %runtime._string @main.zeroLengthString(i8* %context) unnamed_addr #0 { entry: ret %runtime._string zeroinitializer } ; Function Attrs: nounwind -define hidden i32 @main.stringLen(i8* %s.data, i32 %s.len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i32 @main.stringLen(i8* %s.data, i32 %s.len, i8* %context) unnamed_addr #0 { entry: ret i32 %s.len } ; Function Attrs: nounwind -define hidden i8 @main.stringIndex(i8* %s.data, i32 %s.len, i32 %index, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8 @main.stringIndex(i8* %s.data, i32 %s.len, i32 %index, i8* %context) unnamed_addr #0 { entry: %.not = icmp ult i32 %index, %s.len br i1 %.not, label %lookup.next, label %lookup.throw lookup.throw: ; preds = %entry - call void @runtime.lookupPanic(i8* undef, i8* null) #0 + call void @runtime.lookupPanic(i8* undef) #0 unreachable lookup.next: ; preds = %entry @@ -51,43 +51,43 @@ lookup.next: ; preds = %entry ret i8 %1 } -declare void @runtime.lookupPanic(i8*, i8*) +declare void @runtime.lookupPanic(i8*) ; Function Attrs: nounwind -define hidden i1 @main.stringCompareEqual(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.stringCompareEqual(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* %context) unnamed_addr #0 { entry: - %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* undef, i8* null) #0 + %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* undef) #0 ret i1 %0 } -declare i1 @runtime.stringEqual(i8*, i32, i8*, i32, i8*, i8*) +declare i1 @runtime.stringEqual(i8*, i32, i8*, i32, i8*) ; Function Attrs: nounwind -define hidden i1 @main.stringCompareUnequal(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.stringCompareUnequal(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* %context) unnamed_addr #0 { entry: - %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* undef, i8* null) #0 + %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* undef) #0 %1 = xor i1 %0, true ret i1 %1 } ; Function Attrs: nounwind -define hidden i1 @main.stringCompareLarger(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i1 @main.stringCompareLarger(i8* %s1.data, i32 %s1.len, i8* %s2.data, i32 %s2.len, i8* %context) unnamed_addr #0 { entry: - %0 = call i1 @runtime.stringLess(i8* %s2.data, i32 %s2.len, i8* %s1.data, i32 %s1.len, i8* undef, i8* null) #0 + %0 = call i1 @runtime.stringLess(i8* %s2.data, i32 %s2.len, i8* %s1.data, i32 %s1.len, i8* undef) #0 ret i1 %0 } -declare i1 @runtime.stringLess(i8*, i32, i8*, i32, i8*, i8*) +declare i1 @runtime.stringLess(i8*, i32, i8*, i32, i8*) ; Function Attrs: nounwind -define hidden i8 @main.stringLookup(i8* %s.data, i32 %s.len, i8 %x, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define hidden i8 @main.stringLookup(i8* %s.data, i32 %s.len, i8 %x, i8* %context) unnamed_addr #0 { entry: %0 = zext i8 %x to i32 %.not = icmp ult i32 %0, %s.len br i1 %.not, label %lookup.next, label %lookup.throw lookup.throw: ; preds = %entry - call void @runtime.lookupPanic(i8* undef, i8* null) #0 + call void @runtime.lookupPanic(i8* undef) #0 unreachable lookup.next: ; preds = %entry diff --git a/interp/interp.go b/interp/interp.go index 3f5e9e506..9b9df8929 100644 --- a/interp/interp.go +++ b/interp/interp.go @@ -118,7 +118,7 @@ func Run(mod llvm.Module, debug bool) error { // Create a call to the package initializer (which was // previously deleted). i8undef := llvm.Undef(r.i8ptrType) - r.builder.CreateCall(fn, []llvm.Value{i8undef, i8undef}, "") + r.builder.CreateCall(fn, []llvm.Value{i8undef}, "") // Make sure that any globals touched by the package // initializer, won't be accessed by later package initializers. r.markExternalLoad(fn) diff --git a/interp/interpreter.go b/interp/interpreter.go index 694c42ce0..17ae02df7 100644 --- a/interp/interpreter.go +++ b/interp/interpreter.go @@ -444,7 +444,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent } // Load the type code of the interface value. - typecodeIDBitCast, err := operands[len(operands)-3].toLLVMValue(inst.llvmInst.Operand(len(operands)-4).Type(), &mem) + typecodeIDBitCast, err := operands[len(operands)-2].toLLVMValue(inst.llvmInst.Operand(len(operands)-3).Type(), &mem) if err != nil { return nil, mem, r.errorAt(inst, err) } @@ -492,7 +492,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent // Call a function with a definition available. Run it as usual, // possibly trying to recover from it if it failed to execute. if r.debug { - argStrings := make([]string, len(operands)-1) + argStrings := make([]string, len(operands)) for i := range argStrings { argStrings[i] = operands[i+1].String() } diff --git a/interp/testdata/revert.ll b/interp/testdata/revert.ll index c8929719b..dc6ee5c2a 100644 --- a/interp/testdata/revert.ll +++ b/interp/testdata/revert.ll @@ -13,27 +13,27 @@ declare void @externalCall(i64) define void @runtime.initAll() unnamed_addr { entry: - call void @baz.init(i8* undef, i8* undef) - call void @foo.init(i8* undef, i8* undef) - call void @bar.init(i8* undef, i8* undef) - call void @main.init(i8* undef, i8* undef) - call void @x.init(i8* undef, i8* undef) - call void @y.init(i8* undef, i8* undef) + call void @baz.init(i8* undef) + call void @foo.init(i8* undef) + call void @bar.init(i8* undef) + call void @main.init(i8* undef) + call void @x.init(i8* undef) + call void @y.init(i8* undef) ret void } -define internal void @foo.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal void @foo.init(i8* %context) unnamed_addr { store i64 5, i64* @foo.knownAtRuntime unreachable ; this triggers a revert of @foo.init. } -define internal void @bar.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal void @bar.init(i8* %context) unnamed_addr { %val = load i64, i64* @foo.knownAtRuntime store i64 %val, i64* @bar.knownAtRuntime ret void } -define internal void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal void @baz.init(i8* %context) unnamed_addr { ; Test extractvalue/insertvalue with more than one index. %val = load [3 x {i64, i32}], [3 x {i64, i32}]* @baz.someGlobal %part = extractvalue [3 x {i64, i32}] %val, 0, 1 @@ -41,14 +41,14 @@ define internal void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr { unreachable ; trigger revert } -define internal void @main.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal void @main.init(i8* %context) unnamed_addr { entry: call void @externalCall(i64 3) ret void } -define internal void @x.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal void @x.init(i8* %context) unnamed_addr { ; Test atomic and volatile memory accesses. store atomic i32 1, i32* @x.atomicNum seq_cst, align 4 %x = load atomic i32, i32* @x.atomicNum seq_cst, align 4 @@ -58,7 +58,7 @@ define internal void @x.init(i8* %context, i8* %parentHandle) unnamed_addr { ret void } -define internal void @y.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal void @y.init(i8* %context) unnamed_addr { entry: br label %loop diff --git a/interp/testdata/revert.out.ll b/interp/testdata/revert.out.ll index e8fc94858..030734d8e 100644 --- a/interp/testdata/revert.out.ll +++ b/interp/testdata/revert.out.ll @@ -13,8 +13,8 @@ declare void @externalCall(i64) local_unnamed_addr define void @runtime.initAll() unnamed_addr { entry: - call fastcc void @baz.init(i8* undef, i8* undef) - call fastcc void @foo.init(i8* undef, i8* undef) + call fastcc void @baz.init(i8* undef) + call fastcc void @foo.init(i8* undef) %val = load i64, i64* @foo.knownAtRuntime, align 8 store i64 %val, i64* @bar.knownAtRuntime, align 8 call void @externalCall(i64 3) @@ -23,20 +23,20 @@ entry: store i32 %x, i32* @x.atomicNum, align 4 %y = load volatile i32, i32* @x.volatileNum, align 4 store volatile i32 %y, i32* @x.volatileNum, align 4 - call fastcc void @y.init(i8* undef, i8* undef) + call fastcc void @y.init(i8* undef) ret void } -define internal fastcc void @foo.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal fastcc void @foo.init(i8* %context) unnamed_addr { store i64 5, i64* @foo.knownAtRuntime, align 8 unreachable } -define internal fastcc void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal fastcc void @baz.init(i8* %context) unnamed_addr { unreachable } -define internal fastcc void @y.init(i8* %context, i8* %parentHandle) unnamed_addr { +define internal fastcc void @y.init(i8* %context) unnamed_addr { entry: br label %loop diff --git a/transform/interface-lowering.go b/transform/interface-lowering.go index 2bc12ac83..d2d4b4f48 100644 --- a/transform/interface-lowering.go +++ b/transform/interface-lowering.go @@ -417,13 +417,11 @@ func (p *lowerInterfacesPass) defineInterfaceImplementsFunc(fn llvm.Value, itf * // possible types. This is later converted to a switch statement by the LLVM // simplifycfg pass. func (p *lowerInterfacesPass) defineInterfaceMethodFunc(fn llvm.Value, itf *interfaceInfo, signature *signatureInfo) { - parentHandle := fn.LastParam() - context := llvm.PrevParam(parentHandle) + context := fn.LastParam() actualType := llvm.PrevParam(context) returnType := fn.Type().ElementType().ReturnType() context.SetName("context") actualType.SetName("actualType") - parentHandle.SetName("parentHandle") fn.SetLinkage(llvm.InternalLinkage) fn.SetUnnamedAddr(true) AddStandardAttributes(fn, p.config) @@ -431,13 +429,12 @@ func (p *lowerInterfacesPass) defineInterfaceMethodFunc(fn llvm.Value, itf *inte // Collect the params that will be passed to the functions to call. // These params exclude the receiver (which may actually consist of multiple // parts). - params := make([]llvm.Value, fn.ParamsCount()-4) + params := make([]llvm.Value, fn.ParamsCount()-3) for i := range params { params[i] = fn.Param(i + 1) } params = append(params, llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)), - llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)), ) // Start chain in the entry block. @@ -519,7 +516,6 @@ func (p *lowerInterfacesPass) defineInterfaceMethodFunc(fn llvm.Value, itf *inte nilPanic := p.mod.NamedFunction("runtime.nilPanic") p.builder.CreateCall(nilPanic, []llvm.Value{ llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)), - llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)), }, "") p.builder.CreateUnreachable() } diff --git a/transform/interrupt.go b/transform/interrupt.go index 10548ef84..49ee6ee6d 100644 --- a/transform/interrupt.go +++ b/transform/interrupt.go @@ -27,7 +27,6 @@ func LowerInterrupts(mod llvm.Module) []error { var errs []error ctx := mod.Context() - i8ptrType := llvm.PointerType(ctx.Int8Type(), 0) builder := ctx.NewBuilder() defer builder.Dispose() @@ -95,7 +94,6 @@ func LowerInterrupts(mod llvm.Module) []error { builder.CreateCall(funcPtr, []llvm.Value{ num, context, - llvm.Undef(i8ptrType), }, "") } call.EraseFromParentAsInstruction() diff --git a/transform/testdata/interface.ll b/transform/testdata/interface.ll index 14ab6be86..4d8e818de 100644 --- a/transform/testdata/interface.ll +++ b/transform/testdata/interface.ll @@ -10,7 +10,7 @@ target triple = "armv7m-none-eabi" @"reflect/types.type:basic:int" = private constant %runtime.typecodeID zeroinitializer @"reflect/methods.NeverImplementedMethod()" = linkonce_odr constant i8 0 @"reflect/methods.Double() int" = linkonce_odr constant i8 0 -@"Number$methodset" = private constant [1 x %runtime.interfaceMethodInfo] [%runtime.interfaceMethodInfo { i8* @"reflect/methods.Double() int", i32 ptrtoint (i32 (i8*, i8*, i8*)* @"(Number).Double$invoke" to i32) }] +@"Number$methodset" = private constant [1 x %runtime.interfaceMethodInfo] [%runtime.interfaceMethodInfo { i8* @"reflect/methods.Double() int", i32 ptrtoint (i32 (i8*, i8*)* @"(Number).Double$invoke" to i32) }] @"reflect/types.type:named:Number" = private constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:basic:int", i32 0, %runtime.interfaceMethodInfo* getelementptr inbounds ([1 x %runtime.interfaceMethodInfo], [1 x %runtime.interfaceMethodInfo]* @"Number$methodset", i32 0, i32 0), %runtime.typecodeID* null, i32 0 } declare i1 @runtime.typeAssert(i32, i8*) @@ -19,7 +19,7 @@ declare void @runtime.printint16(i16) declare void @runtime.printint32(i32) declare void @runtime.printptr(i32) declare void @runtime.printnl() -declare void @runtime.nilPanic(i8*, i8*) +declare void @runtime.nilPanic(i8*) define void @printInterfaces() { call void @printInterface(i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* inttoptr (i32 5 to i8*)) @@ -44,7 +44,7 @@ typeswitch.notUnmatched: br i1 %isDoubler, label %typeswitch.Doubler, label %typeswitch.notDoubler typeswitch.Doubler: - %doubler.result = call i32 @"Doubler.Double$invoke"(i8* %value, i32 %typecode, i8* undef, i8* undef) + %doubler.result = call i32 @"Doubler.Double$invoke"(i8* %value, i32 %typecode, i8* undef) call void @runtime.printint32(i32 %doubler.result) ret void @@ -73,18 +73,18 @@ typeswitch.notInt16: ret void } -define i32 @"(Number).Double"(i32 %receiver, i8* %context, i8* %parentHandle) { +define i32 @"(Number).Double"(i32 %receiver, i8* %context) { %ret = mul i32 %receiver, 2 ret i32 %ret } -define i32 @"(Number).Double$invoke"(i8* %receiverPtr, i8* %context, i8* %parentHandle) { +define i32 @"(Number).Double$invoke"(i8* %receiverPtr, i8* %context) { %receiver = ptrtoint i8* %receiverPtr to i32 - %ret = call i32 @"(Number).Double"(i32 %receiver, i8* undef, i8* null) + %ret = call i32 @"(Number).Double"(i32 %receiver, i8* undef) ret i32 %ret } -declare i32 @"Doubler.Double$invoke"(i8* %receiver, i32 %typecode, i8* %context, i8* %parentHandle) #0 +declare i32 @"Doubler.Double$invoke"(i8* %receiver, i32 %typecode, i8* %context) #0 declare i1 @Doubler$typeassert(i32 %typecode) #1 diff --git a/transform/testdata/interface.out.ll b/transform/testdata/interface.out.ll index f0115c548..262df2108 100644 --- a/transform/testdata/interface.out.ll +++ b/transform/testdata/interface.out.ll @@ -18,7 +18,7 @@ declare void @runtime.printptr(i32) declare void @runtime.printnl() -declare void @runtime.nilPanic(i8*, i8*) +declare void @runtime.nilPanic(i8*) define void @printInterfaces() { call void @printInterface(i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* inttoptr (i32 5 to i8*)) @@ -42,7 +42,7 @@ typeswitch.notUnmatched: ; preds = %0 br i1 %isDoubler, label %typeswitch.Doubler, label %typeswitch.notDoubler typeswitch.Doubler: ; preds = %typeswitch.notUnmatched - %doubler.result = call i32 @"Doubler.Double$invoke"(i8* %value, i32 %typecode, i8* undef, i8* undef) + %doubler.result = call i32 @"Doubler.Double$invoke"(i8* %value, i32 %typecode, i8* undef) call void @runtime.printint32(i32 %doubler.result) ret void @@ -69,28 +69,28 @@ typeswitch.notInt16: ; preds = %typeswitch.notByte ret void } -define i32 @"(Number).Double"(i32 %receiver, i8* %context, i8* %parentHandle) { +define i32 @"(Number).Double"(i32 %receiver, i8* %context) { %ret = mul i32 %receiver, 2 ret i32 %ret } -define i32 @"(Number).Double$invoke"(i8* %receiverPtr, i8* %context, i8* %parentHandle) { +define i32 @"(Number).Double$invoke"(i8* %receiverPtr, i8* %context) { %receiver = ptrtoint i8* %receiverPtr to i32 - %ret = call i32 @"(Number).Double"(i32 %receiver, i8* undef, i8* null) + %ret = call i32 @"(Number).Double"(i32 %receiver, i8* undef) ret i32 %ret } -define internal i32 @"Doubler.Double$invoke"(i8* %receiver, i32 %actualType, i8* %context, i8* %parentHandle) unnamed_addr #0 { +define internal i32 @"Doubler.Double$invoke"(i8* %receiver, i32 %actualType, i8* %context) unnamed_addr #0 { entry: %"named:Number.icmp" = icmp eq i32 %actualType, ptrtoint (%runtime.typecodeID* @"reflect/types.type:named:Number" to i32) br i1 %"named:Number.icmp", label %"named:Number", label %"named:Number.next" "named:Number": ; preds = %entry - %0 = call i32 @"(Number).Double$invoke"(i8* %receiver, i8* undef, i8* undef) + %0 = call i32 @"(Number).Double$invoke"(i8* %receiver, i8* undef) ret i32 %0 "named:Number.next": ; preds = %entry - call void @runtime.nilPanic(i8* undef, i8* undef) + call void @runtime.nilPanic(i8* undef) unreachable } diff --git a/transform/testdata/interrupt.ll b/transform/testdata/interrupt.ll index e46fbe6fa..1436827b0 100644 --- a/transform/testdata/interrupt.ll +++ b/transform/testdata/interrupt.ll @@ -7,33 +7,33 @@ target triple = "armv7em-none-eabi" %"runtime/interrupt.handle" = type { i8*, i32, %"runtime/interrupt.Interrupt" } %"runtime/interrupt.Interrupt" = type { i32 } -@"runtime/interrupt.$interrupt2" = private unnamed_addr constant %"runtime/interrupt.handle" { i8* bitcast (%machine.UART* @machine.UART0 to i8*), i32 ptrtoint (void (i32, i8*, i8*)* @"(*machine.UART).handleInterrupt$bound" to i32), %"runtime/interrupt.Interrupt" { i32 2 } } +@"runtime/interrupt.$interrupt2" = private unnamed_addr constant %"runtime/interrupt.handle" { i8* bitcast (%machine.UART* @machine.UART0 to i8*), i32 ptrtoint (void (i32, i8*)* @"(*machine.UART).handleInterrupt$bound" to i32), %"runtime/interrupt.Interrupt" { i32 2 } } @machine.UART0 = internal global %machine.UART { %machine.RingBuffer* @"machine$alloc.335" } @"machine$alloc.335" = internal global %machine.RingBuffer zeroinitializer -declare void @"runtime/interrupt.callHandlers"(i32, i8*, i8*) local_unnamed_addr +declare void @"runtime/interrupt.callHandlers"(i32, i8*) local_unnamed_addr -declare void @"device/arm.EnableIRQ"(i32, i8* nocapture readnone, i8* nocapture readnone) +declare void @"device/arm.EnableIRQ"(i32, i8* nocapture readnone) -declare void @"device/arm.SetPriority"(i32, i32, i8* nocapture readnone, i8* nocapture readnone) +declare void @"device/arm.SetPriority"(i32, i32, i8* nocapture readnone) declare void @"runtime/interrupt.use"(%"runtime/interrupt.Interrupt") -define void @runtime.initAll(i8* nocapture readnone, i8* nocapture readnone) unnamed_addr { +define void @runtime.initAll(i8* nocapture readnone) unnamed_addr { entry: - call void @"device/arm.SetPriority"(i32 ptrtoint (%"runtime/interrupt.handle"* @"runtime/interrupt.$interrupt2" to i32), i32 192, i8* undef, i8* undef) - call void @"device/arm.EnableIRQ"(i32 ptrtoint (%"runtime/interrupt.handle"* @"runtime/interrupt.$interrupt2" to i32), i8* undef, i8* undef) + call void @"device/arm.SetPriority"(i32 ptrtoint (%"runtime/interrupt.handle"* @"runtime/interrupt.$interrupt2" to i32), i32 192, i8* undef) + call void @"device/arm.EnableIRQ"(i32 ptrtoint (%"runtime/interrupt.handle"* @"runtime/interrupt.$interrupt2" to i32), i8* undef) call void @"runtime/interrupt.use"(%"runtime/interrupt.Interrupt" { i32 ptrtoint (%"runtime/interrupt.handle"* @"runtime/interrupt.$interrupt2" to i32) }) ret void } define void @UARTE0_UART0_IRQHandler() { - call void @"runtime/interrupt.callHandlers"(i32 2, i8* undef, i8* undef) + call void @"runtime/interrupt.callHandlers"(i32 2, i8* undef) ret void } define void @NFCT_IRQHandler() { - call void @"runtime/interrupt.callHandlers"(i32 5, i8* undef, i8* undef) + call void @"runtime/interrupt.callHandlers"(i32 5, i8* undef) ret void } @@ -45,22 +45,22 @@ entry: ] switch.body2: - call void @"runtime/interrupt.callHandlers"(i32 2, i8* undef, i8* undef) + call void @"runtime/interrupt.callHandlers"(i32 2, i8* undef) ret void switch.body5: - call void @"runtime/interrupt.callHandlers"(i32 5, i8* undef, i8* undef) + call void @"runtime/interrupt.callHandlers"(i32 5, i8* undef) ret void switch.done: ret void } -define internal void @"(*machine.UART).handleInterrupt$bound"(i32, i8* nocapture %context, i8* nocapture readnone %parentHandle) { +define internal void @"(*machine.UART).handleInterrupt$bound"(i32, i8* nocapture %context) { entry: %unpack.ptr = bitcast i8* %context to %machine.UART* - call void @"(*machine.UART).handleInterrupt"(%machine.UART* %unpack.ptr, i32 %0, i8* undef, i8* undef) + call void @"(*machine.UART).handleInterrupt"(%machine.UART* %unpack.ptr, i32 %0, i8* undef) ret void } -declare void @"(*machine.UART).handleInterrupt"(%machine.UART* nocapture, i32, i8* nocapture readnone, i8* nocapture readnone) +declare void @"(*machine.UART).handleInterrupt"(%machine.UART* nocapture, i32, i8* nocapture readnone) diff --git a/transform/testdata/interrupt.out.ll b/transform/testdata/interrupt.out.ll index 78f52ff66..7eb9f0a87 100644 --- a/transform/testdata/interrupt.out.ll +++ b/transform/testdata/interrupt.out.ll @@ -9,23 +9,23 @@ target triple = "armv7em-none-eabi" @machine.UART0 = internal global %machine.UART { %machine.RingBuffer* @"machine$alloc.335" } @"machine$alloc.335" = internal global %machine.RingBuffer zeroinitializer -declare void @"runtime/interrupt.callHandlers"(i32, i8*, i8*) local_unnamed_addr +declare void @"runtime/interrupt.callHandlers"(i32, i8*) local_unnamed_addr -declare void @"device/arm.EnableIRQ"(i32, i8* nocapture readnone, i8* nocapture readnone) +declare void @"device/arm.EnableIRQ"(i32, i8* nocapture readnone) -declare void @"device/arm.SetPriority"(i32, i32, i8* nocapture readnone, i8* nocapture readnone) +declare void @"device/arm.SetPriority"(i32, i32, i8* nocapture readnone) declare void @"runtime/interrupt.use"(%"runtime/interrupt.Interrupt") -define void @runtime.initAll(i8* nocapture readnone %0, i8* nocapture readnone %1) unnamed_addr { +define void @runtime.initAll(i8* nocapture readnone %0) unnamed_addr { entry: - call void @"device/arm.SetPriority"(i32 2, i32 192, i8* undef, i8* undef) - call void @"device/arm.EnableIRQ"(i32 2, i8* undef, i8* undef) + call void @"device/arm.SetPriority"(i32 2, i32 192, i8* undef) + call void @"device/arm.EnableIRQ"(i32 2, i8* undef) ret void } define void @UARTE0_UART0_IRQHandler() { - call void @"(*machine.UART).handleInterrupt$bound"(i32 2, i8* bitcast (%machine.UART* @machine.UART0 to i8*), i8* undef) + call void @"(*machine.UART).handleInterrupt$bound"(i32 2, i8* bitcast (%machine.UART* @machine.UART0 to i8*)) ret void } @@ -37,7 +37,7 @@ entry: ] switch.body2: ; preds = %entry - call void @"(*machine.UART).handleInterrupt$bound"(i32 2, i8* bitcast (%machine.UART* @machine.UART0 to i8*), i8* undef) + call void @"(*machine.UART).handleInterrupt$bound"(i32 2, i8* bitcast (%machine.UART* @machine.UART0 to i8*)) ret void switch.body5: ; preds = %entry @@ -47,11 +47,11 @@ switch.done: ; preds = %entry ret void } -define internal void @"(*machine.UART).handleInterrupt$bound"(i32 %0, i8* nocapture %context, i8* nocapture readnone %parentHandle) { +define internal void @"(*machine.UART).handleInterrupt$bound"(i32 %0, i8* nocapture %context) { entry: %unpack.ptr = bitcast i8* %context to %machine.UART* - call void @"(*machine.UART).handleInterrupt"(%machine.UART* %unpack.ptr, i32 %0, i8* undef, i8* undef) + call void @"(*machine.UART).handleInterrupt"(%machine.UART* %unpack.ptr, i32 %0, i8* undef) ret void } -declare void @"(*machine.UART).handleInterrupt"(%machine.UART* nocapture, i32, i8* nocapture readnone, i8* nocapture readnone) +declare void @"(*machine.UART).handleInterrupt"(%machine.UART* nocapture, i32, i8* nocapture readnone) diff --git a/transform/testdata/reflect-implements.ll b/transform/testdata/reflect-implements.ll index a76302209..ca6dcb8c5 100644 --- a/transform/testdata/reflect-implements.ll +++ b/transform/testdata/reflect-implements.ll @@ -22,9 +22,9 @@ target triple = "i686--linux" ; The type itself is stored in %typ.value, %typ.typecode just refers to the ; type of reflect.Type. This function can be optimized because errorType is ; known at compile time (after the interp pass has run). -define i1 @main.isError(i32 %typ.typecode, i8* %typ.value, i8* %context, i8* %parentHandle) { +define i1 @main.isError(i32 %typ.typecode, i8* %typ.value, i8* %context) { entry: - %result = call i1 @"reflect.Type.Implements$invoke"(i8* %typ.value, i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:named:reflect.rawType" to i32), i8* bitcast (%runtime.typecodeID* @"reflect/types.type:named:error" to i8*), i32 %typ.typecode, i8* undef, i8* undef) + %result = call i1 @"reflect.Type.Implements$invoke"(i8* %typ.value, i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:named:reflect.rawType" to i32), i8* bitcast (%runtime.typecodeID* @"reflect/types.type:named:error" to i8*), i32 %typ.typecode, i8* undef) ret i1 %result } @@ -33,13 +33,13 @@ entry: ; func isUnknown(typ, itf reflect.Type) bool { ; return typ.Implements(itf) ; } -define i1 @main.isUnknown(i32 %typ.typecode, i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) { +define i1 @main.isUnknown(i32 %typ.typecode, i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i8* %context) { entry: - %result = call i1 @"reflect.Type.Implements$invoke"(i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i32 %typ.typecode, i8* undef, i8* undef) + %result = call i1 @"reflect.Type.Implements$invoke"(i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i32 %typ.typecode, i8* undef) ret i1 %result } -declare i1 @"reflect.Type.Implements$invoke"(i8*, i32, i8*, i32, i8*, i8*) #0 +declare i1 @"reflect.Type.Implements$invoke"(i8*, i32, i8*, i32, i8*) #0 declare i1 @"error.$typeassert"(i32) #1 attributes #0 = { "tinygo-invoke"="reflect/methods.Implements(reflect.Type) bool" "tinygo-methods"="reflect/methods.Align() int; reflect/methods.Implements(reflect.Type) bool" } diff --git a/transform/testdata/reflect-implements.out.ll b/transform/testdata/reflect-implements.out.ll index 70199ef5d..0093e2b0a 100644 --- a/transform/testdata/reflect-implements.out.ll +++ b/transform/testdata/reflect-implements.out.ll @@ -15,20 +15,20 @@ target triple = "i686--linux" @"reflect.rawType$methodset" = linkonce_odr constant [20 x %runtime.interfaceMethodInfo] zeroinitializer @"reflect/types.type:basic:uintptr" = linkonce_odr constant %runtime.typecodeID zeroinitializer -define i1 @main.isError(i32 %typ.typecode, i8* %typ.value, i8* %context, i8* %parentHandle) { +define i1 @main.isError(i32 %typ.typecode, i8* %typ.value, i8* %context) { entry: %0 = ptrtoint i8* %typ.value to i32 %1 = call i1 @"error.$typeassert"(i32 %0) ret i1 %1 } -define i1 @main.isUnknown(i32 %typ.typecode, i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) { +define i1 @main.isUnknown(i32 %typ.typecode, i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i8* %context) { entry: - %result = call i1 @"reflect.Type.Implements$invoke"(i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i32 %typ.typecode, i8* undef, i8* undef) + %result = call i1 @"reflect.Type.Implements$invoke"(i8* %typ.value, i32 %itf.typecode, i8* %itf.value, i32 %typ.typecode, i8* undef) ret i1 %result } -declare i1 @"reflect.Type.Implements$invoke"(i8*, i32, i8*, i32, i8*, i8*) #0 +declare i1 @"reflect.Type.Implements$invoke"(i8*, i32, i8*, i32, i8*) #0 declare i1 @"error.$typeassert"(i32) #1 diff --git a/transform/testdata/stringequal.ll b/transform/testdata/stringequal.ll index 94a7d2000..d355fc45e 100644 --- a/transform/testdata/stringequal.ll +++ b/transform/testdata/stringequal.ll @@ -3,17 +3,17 @@ target triple = "armv7m-none-eabi" @zeroString = constant [0 x i8] zeroinitializer -declare i1 @runtime.stringEqual(i8*, i32, i8*, i32, i8*, i8*) +declare i1 @runtime.stringEqual(i8*, i32, i8*, i32, i8*) -define i1 @main.stringCompareEqualConstantZero(i8* %s1.data, i32 %s1.len, i8* %context, i8* %parentHandle) { +define i1 @main.stringCompareEqualConstantZero(i8* %s1.data, i32 %s1.len, i8* %context) { entry: - %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @zeroString, i32 0, i32 0), i32 0, i8* undef, i8* null) + %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @zeroString, i32 0, i32 0), i32 0, i8* undef) ret i1 %0 } -define i1 @main.stringCompareUnequalConstantZero(i8* %s1.data, i32 %s1.len, i8* %context, i8* %parentHandle) { +define i1 @main.stringCompareUnequalConstantZero(i8* %s1.data, i32 %s1.len, i8* %context) { entry: - %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @zeroString, i32 0, i32 0), i32 0, i8* undef, i8* null) + %0 = call i1 @runtime.stringEqual(i8* %s1.data, i32 %s1.len, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @zeroString, i32 0, i32 0), i32 0, i8* undef) %1 = xor i1 %0, true ret i1 %1 } diff --git a/transform/testdata/stringequal.out.ll b/transform/testdata/stringequal.out.ll index cde0092b2..d148c84fd 100644 --- a/transform/testdata/stringequal.out.ll +++ b/transform/testdata/stringequal.out.ll @@ -3,15 +3,15 @@ target triple = "armv7m-none-eabi" @zeroString = constant [0 x i8] zeroinitializer -declare i1 @runtime.stringEqual(i8*, i32, i8*, i32, i8*, i8*) +declare i1 @runtime.stringEqual(i8*, i32, i8*, i32, i8*) -define i1 @main.stringCompareEqualConstantZero(i8* %s1.data, i32 %s1.len, i8* %context, i8* %parentHandle) { +define i1 @main.stringCompareEqualConstantZero(i8* %s1.data, i32 %s1.len, i8* %context) { entry: %0 = icmp eq i32 %s1.len, 0 ret i1 %0 } -define i1 @main.stringCompareUnequalConstantZero(i8* %s1.data, i32 %s1.len, i8* %context, i8* %parentHandle) { +define i1 @main.stringCompareUnequalConstantZero(i8* %s1.data, i32 %s1.len, i8* %context) { entry: %0 = icmp eq i32 %s1.len, 0 %1 = xor i1 %0, true |