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.
Этот коммит содержится в:
родитель
0c2fefa09b
коммит
c6ae1c58fc
38 изменённых файлов: 443 добавлений и 487 удалений
|
@ -428,7 +428,6 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
|
||||||
llvmInitFn.SetUnnamedAddr(true)
|
llvmInitFn.SetUnnamedAddr(true)
|
||||||
transform.AddStandardAttributes(llvmInitFn, config)
|
transform.AddStandardAttributes(llvmInitFn, config)
|
||||||
llvmInitFn.Param(0).SetName("context")
|
llvmInitFn.Param(0).SetName("context")
|
||||||
llvmInitFn.Param(1).SetName("parentHandle")
|
|
||||||
block := mod.Context().AddBasicBlock(llvmInitFn, "entry")
|
block := mod.Context().AddBasicBlock(llvmInitFn, "entry")
|
||||||
irbuilder := mod.Context().NewBuilder()
|
irbuilder := mod.Context().NewBuilder()
|
||||||
defer irbuilder.Dispose()
|
defer irbuilder.Dispose()
|
||||||
|
@ -439,7 +438,7 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
|
||||||
if pkgInit.IsNil() {
|
if pkgInit.IsNil() {
|
||||||
panic("init not found for " + pkg.Pkg.Path())
|
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()
|
irbuilder.CreateRetVoid()
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,7 @@ func (b *builder) createRuntimeCall(fnName string, args []llvm.Value, name strin
|
||||||
if llvmFn.IsNil() {
|
if llvmFn.IsNil() {
|
||||||
panic("trying to call non-existent function: " + fn.RelString(nil))
|
panic("trying to call non-existent function: " + fn.RelString(nil))
|
||||||
}
|
}
|
||||||
args = append(args, llvm.Undef(b.i8ptrType)) // unused context parameter
|
args = append(args, llvm.Undef(b.i8ptrType)) // unused context parameter
|
||||||
args = append(args, llvm.ConstPointerNull(b.i8ptrType)) // coroutine handle
|
|
||||||
return b.createCall(llvmFn, args, name)
|
return b.createCall(llvmFn, args, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -967,9 +967,7 @@ func (b *builder) createFunction() {
|
||||||
// method).
|
// method).
|
||||||
var context llvm.Value
|
var context llvm.Value
|
||||||
if !b.info.exported {
|
if !b.info.exported {
|
||||||
parentHandle := b.llvmFn.LastParam()
|
context = b.llvmFn.LastParam()
|
||||||
parentHandle.SetName("parentHandle")
|
|
||||||
context = llvm.PrevParam(parentHandle)
|
|
||||||
context.SetName("context")
|
context.SetName("context")
|
||||||
}
|
}
|
||||||
if len(b.fn.FreeVars) != 0 {
|
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.
|
// This function takes a context parameter.
|
||||||
// Add it to the end of the parameter list.
|
// Add it to the end of the parameter list.
|
||||||
params = append(params, context)
|
params = append(params, context)
|
||||||
|
|
||||||
// Parent coroutine handle.
|
|
||||||
params = append(params, llvm.Undef(b.i8ptrType))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return b.createCall(callee, params, ""), nil
|
return b.createCall(callee, params, ""), nil
|
||||||
|
|
|
@ -343,9 +343,6 @@ func (b *builder) createRunDefers() {
|
||||||
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parent coroutine handle.
|
|
||||||
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
|
||||||
|
|
||||||
b.createCall(fnPtr, forwardParams, "")
|
b.createCall(fnPtr, forwardParams, "")
|
||||||
|
|
||||||
case *ssa.Function:
|
case *ssa.Function:
|
||||||
|
@ -374,9 +371,6 @@ func (b *builder) createRunDefers() {
|
||||||
// Add the context parameter. We know it is ignored by the receiving
|
// Add the context parameter. We know it is ignored by the receiving
|
||||||
// function, but we have to pass one anyway.
|
// function, but we have to pass one anyway.
|
||||||
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
||||||
|
|
||||||
// Parent coroutine handle.
|
|
||||||
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call real function.
|
// Call real function.
|
||||||
|
@ -403,9 +397,6 @@ func (b *builder) createRunDefers() {
|
||||||
forwardParams = append(forwardParams, forwardParam)
|
forwardParams = append(forwardParams, forwardParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parent coroutine handle.
|
|
||||||
forwardParams = append(forwardParams, llvm.Undef(b.i8ptrType))
|
|
||||||
|
|
||||||
// Call deferred function.
|
// Call deferred function.
|
||||||
b.createCall(b.getFunction(fn), forwardParams, "")
|
b.createCall(b.getFunction(fn), forwardParams, "")
|
||||||
case *ssa.Builtin:
|
case *ssa.Builtin:
|
||||||
|
|
|
@ -115,7 +115,6 @@ func (c *compilerContext) getRawFuncType(typ *types.Signature) llvm.Type {
|
||||||
}
|
}
|
||||||
// All functions take these parameters at the end.
|
// All functions take these parameters at the end.
|
||||||
paramTypes = append(paramTypes, c.i8ptrType) // context
|
paramTypes = append(paramTypes, c.i8ptrType) // context
|
||||||
paramTypes = append(paramTypes, c.i8ptrType) // parent coroutine
|
|
||||||
|
|
||||||
// Make a func type out of the signature.
|
// Make a func type out of the signature.
|
||||||
return llvm.PointerType(llvm.FunctionType(returnType, paramTypes, false), c.funcPtrAddrSpace)
|
return llvm.PointerType(llvm.FunctionType(returnType, paramTypes, false), c.funcPtrAddrSpace)
|
||||||
|
|
|
@ -90,17 +90,8 @@ func (b *builder) createGo(instr *ssa.Go) {
|
||||||
// * The function pointer (for tasks).
|
// * The function pointer (for tasks).
|
||||||
var context llvm.Value
|
var context llvm.Value
|
||||||
funcPtr, context = b.decodeFuncValue(b.getValue(instr.Call.Value), instr.Call.Value.Type().Underlying().(*types.Signature))
|
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
|
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)
|
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
|
// section that contains the stack size (and is modified after
|
||||||
// linking).
|
// linking).
|
||||||
stackSizeFn := b.getFunction(b.program.ImportedPackage("internal/task").Members["getGoroutineStackSize"].(*ssa.Function))
|
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 {
|
} else {
|
||||||
// The stack size is fixed at compile time. By emitting it here as a
|
// The stack size is fixed at compile time. By emitting it here as a
|
||||||
// constant, it can be optimized.
|
// constant, it can be optimized.
|
||||||
|
@ -123,7 +114,7 @@ func (b *builder) createGo(instr *ssa.Go) {
|
||||||
stackSize = llvm.ConstInt(b.uintptrType, b.DefaultStackSize, false)
|
stackSize = llvm.ConstInt(b.uintptrType, b.DefaultStackSize, false)
|
||||||
}
|
}
|
||||||
start := b.getFunction(b.program.ImportedPackage("internal/task").Members["start"].(*ssa.Function))
|
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
|
// 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.
|
// Create the list of params for the call.
|
||||||
paramTypes := fn.Type().ElementType().ParamTypes()
|
paramTypes := fn.Type().ElementType().ParamTypes()
|
||||||
paramTypes = paramTypes[:len(paramTypes)-1] // strip parentHandle parameter
|
|
||||||
if !hasContext {
|
if !hasContext {
|
||||||
paramTypes = paramTypes[:len(paramTypes)-1] // strip context parameter
|
paramTypes = paramTypes[:len(paramTypes)-1] // strip context parameter
|
||||||
}
|
}
|
||||||
|
@ -210,14 +200,13 @@ func (c *compilerContext) createGoroutineStartWrapper(fn llvm.Value, prefix stri
|
||||||
if !hasContext {
|
if !hasContext {
|
||||||
params = append(params, llvm.Undef(c.i8ptrType)) // add dummy context parameter
|
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.
|
// Create the call.
|
||||||
builder.CreateCall(fn, params, "")
|
builder.CreateCall(fn, params, "")
|
||||||
|
|
||||||
if c.Scheduler == "asyncify" {
|
if c.Scheduler == "asyncify" {
|
||||||
builder.CreateCall(deadlock, []llvm.Value{
|
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.
|
// Get the list of parameters, with the extra parameters at the end.
|
||||||
paramTypes := fn.Type().ElementType().ParamTypes()
|
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)
|
params := llvmutil.EmitPointerUnpack(builder, c.mod, wrapper.Param(0), paramTypes)
|
||||||
|
|
||||||
// Get the function pointer.
|
// Get the function pointer.
|
||||||
fnPtr := params[len(params)-1]
|
fnPtr := params[len(params)-1]
|
||||||
|
params = 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)
|
|
||||||
|
|
||||||
// Create the call.
|
// Create the call.
|
||||||
builder.CreateCall(fnPtr, params, "")
|
builder.CreateCall(fnPtr, params, "")
|
||||||
|
|
||||||
if c.Scheduler == "asyncify" {
|
if c.Scheduler == "asyncify" {
|
||||||
builder.CreateCall(deadlock, []llvm.Value{
|
builder.CreateCall(deadlock, []llvm.Value{
|
||||||
llvm.Undef(c.i8ptrType), llvm.Undef(c.i8ptrType),
|
llvm.Undef(c.i8ptrType),
|
||||||
}, "")
|
}, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,7 +530,6 @@ func (c *compilerContext) getInterfaceInvokeWrapper(fn *ssa.Function, llvmFn llv
|
||||||
wrapFnType := llvm.FunctionType(fnType.ReturnType(), paramTypes, false)
|
wrapFnType := llvm.FunctionType(fnType.ReturnType(), paramTypes, false)
|
||||||
wrapper = llvm.AddFunction(c.mod, wrapperName, wrapFnType)
|
wrapper = llvm.AddFunction(c.mod, wrapperName, wrapFnType)
|
||||||
c.addStandardAttributes(wrapper)
|
c.addStandardAttributes(wrapper)
|
||||||
wrapper.LastParam().SetName("parentHandle")
|
|
||||||
|
|
||||||
wrapper.SetLinkage(llvm.LinkOnceODRLinkage)
|
wrapper.SetLinkage(llvm.LinkOnceODRLinkage)
|
||||||
wrapper.SetUnnamedAddr(true)
|
wrapper.SetUnnamedAddr(true)
|
||||||
|
|
|
@ -97,15 +97,13 @@ func EmitPointerPack(builder llvm.Builder, mod llvm.Module, prefix string, needs
|
||||||
packedHeapAlloc := builder.CreateCall(alloc, []llvm.Value{
|
packedHeapAlloc := builder.CreateCall(alloc, []llvm.Value{
|
||||||
sizeValue,
|
sizeValue,
|
||||||
llvm.ConstNull(i8ptrType),
|
llvm.ConstNull(i8ptrType),
|
||||||
llvm.Undef(i8ptrType), // unused context parameter
|
llvm.Undef(i8ptrType), // unused context parameter
|
||||||
llvm.ConstPointerNull(i8ptrType), // coroutine handle
|
|
||||||
}, "")
|
}, "")
|
||||||
if needsStackObjects {
|
if needsStackObjects {
|
||||||
trackPointer := mod.NamedFunction("runtime.trackPointer")
|
trackPointer := mod.NamedFunction("runtime.trackPointer")
|
||||||
builder.CreateCall(trackPointer, []llvm.Value{
|
builder.CreateCall(trackPointer, []llvm.Value{
|
||||||
packedHeapAlloc,
|
packedHeapAlloc,
|
||||||
llvm.Undef(i8ptrType), // unused context parameter
|
llvm.Undef(i8ptrType), // unused context parameter
|
||||||
llvm.ConstPointerNull(i8ptrType), // coroutine handle
|
|
||||||
}, "")
|
}, "")
|
||||||
}
|
}
|
||||||
packedAlloc := builder.CreateBitCast(packedHeapAlloc, llvm.PointerType(packedType, 0), "")
|
packedAlloc := builder.CreateBitCast(packedHeapAlloc, llvm.PointerType(packedType, 0), "")
|
||||||
|
|
|
@ -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.
|
// closures and bound methods, but should be optimized away when not used.
|
||||||
if !info.exported {
|
if !info.exported {
|
||||||
paramInfos = append(paramInfos, paramInfo{llvmType: c.i8ptrType, name: "context", flags: 0})
|
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
|
var paramTypes []llvm.Type
|
||||||
|
|
56
compiler/testdata/basic.ll
предоставленный
56
compiler/testdata/basic.ll
предоставленный
|
@ -6,38 +6,38 @@ target triple = "wasm32-unknown-wasi"
|
||||||
%main.kv = type { float }
|
%main.kv = type { float }
|
||||||
%main.kv.0 = type { i8 }
|
%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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = add i32 %x, %y
|
%0 = add i32 %x, %y
|
||||||
ret i32 %0
|
ret i32 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq i32 %x, %y
|
%0 = icmp eq i32 %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq i32 %y, 0
|
%0 = icmp eq i32 %y, 0
|
||||||
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
||||||
|
|
||||||
divbyzero.throw: ; preds = %entry
|
divbyzero.throw: ; preds = %entry
|
||||||
call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0
|
call void @runtime.divideByZeroPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
divbyzero.next: ; preds = %entry
|
divbyzero.next: ; preds = %entry
|
||||||
|
@ -49,16 +49,16 @@ divbyzero.next: ; preds = %entry
|
||||||
ret i32 %5
|
ret i32 %5
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.divideByZeroPanic(i8*, i8*)
|
declare void @runtime.divideByZeroPanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq i32 %y, 0
|
%0 = icmp eq i32 %y, 0
|
||||||
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
||||||
|
|
||||||
divbyzero.throw: ; preds = %entry
|
divbyzero.throw: ; preds = %entry
|
||||||
call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0
|
call void @runtime.divideByZeroPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
divbyzero.next: ; preds = %entry
|
divbyzero.next: ; preds = %entry
|
||||||
|
@ -67,13 +67,13 @@ divbyzero.next: ; preds = %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq i32 %y, 0
|
%0 = icmp eq i32 %y, 0
|
||||||
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
||||||
|
|
||||||
divbyzero.throw: ; preds = %entry
|
divbyzero.throw: ; preds = %entry
|
||||||
call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0
|
call void @runtime.divideByZeroPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
divbyzero.next: ; preds = %entry
|
divbyzero.next: ; preds = %entry
|
||||||
|
@ -86,13 +86,13 @@ divbyzero.next: ; preds = %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq i32 %y, 0
|
%0 = icmp eq i32 %y, 0
|
||||||
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
br i1 %0, label %divbyzero.throw, label %divbyzero.next
|
||||||
|
|
||||||
divbyzero.throw: ; preds = %entry
|
divbyzero.throw: ; preds = %entry
|
||||||
call void @runtime.divideByZeroPanic(i8* undef, i8* null) #0
|
call void @runtime.divideByZeroPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
divbyzero.next: ; preds = %entry
|
divbyzero.next: ; preds = %entry
|
||||||
|
@ -101,61 +101,61 @@ divbyzero.next: ; preds = %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fcmp oeq float %x, %y
|
%0 = fcmp oeq float %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fcmp une float %x, %y
|
%0 = fcmp une float %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fcmp olt float %x, %y
|
%0 = fcmp olt float %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fcmp ole float %x, %y
|
%0 = fcmp ole float %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fcmp ogt float %x, %y
|
%0 = fcmp ogt float %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fcmp oge float %x, %y
|
%0 = fcmp oge float %x, %y
|
||||||
ret i1 %0
|
ret i1 %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret float %x.r
|
ret float %x.r
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret float %x.i
|
ret float %x.i
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fadd float %x.r, %y.r
|
%0 = fadd float %x.r, %y.r
|
||||||
%1 = fadd float %x.i, %y.i
|
%1 = fadd float %x.i, %y.i
|
||||||
|
@ -165,7 +165,7 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fsub float %x.r, %y.r
|
%0 = fsub float %x.r, %y.r
|
||||||
%1 = fsub float %x.i, %y.i
|
%1 = fsub float %x.i, %y.i
|
||||||
|
@ -175,7 +175,7 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = fmul float %x.r, %y.r
|
%0 = fmul float %x.r, %y.r
|
||||||
%1 = fmul float %x.i, %y.i
|
%1 = fmul float %x.i, %y.i
|
||||||
|
@ -189,14 +189,14 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
34
compiler/testdata/channel.ll
предоставленный
34
compiler/testdata/channel.ll
предоставленный
|
@ -11,18 +11,18 @@ target triple = "wasm32-unknown-wasi"
|
||||||
%"internal/task.stackState" = type { i32, i32 }
|
%"internal/task.stackState" = type { i32, i32 }
|
||||||
%runtime.chanSelectState = type { %runtime.channel*, i8* }
|
%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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
||||||
%chan.value = alloca i32, align 4
|
%chan.value = alloca i32, align 4
|
||||||
|
@ -31,7 +31,7 @@ entry:
|
||||||
store i32 3, i32* %chan.value, align 4
|
store i32 3, i32* %chan.value, align 4
|
||||||
%chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8*
|
%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 @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 24, i8* nonnull %chan.blockedList.bitcast)
|
||||||
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %chan.value.bitcast)
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %chan.value.bitcast)
|
||||||
ret void
|
ret void
|
||||||
|
@ -40,13 +40,13 @@ entry:
|
||||||
; Function Attrs: argmemonly nofree nosync nounwind willreturn
|
; Function Attrs: argmemonly nofree nosync nounwind willreturn
|
||||||
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
|
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
|
; Function Attrs: argmemonly nofree nosync nounwind willreturn
|
||||||
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
|
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
||||||
%chan.value = alloca i32, align 4
|
%chan.value = alloca i32, align 4
|
||||||
|
@ -54,41 +54,41 @@ entry:
|
||||||
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %chan.value.bitcast)
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %chan.value.bitcast)
|
||||||
%chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8*
|
%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 @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 4, i8* nonnull %chan.value.bitcast)
|
||||||
call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast)
|
call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast)
|
||||||
ret void
|
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
|
; 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:
|
entry:
|
||||||
%complit = alloca {}, align 8
|
%complit = alloca {}, align 8
|
||||||
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
||||||
%0 = bitcast {}* %complit to i8*
|
%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*
|
%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 @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)
|
call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast)
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
||||||
%chan.blockedList.bitcast = bitcast %runtime.channelBlockedList* %chan.blockedList to i8*
|
%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 @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)
|
call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %chan.blockedList.bitcast)
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%select.states.alloca = alloca [2 x %runtime.chanSelectState], align 8
|
%select.states.alloca = alloca [2 x %runtime.chanSelectState], align 8
|
||||||
%select.send.value = alloca i32, align 4
|
%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
|
%.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
|
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.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)
|
call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %select.states.alloca.bitcast)
|
||||||
%1 = extractvalue { i32, i1 } %select.result, 0
|
%1 = extractvalue { i32, i1 } %select.result, 0
|
||||||
%2 = icmp eq i32 %1, 0
|
%2 = icmp eq i32 %1, 0
|
||||||
|
@ -122,7 +122,7 @@ select.body: ; preds = %select.next
|
||||||
br label %select.done
|
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 #0 = { nounwind }
|
||||||
attributes #1 = { argmemonly nofree nosync nounwind willreturn }
|
attributes #1 = { argmemonly nofree nosync nounwind willreturn }
|
||||||
|
|
22
compiler/testdata/float.ll
предоставленный
22
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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20"
|
||||||
target triple = "wasm32-unknown-wasi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%positive = fcmp oge float %v, 0.000000e+00
|
%positive = fcmp oge float %v, 0.000000e+00
|
||||||
%withinmax = fcmp ole float %v, 0x41EFFFFFC0000000
|
%withinmax = fcmp ole float %v, 0x41EFFFFFC0000000
|
||||||
|
@ -26,25 +26,25 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret float 0x41F0000000000000
|
ret float 0x41F0000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret i32 -1
|
ret i32 -1
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret { i32, i32, i32, i32 } { i32 -1, i32 0, i32 2147483647, i32 -2147483648 }
|
ret { i32, i32, i32, i32 } { i32 -1, i32 0, i32 2147483647, i32 -2147483648 }
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = uitofp i32 %v to float
|
%0 = uitofp i32 %v to float
|
||||||
%withinmax = fcmp ole float %0, 0x41EFFFFFC0000000
|
%withinmax = fcmp ole float %0, 0x41EFFFFFC0000000
|
||||||
|
@ -54,7 +54,7 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%positive = fcmp oge float %v, 0.000000e+00
|
%positive = fcmp oge float %v, 0.000000e+00
|
||||||
%withinmax = fcmp ole float %v, 0x41EFFFFFC0000000
|
%withinmax = fcmp ole float %v, 0x41EFFFFFC0000000
|
||||||
|
@ -67,7 +67,7 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%positive = fcmp oge float %v, 0.000000e+00
|
%positive = fcmp oge float %v, 0.000000e+00
|
||||||
%withinmax = fcmp ole float %v, 2.550000e+02
|
%withinmax = fcmp ole float %v, 2.550000e+02
|
||||||
|
@ -79,7 +79,7 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%abovemin = fcmp oge float %v, -1.280000e+02
|
%abovemin = fcmp oge float %v, -1.280000e+02
|
||||||
%belowmax = fcmp ole float %v, 1.270000e+02
|
%belowmax = fcmp ole float %v, 1.270000e+02
|
||||||
|
|
22
compiler/testdata/func.ll
предоставленный
22
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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20"
|
||||||
target triple = "wasm32-unknown-wasi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq void ()* %callback.funcptr, null
|
%0 = icmp eq void ()* %callback.funcptr, null
|
||||||
br i1 %0, label %fpcall.throw, label %fpcall.next
|
br i1 %0, label %fpcall.throw, label %fpcall.next
|
||||||
|
|
||||||
fpcall.throw: ; preds = %entry
|
fpcall.throw: ; preds = %entry
|
||||||
call void @runtime.nilPanic(i8* undef, i8* null) #0
|
call void @runtime.nilPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
fpcall.next: ; preds = %entry
|
fpcall.next: ; preds = %entry
|
||||||
%1 = bitcast void ()* %callback.funcptr to void (i32, i8*, i8*)*
|
%1 = bitcast void ()* %callback.funcptr to void (i32, i8*)*
|
||||||
call void %1(i32 3, i8* %callback.context, i8* undef) #0
|
call void %1(i32 3, i8* %callback.context) #0
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.nilPanic(i8*, i8*)
|
declare void @runtime.nilPanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
84
compiler/testdata/gc.ll
предоставленный
84
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: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 }
|
@"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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%new = call i8* @runtime.alloc(i32 1, i8* nonnull inttoptr (i32 3 to i8*), 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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %new, i8* undef) #0
|
||||||
store i8* %new, i8** @main.scalar1, align 4
|
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
|
%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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %new1, i8* undef) #0
|
||||||
store i8* %new1, i8** bitcast (i32** @main.scalar2 to i8**), align 4
|
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
|
%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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %new2, i8* undef) #0
|
||||||
store i8* %new2, i8** bitcast (i64** @main.scalar3 to i8**), align 4
|
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
|
%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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %new3, i8* undef) #0
|
||||||
store i8* %new3, i8** bitcast (float** @main.scalar4 to i8**), align 4
|
store i8* %new3, i8** bitcast (float** @main.scalar4 to i8**), align 4
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%new = call i8* @runtime.alloc(i32 3, i8* nonnull inttoptr (i32 3 to i8*), 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, i8* null) #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
|
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
|
%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, i8* null) #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
|
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
|
%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, i8* null) #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
|
store i8* %new2, i8** bitcast ([3 x i8*]** @main.array3 to i8**), align 4
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%new = call i8* @runtime.alloc(i32 0, i8* nonnull inttoptr (i32 3 to i8*), 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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %new, i8* undef) #0
|
||||||
store i8* %new, i8** bitcast ({}** @main.struct1 to i8**), align 4
|
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
|
%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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %new1, i8* undef) #0
|
||||||
store i8* %new1, i8** bitcast ({ i32, i32 }** @main.struct2 to i8**), align 4
|
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
|
%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, i8* null) #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
|
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
|
%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, i8* null) #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
|
store i8* %new3, i8** bitcast ({ i8*, [61 x i32] }** @main.struct4 to i8**), align 4
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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 ()* }*
|
%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
|
ret { i8*, void ()* }* %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%makeslice = call i8* @runtime.alloc(i32 5, i8* nonnull inttoptr (i32 3 to i8*), 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, i8* null) #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 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 1), align 4
|
||||||
store i32 5, i32* getelementptr inbounds ({ i8*, i32, i32 }, { i8*, i32, i32 }* @main.slice1, i32 0, i32 2), align 8
|
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
|
%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, i8* null) #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 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 1), align 4
|
||||||
store i32 5, i32* getelementptr inbounds ({ i32**, i32, i32 }, { i32**, i32, i32 }* @main.slice2, i32 0, i32 2), align 8
|
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
|
%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, i8* null) #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 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 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
|
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
|
; 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:
|
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
|
||||||
call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0
|
||||||
%.repack = bitcast i8* %0 to double*
|
%.repack = bitcast i8* %0 to double*
|
||||||
store double %v.r, double* %.repack, align 8
|
store double %v.r, double* %.repack, align 8
|
||||||
%.repack1 = getelementptr inbounds i8, i8* %0, i32 8
|
%.repack1 = getelementptr inbounds i8, i8* %0, i32 8
|
||||||
%1 = bitcast i8* %.repack1 to double*
|
%1 = bitcast i8* %.repack1 to double*
|
||||||
store double %v.i, double* %1, align 8
|
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
|
%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
|
ret %runtime._interface %2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
52
compiler/testdata/go1.17.ll
предоставленный
52
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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20"
|
||||||
target triple = "wasm32-unknown-wasi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = getelementptr i8, i8* %p, i32 %len
|
%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
|
ret i8* %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = trunc i64 %len to i32
|
%0 = trunc i64 %len to i32
|
||||||
%1 = getelementptr i8, i8* %p, i32 %0
|
%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
|
ret i8* %1
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp ult i32 %s.len, 4
|
%0 = icmp ult i32 %s.len, 4
|
||||||
br i1 %0, label %slicetoarray.throw, label %slicetoarray.next
|
br i1 %0, label %slicetoarray.throw, label %slicetoarray.next
|
||||||
|
|
||||||
slicetoarray.throw: ; preds = %entry
|
slicetoarray.throw: ; preds = %entry
|
||||||
call void @runtime.sliceToArrayPointerPanic(i8* undef, i8* null) #0
|
call void @runtime.sliceToArrayPointerPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
slicetoarray.next: ; preds = %entry
|
slicetoarray.next: ; preds = %entry
|
||||||
|
@ -45,13 +45,13 @@ slicetoarray.next: ; preds = %entry
|
||||||
ret [4 x i32]* %1
|
ret [4 x i32]* %1
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.sliceToArrayPointerPanic(i8*, i8*)
|
declare void @runtime.sliceToArrayPointerPanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%makeslice = call i8* @runtime.alloc(i32 24, i8* nonnull inttoptr (i32 3 to i8*), 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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %makeslice, i8* undef) #0
|
||||||
br i1 false, label %slicetoarray.throw, label %slicetoarray.next
|
br i1 false, label %slicetoarray.throw, label %slicetoarray.next
|
||||||
|
|
||||||
slicetoarray.throw: ; preds = %entry
|
slicetoarray.throw: ; preds = %entry
|
||||||
|
@ -63,7 +63,7 @@ slicetoarray.next: ; preds = %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp ugt i32 %len, 1073741823
|
%0 = icmp ugt i32 %len, 1073741823
|
||||||
%1 = icmp eq i32* %ptr, null
|
%1 = icmp eq i32* %ptr, null
|
||||||
|
@ -73,7 +73,7 @@ entry:
|
||||||
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
||||||
|
|
||||||
unsafe.Slice.throw: ; preds = %entry
|
unsafe.Slice.throw: ; preds = %entry
|
||||||
call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0
|
call void @runtime.unsafeSlicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
unsafe.Slice.next: ; preds = %entry
|
unsafe.Slice.next: ; preds = %entry
|
||||||
|
@ -81,14 +81,14 @@ unsafe.Slice.next: ; preds = %entry
|
||||||
%6 = insertvalue { i32*, i32, i32 } %5, i32 %len, 1
|
%6 = insertvalue { i32*, i32, i32 } %5, i32 %len, 1
|
||||||
%7 = insertvalue { i32*, i32, i32 } %6, i32 %len, 2
|
%7 = insertvalue { i32*, i32, i32 } %6, i32 %len, 2
|
||||||
%8 = bitcast i32* %ptr to i8*
|
%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
|
ret { i32*, i32, i32 } %7
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.unsafeSlicePanic(i8*, i8*)
|
declare void @runtime.unsafeSlicePanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp eq i8* %ptr, null
|
%0 = icmp eq i8* %ptr, null
|
||||||
%1 = icmp ne i16 %len, 0
|
%1 = icmp ne i16 %len, 0
|
||||||
|
@ -96,7 +96,7 @@ entry:
|
||||||
br i1 %2, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
br i1 %2, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
||||||
|
|
||||||
unsafe.Slice.throw: ; preds = %entry
|
unsafe.Slice.throw: ; preds = %entry
|
||||||
call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0
|
call void @runtime.unsafeSlicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
unsafe.Slice.next: ; preds = %entry
|
unsafe.Slice.next: ; preds = %entry
|
||||||
|
@ -104,12 +104,12 @@ unsafe.Slice.next: ; preds = %entry
|
||||||
%4 = insertvalue { i8*, i32, i32 } undef, i8* %ptr, 0
|
%4 = insertvalue { i8*, i32, i32 } undef, i8* %ptr, 0
|
||||||
%5 = insertvalue { i8*, i32, i32 } %4, i32 %3, 1
|
%5 = insertvalue { i8*, i32, i32 } %4, i32 %3, 1
|
||||||
%6 = insertvalue { i8*, i32, i32 } %5, i32 %3, 2
|
%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
|
ret { i8*, i32, i32 } %6
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp ugt i64 %len, 1073741823
|
%0 = icmp ugt i64 %len, 1073741823
|
||||||
%1 = icmp eq i32* %ptr, null
|
%1 = icmp eq i32* %ptr, null
|
||||||
|
@ -119,7 +119,7 @@ entry:
|
||||||
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
||||||
|
|
||||||
unsafe.Slice.throw: ; preds = %entry
|
unsafe.Slice.throw: ; preds = %entry
|
||||||
call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0
|
call void @runtime.unsafeSlicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
unsafe.Slice.next: ; preds = %entry
|
unsafe.Slice.next: ; preds = %entry
|
||||||
|
@ -128,12 +128,12 @@ unsafe.Slice.next: ; preds = %entry
|
||||||
%7 = insertvalue { i32*, i32, i32 } %6, i32 %5, 1
|
%7 = insertvalue { i32*, i32, i32 } %6, i32 %5, 1
|
||||||
%8 = insertvalue { i32*, i32, i32 } %7, i32 %5, 2
|
%8 = insertvalue { i32*, i32, i32 } %7, i32 %5, 2
|
||||||
%9 = bitcast i32* %ptr to i8*
|
%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
|
ret { i32*, i32, i32 } %8
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = icmp ugt i64 %len, 1073741823
|
%0 = icmp ugt i64 %len, 1073741823
|
||||||
%1 = icmp eq i32* %ptr, null
|
%1 = icmp eq i32* %ptr, null
|
||||||
|
@ -143,7 +143,7 @@ entry:
|
||||||
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
br i1 %4, label %unsafe.Slice.throw, label %unsafe.Slice.next
|
||||||
|
|
||||||
unsafe.Slice.throw: ; preds = %entry
|
unsafe.Slice.throw: ; preds = %entry
|
||||||
call void @runtime.unsafeSlicePanic(i8* undef, i8* null) #0
|
call void @runtime.unsafeSlicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
unsafe.Slice.next: ; preds = %entry
|
unsafe.Slice.next: ; preds = %entry
|
||||||
|
@ -152,7 +152,7 @@ unsafe.Slice.next: ; preds = %entry
|
||||||
%7 = insertvalue { i32*, i32, i32 } %6, i32 %5, 1
|
%7 = insertvalue { i32*, i32, i32 } %6, i32 %5, 1
|
||||||
%8 = insertvalue { i32*, i32, i32 } %7, i32 %5, 2
|
%8 = insertvalue { i32*, i32, i32 } %7, i32 %5, 2
|
||||||
%9 = bitcast i32* %ptr to i8*
|
%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
|
ret { i32*, i32, i32 } %8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
86
compiler/testdata/goroutine-cortex-m-qemu-tasks.ll
предоставленный
86
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
|
@"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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.regularFunction$gowrapper" to i32), i8* undef, i8* undef) #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, 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 %stacksize, i8* undef) #0
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @main.regularFunction(i32, i8*, i8*)
|
declare void @main.regularFunction(i32, i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; Function Attrs: nounwind
|
||||||
define linkonce_odr void @"main.regularFunction$gowrapper"(i8* %0) unnamed_addr #1 {
|
define linkonce_odr void @"main.regularFunction$gowrapper"(i8* %0) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
%unpack.int = ptrtoint i8* %0 to i32
|
%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
|
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
|
; 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:
|
entry:
|
||||||
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"main.inlineFunctionGoroutine$1$gowrapper" to i32), i8* undef, i8* undef) #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, 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 %stacksize, i8* undef) #0
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
@ -60,31 +60,31 @@ entry:
|
||||||
define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(i8* %0) unnamed_addr #2 {
|
define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(i8* %0) unnamed_addr #2 {
|
||||||
entry:
|
entry:
|
||||||
%unpack.int = ptrtoint i8* %0 to i32
|
%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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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*
|
%0 = bitcast i8* %n to i32*
|
||||||
store i32 3, i32* %0, align 4
|
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*
|
%2 = bitcast i8* %1 to i32*
|
||||||
store i32 5, i32* %2, align 4
|
store i32 5, i32* %2, align 4
|
||||||
%3 = getelementptr inbounds i8, i8* %1, i32 4
|
%3 = getelementptr inbounds i8, i8* %1, i32 4
|
||||||
%4 = bitcast i8* %3 to i8**
|
%4 = bitcast i8* %3 to i8**
|
||||||
store i8* %n, i8** %4, align 4
|
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
|
%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, i8* null) #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
|
%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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%unpack.ptr = bitcast i8* %context to i32*
|
%unpack.ptr = bitcast i8* %context to i32*
|
||||||
store i32 7, i32* %unpack.ptr, align 4
|
store i32 7, i32* %unpack.ptr, align 4
|
||||||
|
@ -99,16 +99,16 @@ entry:
|
||||||
%3 = getelementptr inbounds i8, i8* %0, i32 4
|
%3 = getelementptr inbounds i8, i8* %0, i32 4
|
||||||
%4 = bitcast i8* %3 to i8**
|
%4 = bitcast i8* %3 to i8**
|
||||||
%5 = load i8*, i8** %4, align 4
|
%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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.printint32(i32, i8*, i8*)
|
declare void @runtime.printint32(i32, i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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*
|
%1 = bitcast i8* %0 to i32*
|
||||||
store i32 5, i32* %1, align 4
|
store i32 5, i32* %1, align 4
|
||||||
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
||||||
|
@ -117,8 +117,8 @@ entry:
|
||||||
%4 = getelementptr inbounds i8, i8* %0, i32 8
|
%4 = getelementptr inbounds i8, i8* %0, i32 8
|
||||||
%5 = bitcast i8* %4 to void ()**
|
%5 = bitcast i8* %4 to void ()**
|
||||||
store void ()* %fn.funcptr, void ()** %5, align 4
|
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
|
%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, i8* null) #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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,40 +131,40 @@ entry:
|
||||||
%4 = bitcast i8* %3 to i8**
|
%4 = bitcast i8* %3 to i8**
|
||||||
%5 = load i8*, i8** %4, align 4
|
%5 = load i8*, i8** %4, align 4
|
||||||
%6 = getelementptr inbounds i8, i8* %0, i32 8
|
%6 = getelementptr inbounds i8, i8* %0, i32 8
|
||||||
%7 = bitcast i8* %6 to void (i32, i8*, i8*)**
|
%7 = bitcast i8* %6 to void (i32, i8*)**
|
||||||
%8 = load void (i32, i8*, i8*)*, void (i32, i8*, i8*)** %7, align 4
|
%8 = load void (i32, i8*)*, void (i32, i8*)** %7, align 4
|
||||||
call void %8(i32 %2, i8* %5, i8* undef) #0
|
call void %8(i32 %2, i8* %5) #0
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
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
|
; 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:
|
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
|
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
|
; 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:
|
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**
|
%1 = bitcast i8* %0 to i8**
|
||||||
store i8* %itf.value, i8** %1, align 4
|
store i8* %itf.value, i8** %1, align 4
|
||||||
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
||||||
|
@ -176,12 +176,12 @@ entry:
|
||||||
%4 = getelementptr inbounds i8, i8* %0, i32 12
|
%4 = getelementptr inbounds i8, i8* %0, i32 12
|
||||||
%5 = bitcast i8* %4 to i32*
|
%5 = bitcast i8* %4 to i32*
|
||||||
store i32 %itf.typecode, i32* %5, align 4
|
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
|
%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, 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 %stacksize, i8* undef) #0
|
||||||
ret void
|
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
|
; Function Attrs: nounwind
|
||||||
define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(i8* %0) unnamed_addr #6 {
|
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
|
%9 = getelementptr inbounds i8, i8* %0, i32 12
|
||||||
%10 = bitcast i8* %9 to i32*
|
%10 = bitcast i8* %9 to i32*
|
||||||
%11 = load i32, i32* %10, align 4
|
%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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
100
compiler/testdata/goroutine-wasm-asyncify.ll
предоставленный
100
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
|
@"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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
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
|
; Function Attrs: nounwind
|
||||||
define linkonce_odr void @"main.regularFunction$gowrapper"(i8* %0) unnamed_addr #1 {
|
define linkonce_odr void @"main.regularFunction$gowrapper"(i8* %0) unnamed_addr #1 {
|
||||||
entry:
|
entry:
|
||||||
%unpack.int = ptrtoint i8* %0 to i32
|
%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
|
||||||
call void @runtime.deadlock(i8* undef, i8* undef) #0
|
call void @runtime.deadlock(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @"internal/task.start"(i32, i8*, i32, i8*, i8*)
|
declare void @"internal/task.start"(i32, i8*, i32, i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
@ -62,35 +62,35 @@ entry:
|
||||||
define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(i8* %0) unnamed_addr #2 {
|
define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(i8* %0) unnamed_addr #2 {
|
||||||
entry:
|
entry:
|
||||||
%unpack.int = ptrtoint i8* %0 to i32
|
%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)
|
||||||
call void @runtime.deadlock(i8* undef, i8* undef) #0
|
call void @runtime.deadlock(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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*
|
%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
|
store i32 3, i32* %0, align 4
|
||||||
call void @runtime.trackPointer(i8* nonnull %n, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %n, i8* undef) #0
|
||||||
call void @runtime.trackPointer(i8* bitcast (void (i32, i8*, i8*)* @"main.closureFunctionGoroutine$1" to i8*), i8* undef, i8* null) #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, i8* null) #0
|
%1 = call i8* @runtime.alloc(i32 8, i8* null, i8* undef) #0
|
||||||
call void @runtime.trackPointer(i8* nonnull %1, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %1, i8* undef) #0
|
||||||
%2 = bitcast i8* %1 to i32*
|
%2 = bitcast i8* %1 to i32*
|
||||||
store i32 5, i32* %2, align 4
|
store i32 5, i32* %2, align 4
|
||||||
%3 = getelementptr inbounds i8, i8* %1, i32 4
|
%3 = getelementptr inbounds i8, i8* %1, i32 4
|
||||||
%4 = bitcast i8* %3 to i8**
|
%4 = bitcast i8* %3 to i8**
|
||||||
store i8* %n, i8** %4, align 4
|
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
|
%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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%unpack.ptr = bitcast i8* %context to i32*
|
%unpack.ptr = bitcast i8* %context to i32*
|
||||||
store i32 7, i32* %unpack.ptr, align 4
|
store i32 7, i32* %unpack.ptr, align 4
|
||||||
|
@ -105,18 +105,18 @@ entry:
|
||||||
%3 = getelementptr inbounds i8, i8* %0, i32 4
|
%3 = getelementptr inbounds i8, i8* %0, i32 4
|
||||||
%4 = bitcast i8* %3 to i8**
|
%4 = bitcast i8* %3 to i8**
|
||||||
%5 = load i8*, i8** %4, align 4
|
%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)
|
||||||
call void @runtime.deadlock(i8* undef, i8* undef) #0
|
call void @runtime.deadlock(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.printint32(i32, i8*, i8*)
|
declare void @runtime.printint32(i32, i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
||||||
call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0
|
||||||
%1 = bitcast i8* %0 to i32*
|
%1 = bitcast i8* %0 to i32*
|
||||||
store i32 5, i32* %1, align 4
|
store i32 5, i32* %1, align 4
|
||||||
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
||||||
|
@ -125,7 +125,7 @@ entry:
|
||||||
%4 = getelementptr inbounds i8, i8* %0, i32 8
|
%4 = getelementptr inbounds i8, i8* %0, i32 8
|
||||||
%5 = bitcast i8* %4 to void ()**
|
%5 = bitcast i8* %4 to void ()**
|
||||||
store void ()* %fn.funcptr, void ()** %5, align 4
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,42 +138,42 @@ entry:
|
||||||
%4 = bitcast i8* %3 to i8**
|
%4 = bitcast i8* %3 to i8**
|
||||||
%5 = load i8*, i8** %4, align 4
|
%5 = load i8*, i8** %4, align 4
|
||||||
%6 = getelementptr inbounds i8, i8* %0, i32 8
|
%6 = getelementptr inbounds i8, i8* %0, i32 8
|
||||||
%7 = bitcast i8* %6 to void (i32, i8*, i8*)**
|
%7 = bitcast i8* %6 to void (i32, i8*)**
|
||||||
%8 = load void (i32, i8*, i8*)*, void (i32, i8*, i8*)** %7, align 4
|
%8 = load void (i32, i8*)*, void (i32, i8*)** %7, align 4
|
||||||
call void %8(i32 %2, i8* %5, i8* undef) #0
|
call void %8(i32 %2, i8* %5) #0
|
||||||
call void @runtime.deadlock(i8* undef, i8* undef) #0
|
call void @runtime.deadlock(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
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
|
; 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:
|
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
|
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
|
; 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:
|
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
|
||||||
call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0
|
||||||
%1 = bitcast i8* %0 to i8**
|
%1 = bitcast i8* %0 to i8**
|
||||||
store i8* %itf.value, i8** %1, align 4
|
store i8* %itf.value, i8** %1, align 4
|
||||||
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
%2 = getelementptr inbounds i8, i8* %0, i32 4
|
||||||
|
@ -185,11 +185,11 @@ entry:
|
||||||
%4 = getelementptr inbounds i8, i8* %0, i32 12
|
%4 = getelementptr inbounds i8, i8* %0, i32 12
|
||||||
%5 = bitcast i8* %4 to i32*
|
%5 = bitcast i8* %4 to i32*
|
||||||
store i32 %itf.typecode, i32* %5, align 4
|
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
|
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
|
; Function Attrs: nounwind
|
||||||
define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(i8* %0) unnamed_addr #6 {
|
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
|
%9 = getelementptr inbounds i8, i8* %0, i32 12
|
||||||
%10 = bitcast i8* %9 to i32*
|
%10 = bitcast i8* %9 to i32*
|
||||||
%11 = load i32, i32* %10, align 4
|
%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
|
||||||
call void @runtime.deadlock(i8* undef, i8* undef) #0
|
call void @runtime.deadlock(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
46
compiler/testdata/interface.ll
предоставленный
46
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.interface:interface{String() string}$interface" = linkonce_odr constant [1 x i8*] [i8* @"reflect/methods.String() string"]
|
||||||
@"reflect/types.typeid:basic:int" = external constant i8
|
@"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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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 }
|
ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* null }
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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 }
|
ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:basic:int" to i32), i8* null }
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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 }
|
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
|
declare i1 @"interface:{Error:func:{}{basic:string}}.$typeassert"(i32) #1
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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 }
|
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
|
declare i1 @"interface:{String:func:{}{basic:string}}.$typeassert"(i32) #2
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
br i1 %typecode, label %typeassert.ok, label %typeassert.next
|
||||||
|
|
||||||
typeassert.ok: ; preds = %entry
|
typeassert.ok: ; preds = %entry
|
||||||
|
@ -77,10 +77,10 @@ typeassert.next: ; preds = %typeassert.ok, %ent
|
||||||
ret i1 %typecode
|
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
|
; 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:
|
entry:
|
||||||
%0 = call i1 @"interface:{Error:func:{}{basic:string}}.$typeassert"(i32 %itf.typecode) #0
|
%0 = call i1 @"interface:{Error:func:{}{basic:string}}.$typeassert"(i32 %itf.typecode) #0
|
||||||
br i1 %0, label %typeassert.ok, label %typeassert.next
|
br i1 %0, label %typeassert.ok, label %typeassert.next
|
||||||
|
@ -93,7 +93,7 @@ typeassert.next: ; preds = %typeassert.ok, %ent
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = call i1 @"interface:{String:func:{}{basic:string}}.$typeassert"(i32 %itf.typecode) #0
|
%0 = call i1 @"interface:{String:func:{}{basic:string}}.$typeassert"(i32 %itf.typecode) #0
|
||||||
br i1 %0, label %typeassert.ok, label %typeassert.next
|
br i1 %0, label %typeassert.ok, label %typeassert.next
|
||||||
|
@ -106,24 +106,24 @@ typeassert.next: ; preds = %typeassert.ok, %ent
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
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
|
; 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:
|
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
|
%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
|
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 #0 = { nounwind }
|
||||||
attributes #1 = { "tinygo-methods"="reflect/methods.Error() string" }
|
attributes #1 = { "tinygo-methods"="reflect/methods.Error() string" }
|
||||||
|
|
16
compiler/testdata/intrinsics-cortex-m-qemu.ll
предоставленный
16
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 datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||||
target triple = "thumbv7m-unknown-unknown-eabi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
ret double %0
|
||||||
}
|
}
|
||||||
|
|
||||||
declare double @math.Sqrt(double, i8*, i8*)
|
declare double @math.Sqrt(double, i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
ret double %0
|
||||||
}
|
}
|
||||||
|
|
||||||
declare double @math.Trunc(double, i8*, i8*)
|
declare double @math.Trunc(double, i8*)
|
||||||
|
|
||||||
attributes #0 = { nounwind }
|
attributes #0 = { nounwind }
|
||||||
|
|
10
compiler/testdata/intrinsics-wasm.ll
предоставленный
10
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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20"
|
||||||
target triple = "wasm32-unknown-wasi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = call double @llvm.sqrt.f64(double %x)
|
%0 = call double @llvm.sqrt.f64(double %x)
|
||||||
ret double %0
|
ret double %0
|
||||||
|
@ -24,7 +24,7 @@ entry:
|
||||||
declare double @llvm.sqrt.f64(double) #1
|
declare double @llvm.sqrt.f64(double) #1
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = call double @llvm.trunc.f64(double %x)
|
%0 = call double @llvm.trunc.f64(double %x)
|
||||||
ret double %0
|
ret double %0
|
||||||
|
|
44
compiler/testdata/pointer.ll
предоставленный
44
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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20"
|
||||||
target triple = "wasm32-unknown-wasi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret [0 x i32] zeroinitializer
|
ret [0 x i32] zeroinitializer
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = bitcast i8* %x to i32*
|
%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
|
ret i32* %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = bitcast i32* %x to i8*
|
%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
|
ret i8* %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
call void @runtime.trackPointer(i8* %x, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* %x, i8* undef) #0
|
||||||
ret i8* %x
|
ret i8* %x
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
%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) #0
|
||||||
call void @runtime.trackPointer(i8* nonnull %0, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %0, i8* undef) #0
|
||||||
ret i8* %0
|
ret i8* %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
%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) #0
|
||||||
call void @runtime.trackPointer(i8* %0, i8* undef, i8* null) #0
|
call void @runtime.trackPointer(i8* %0, i8* undef) #0
|
||||||
ret i8* %0
|
ret i8* %0
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%0 = bitcast i32* %ptr to i8*
|
%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
|
%1 = getelementptr i32, i32* %ptr, i32 %offset
|
||||||
%2 = bitcast i32* %1 to i8*
|
%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*
|
%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
|
ret i32* %1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
compiler/testdata/pragma.ll
предоставленный
18
compiler/testdata/pragma.ll
предоставленный
|
@ -10,12 +10,12 @@ target triple = "wasm32-unknown-wasi"
|
||||||
@undefinedGlobalNotInSection = external global i32, align 4
|
@undefinedGlobalNotInSection = external global i32, align 4
|
||||||
@main.multipleGlobalPragmas = hidden global i32 0, section ".global_section", align 1024
|
@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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
@ -27,27 +27,27 @@ entry:
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @somepkg.someFunction2(i8*, i8*)
|
declare void @somepkg.someFunction2(i8*)
|
||||||
|
|
||||||
; Function Attrs: inlinehint nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: noinline nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @main.undefinedFunctionNotInSection(i8*, i8*)
|
declare void @main.undefinedFunctionNotInSection(i8*)
|
||||||
|
|
||||||
attributes #0 = { nounwind }
|
attributes #0 = { nounwind }
|
||||||
attributes #1 = { nounwind "wasm-export-name"="extern_func" }
|
attributes #1 = { nounwind "wasm-export-name"="extern_func" }
|
||||||
|
|
74
compiler/testdata/slice.ll
предоставленный
74
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 datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20"
|
||||||
target triple = "wasm32-unknown-wasi"
|
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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret i32 %ints.len
|
ret i32 %ints.len
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret i32 %ints.cap
|
ret i32 %ints.cap
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%.not = icmp ult i32 %index, %ints.len
|
%.not = icmp ult i32 %index, %ints.len
|
||||||
br i1 %.not, label %lookup.next, label %lookup.throw
|
br i1 %.not, label %lookup.next, label %lookup.throw
|
||||||
|
|
||||||
lookup.throw: ; preds = %entry
|
lookup.throw: ; preds = %entry
|
||||||
call void @runtime.lookupPanic(i8* undef, i8* null) #0
|
call void @runtime.lookupPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
lookup.next: ; preds = %entry
|
lookup.next: ; preds = %entry
|
||||||
|
@ -41,13 +41,13 @@ lookup.next: ; preds = %entry
|
||||||
ret i32 %1
|
ret i32 %1
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.lookupPanic(i8*, i8*)
|
declare void @runtime.lookupPanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%varargs = call i8* @runtime.alloc(i32 12, i8* nonnull inttoptr (i32 3 to i8*), 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, i8* null) #0
|
call void @runtime.trackPointer(i8* nonnull %varargs, i8* undef) #0
|
||||||
%0 = bitcast i8* %varargs to i32*
|
%0 = bitcast i8* %varargs to i32*
|
||||||
store i32 1, i32* %0, align 4
|
store i32 1, i32* %0, align 4
|
||||||
%1 = getelementptr inbounds i8, i8* %varargs, i32 4
|
%1 = getelementptr inbounds i8, i8* %varargs, i32 4
|
||||||
|
@ -57,7 +57,7 @@ entry:
|
||||||
%4 = bitcast i8* %3 to i32*
|
%4 = bitcast i8* %3 to i32*
|
||||||
store i32 3, i32* %4, align 4
|
store i32 3, i32* %4, align 4
|
||||||
%append.srcPtr = bitcast i32* %ints.data to i8*
|
%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.newPtr = extractvalue { i8*, i32, i32 } %append.new, 0
|
||||||
%append.newBuf = bitcast i8* %append.newPtr to i32*
|
%append.newBuf = bitcast i8* %append.newPtr to i32*
|
||||||
%append.newLen = extractvalue { i8*, i32, i32 } %append.new, 1
|
%append.newLen = extractvalue { i8*, i32, i32 } %append.new, 1
|
||||||
|
@ -65,18 +65,18 @@ entry:
|
||||||
%5 = insertvalue { i32*, i32, i32 } undef, i32* %append.newBuf, 0
|
%5 = insertvalue { i32*, i32, i32 } undef, i32* %append.newBuf, 0
|
||||||
%6 = insertvalue { i32*, i32, i32 } %5, i32 %append.newLen, 1
|
%6 = insertvalue { i32*, i32, i32 } %5, i32 %append.newLen, 1
|
||||||
%7 = insertvalue { i32*, i32, i32 } %6, i32 %append.newCap, 2
|
%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
|
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
|
; 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:
|
entry:
|
||||||
%append.srcPtr = bitcast i32* %ints.data to i8*
|
%append.srcPtr = bitcast i32* %ints.data to i8*
|
||||||
%append.srcPtr1 = bitcast i32* %added.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.newPtr = extractvalue { i8*, i32, i32 } %append.new, 0
|
||||||
%append.newBuf = bitcast i8* %append.newPtr to i32*
|
%append.newBuf = bitcast i8* %append.newPtr to i32*
|
||||||
%append.newLen = extractvalue { i8*, i32, i32 } %append.new, 1
|
%append.newLen = extractvalue { i8*, i32, i32 } %append.new, 1
|
||||||
|
@ -84,102 +84,102 @@ entry:
|
||||||
%0 = insertvalue { i32*, i32, i32 } undef, i32* %append.newBuf, 0
|
%0 = insertvalue { i32*, i32, i32 } undef, i32* %append.newBuf, 0
|
||||||
%1 = insertvalue { i32*, i32, i32 } %0, i32 %append.newLen, 1
|
%1 = insertvalue { i32*, i32, i32 } %0, i32 %append.newLen, 1
|
||||||
%2 = insertvalue { i32*, i32, i32 } %1, i32 %append.newCap, 2
|
%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
|
ret { i32*, i32, i32 } %2
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%copy.dstPtr = bitcast i32* %dst.data to i8*
|
%copy.dstPtr = bitcast i32* %dst.data to i8*
|
||||||
%copy.srcPtr = bitcast i32* %src.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
|
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
|
; 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:
|
entry:
|
||||||
%slice.maxcap = icmp slt i32 %len, 0
|
%slice.maxcap = icmp slt i32 %len, 0
|
||||||
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
||||||
|
|
||||||
slice.throw: ; preds = %entry
|
slice.throw: ; preds = %entry
|
||||||
call void @runtime.slicePanic(i8* undef, i8* null) #0
|
call void @runtime.slicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
slice.next: ; preds = %entry
|
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
|
%0 = insertvalue { i8*, i32, i32 } undef, i8* %makeslice.buf, 0
|
||||||
%1 = insertvalue { i8*, i32, i32 } %0, i32 %len, 1
|
%1 = insertvalue { i8*, i32, i32 } %0, i32 %len, 1
|
||||||
%2 = insertvalue { i8*, i32, i32 } %1, i32 %len, 2
|
%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
|
ret { i8*, i32, i32 } %2
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.slicePanic(i8*, i8*)
|
declare void @runtime.slicePanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%slice.maxcap = icmp slt i32 %len, 0
|
%slice.maxcap = icmp slt i32 %len, 0
|
||||||
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
||||||
|
|
||||||
slice.throw: ; preds = %entry
|
slice.throw: ; preds = %entry
|
||||||
call void @runtime.slicePanic(i8* undef, i8* null) #0
|
call void @runtime.slicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
slice.next: ; preds = %entry
|
slice.next: ; preds = %entry
|
||||||
%makeslice.cap = shl i32 %len, 1
|
%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*
|
%makeslice.array = bitcast i8* %makeslice.buf to i16*
|
||||||
%0 = insertvalue { i16*, i32, i32 } undef, i16* %makeslice.array, 0
|
%0 = insertvalue { i16*, i32, i32 } undef, i16* %makeslice.array, 0
|
||||||
%1 = insertvalue { i16*, i32, i32 } %0, i32 %len, 1
|
%1 = insertvalue { i16*, i32, i32 } %0, i32 %len, 1
|
||||||
%2 = insertvalue { i16*, i32, i32 } %1, i32 %len, 2
|
%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
|
ret { i16*, i32, i32 } %2
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%slice.maxcap = icmp ugt i32 %len, 1431655765
|
%slice.maxcap = icmp ugt i32 %len, 1431655765
|
||||||
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
||||||
|
|
||||||
slice.throw: ; preds = %entry
|
slice.throw: ; preds = %entry
|
||||||
call void @runtime.slicePanic(i8* undef, i8* null) #0
|
call void @runtime.slicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
slice.next: ; preds = %entry
|
slice.next: ; preds = %entry
|
||||||
%makeslice.cap = mul i32 %len, 3
|
%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]*
|
%makeslice.array = bitcast i8* %makeslice.buf to [3 x i8]*
|
||||||
%0 = insertvalue { [3 x i8]*, i32, i32 } undef, [3 x i8]* %makeslice.array, 0
|
%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
|
%1 = insertvalue { [3 x i8]*, i32, i32 } %0, i32 %len, 1
|
||||||
%2 = insertvalue { [3 x i8]*, i32, i32 } %1, i32 %len, 2
|
%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
|
ret { [3 x i8]*, i32, i32 } %2
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%slice.maxcap = icmp ugt i32 %len, 1073741823
|
%slice.maxcap = icmp ugt i32 %len, 1073741823
|
||||||
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
br i1 %slice.maxcap, label %slice.throw, label %slice.next
|
||||||
|
|
||||||
slice.throw: ; preds = %entry
|
slice.throw: ; preds = %entry
|
||||||
call void @runtime.slicePanic(i8* undef, i8* null) #0
|
call void @runtime.slicePanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
slice.next: ; preds = %entry
|
slice.next: ; preds = %entry
|
||||||
%makeslice.cap = shl i32 %len, 2
|
%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*
|
%makeslice.array = bitcast i8* %makeslice.buf to i32*
|
||||||
%0 = insertvalue { i32*, i32, i32 } undef, i32* %makeslice.array, 0
|
%0 = insertvalue { i32*, i32, i32 } undef, i32* %makeslice.array, 0
|
||||||
%1 = insertvalue { i32*, i32, i32 } %0, i32 %len, 1
|
%1 = insertvalue { i32*, i32, i32 } %0, i32 %len, 1
|
||||||
%2 = insertvalue { i32*, i32, i32 } %1, i32 %len, 2
|
%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
|
ret { i32*, i32, i32 } %2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
38
compiler/testdata/string.ll
предоставленный
38
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
|
@"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
|
; 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:
|
entry:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret %runtime._string { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @"main$string", i32 0, i32 0), i32 3 }
|
ret %runtime._string { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @"main$string", i32 0, i32 0), i32 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret %runtime._string zeroinitializer
|
ret %runtime._string zeroinitializer
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
ret i32 %s.len
|
ret i32 %s.len
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
entry:
|
||||||
%.not = icmp ult i32 %index, %s.len
|
%.not = icmp ult i32 %index, %s.len
|
||||||
br i1 %.not, label %lookup.next, label %lookup.throw
|
br i1 %.not, label %lookup.next, label %lookup.throw
|
||||||
|
|
||||||
lookup.throw: ; preds = %entry
|
lookup.throw: ; preds = %entry
|
||||||
call void @runtime.lookupPanic(i8* undef, i8* null) #0
|
call void @runtime.lookupPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
lookup.next: ; preds = %entry
|
lookup.next: ; preds = %entry
|
||||||
|
@ -51,43 +51,43 @@ lookup.next: ; preds = %entry
|
||||||
ret i8 %1
|
ret i8 %1
|
||||||
}
|
}
|
||||||
|
|
||||||
declare void @runtime.lookupPanic(i8*, i8*)
|
declare void @runtime.lookupPanic(i8*)
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
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
|
; 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:
|
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
|
%1 = xor i1 %0, true
|
||||||
ret i1 %1
|
ret i1 %1
|
||||||
}
|
}
|
||||||
|
|
||||||
; Function Attrs: nounwind
|
; 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:
|
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
|
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
|
; 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:
|
entry:
|
||||||
%0 = zext i8 %x to i32
|
%0 = zext i8 %x to i32
|
||||||
%.not = icmp ult i32 %0, %s.len
|
%.not = icmp ult i32 %0, %s.len
|
||||||
br i1 %.not, label %lookup.next, label %lookup.throw
|
br i1 %.not, label %lookup.next, label %lookup.throw
|
||||||
|
|
||||||
lookup.throw: ; preds = %entry
|
lookup.throw: ; preds = %entry
|
||||||
call void @runtime.lookupPanic(i8* undef, i8* null) #0
|
call void @runtime.lookupPanic(i8* undef) #0
|
||||||
unreachable
|
unreachable
|
||||||
|
|
||||||
lookup.next: ; preds = %entry
|
lookup.next: ; preds = %entry
|
||||||
|
|
|
@ -118,7 +118,7 @@ func Run(mod llvm.Module, debug bool) error {
|
||||||
// Create a call to the package initializer (which was
|
// Create a call to the package initializer (which was
|
||||||
// previously deleted).
|
// previously deleted).
|
||||||
i8undef := llvm.Undef(r.i8ptrType)
|
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
|
// Make sure that any globals touched by the package
|
||||||
// initializer, won't be accessed by later package initializers.
|
// initializer, won't be accessed by later package initializers.
|
||||||
r.markExternalLoad(fn)
|
r.markExternalLoad(fn)
|
||||||
|
|
|
@ -444,7 +444,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the type code of the interface value.
|
// 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 {
|
if err != nil {
|
||||||
return nil, mem, r.errorAt(inst, err)
|
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,
|
// Call a function with a definition available. Run it as usual,
|
||||||
// possibly trying to recover from it if it failed to execute.
|
// possibly trying to recover from it if it failed to execute.
|
||||||
if r.debug {
|
if r.debug {
|
||||||
argStrings := make([]string, len(operands)-1)
|
argStrings := make([]string, len(operands))
|
||||||
for i := range argStrings {
|
for i := range argStrings {
|
||||||
argStrings[i] = operands[i+1].String()
|
argStrings[i] = operands[i+1].String()
|
||||||
}
|
}
|
||||||
|
|
24
interp/testdata/revert.ll
предоставленный
24
interp/testdata/revert.ll
предоставленный
|
@ -13,27 +13,27 @@ declare void @externalCall(i64)
|
||||||
|
|
||||||
define void @runtime.initAll() unnamed_addr {
|
define void @runtime.initAll() unnamed_addr {
|
||||||
entry:
|
entry:
|
||||||
call void @baz.init(i8* undef, i8* undef)
|
call void @baz.init(i8* undef)
|
||||||
call void @foo.init(i8* undef, i8* undef)
|
call void @foo.init(i8* undef)
|
||||||
call void @bar.init(i8* undef, i8* undef)
|
call void @bar.init(i8* undef)
|
||||||
call void @main.init(i8* undef, i8* undef)
|
call void @main.init(i8* undef)
|
||||||
call void @x.init(i8* undef, i8* undef)
|
call void @x.init(i8* undef)
|
||||||
call void @y.init(i8* undef, i8* undef)
|
call void @y.init(i8* undef)
|
||||||
ret void
|
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
|
store i64 5, i64* @foo.knownAtRuntime
|
||||||
unreachable ; this triggers a revert of @foo.init.
|
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
|
%val = load i64, i64* @foo.knownAtRuntime
|
||||||
store i64 %val, i64* @bar.knownAtRuntime
|
store i64 %val, i64* @bar.knownAtRuntime
|
||||||
ret void
|
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.
|
; Test extractvalue/insertvalue with more than one index.
|
||||||
%val = load [3 x {i64, i32}], [3 x {i64, i32}]* @baz.someGlobal
|
%val = load [3 x {i64, i32}], [3 x {i64, i32}]* @baz.someGlobal
|
||||||
%part = extractvalue [3 x {i64, i32}] %val, 0, 1
|
%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
|
unreachable ; trigger revert
|
||||||
}
|
}
|
||||||
|
|
||||||
define internal void @main.init(i8* %context, i8* %parentHandle) unnamed_addr {
|
define internal void @main.init(i8* %context) unnamed_addr {
|
||||||
entry:
|
entry:
|
||||||
call void @externalCall(i64 3)
|
call void @externalCall(i64 3)
|
||||||
ret void
|
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.
|
; Test atomic and volatile memory accesses.
|
||||||
store atomic i32 1, i32* @x.atomicNum seq_cst, align 4
|
store atomic i32 1, i32* @x.atomicNum seq_cst, align 4
|
||||||
%x = load atomic i32, 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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
define internal void @y.init(i8* %context, i8* %parentHandle) unnamed_addr {
|
define internal void @y.init(i8* %context) unnamed_addr {
|
||||||
entry:
|
entry:
|
||||||
br label %loop
|
br label %loop
|
||||||
|
|
||||||
|
|
12
interp/testdata/revert.out.ll
предоставленный
12
interp/testdata/revert.out.ll
предоставленный
|
@ -13,8 +13,8 @@ declare void @externalCall(i64) local_unnamed_addr
|
||||||
|
|
||||||
define void @runtime.initAll() unnamed_addr {
|
define void @runtime.initAll() unnamed_addr {
|
||||||
entry:
|
entry:
|
||||||
call fastcc void @baz.init(i8* undef, i8* undef)
|
call fastcc void @baz.init(i8* undef)
|
||||||
call fastcc void @foo.init(i8* undef, i8* undef)
|
call fastcc void @foo.init(i8* undef)
|
||||||
%val = load i64, i64* @foo.knownAtRuntime, align 8
|
%val = load i64, i64* @foo.knownAtRuntime, align 8
|
||||||
store i64 %val, i64* @bar.knownAtRuntime, align 8
|
store i64 %val, i64* @bar.knownAtRuntime, align 8
|
||||||
call void @externalCall(i64 3)
|
call void @externalCall(i64 3)
|
||||||
|
@ -23,20 +23,20 @@ entry:
|
||||||
store i32 %x, i32* @x.atomicNum, align 4
|
store i32 %x, i32* @x.atomicNum, align 4
|
||||||
%y = load volatile i32, i32* @x.volatileNum, align 4
|
%y = load volatile i32, i32* @x.volatileNum, align 4
|
||||||
store volatile i32 %y, 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
|
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
|
store i64 5, i64* @foo.knownAtRuntime, align 8
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
define internal fastcc void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr {
|
define internal fastcc void @baz.init(i8* %context) unnamed_addr {
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
define internal fastcc void @y.init(i8* %context, i8* %parentHandle) unnamed_addr {
|
define internal fastcc void @y.init(i8* %context) unnamed_addr {
|
||||||
entry:
|
entry:
|
||||||
br label %loop
|
br label %loop
|
||||||
|
|
||||||
|
|
|
@ -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
|
// possible types. This is later converted to a switch statement by the LLVM
|
||||||
// simplifycfg pass.
|
// simplifycfg pass.
|
||||||
func (p *lowerInterfacesPass) defineInterfaceMethodFunc(fn llvm.Value, itf *interfaceInfo, signature *signatureInfo) {
|
func (p *lowerInterfacesPass) defineInterfaceMethodFunc(fn llvm.Value, itf *interfaceInfo, signature *signatureInfo) {
|
||||||
parentHandle := fn.LastParam()
|
context := fn.LastParam()
|
||||||
context := llvm.PrevParam(parentHandle)
|
|
||||||
actualType := llvm.PrevParam(context)
|
actualType := llvm.PrevParam(context)
|
||||||
returnType := fn.Type().ElementType().ReturnType()
|
returnType := fn.Type().ElementType().ReturnType()
|
||||||
context.SetName("context")
|
context.SetName("context")
|
||||||
actualType.SetName("actualType")
|
actualType.SetName("actualType")
|
||||||
parentHandle.SetName("parentHandle")
|
|
||||||
fn.SetLinkage(llvm.InternalLinkage)
|
fn.SetLinkage(llvm.InternalLinkage)
|
||||||
fn.SetUnnamedAddr(true)
|
fn.SetUnnamedAddr(true)
|
||||||
AddStandardAttributes(fn, p.config)
|
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.
|
// Collect the params that will be passed to the functions to call.
|
||||||
// These params exclude the receiver (which may actually consist of multiple
|
// These params exclude the receiver (which may actually consist of multiple
|
||||||
// parts).
|
// parts).
|
||||||
params := make([]llvm.Value, fn.ParamsCount()-4)
|
params := make([]llvm.Value, fn.ParamsCount()-3)
|
||||||
for i := range params {
|
for i := range params {
|
||||||
params[i] = fn.Param(i + 1)
|
params[i] = fn.Param(i + 1)
|
||||||
}
|
}
|
||||||
params = append(params,
|
params = append(params,
|
||||||
llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)),
|
llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)),
|
||||||
llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Start chain in the entry block.
|
// 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")
|
nilPanic := p.mod.NamedFunction("runtime.nilPanic")
|
||||||
p.builder.CreateCall(nilPanic, []llvm.Value{
|
p.builder.CreateCall(nilPanic, []llvm.Value{
|
||||||
llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)),
|
llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)),
|
||||||
llvm.Undef(llvm.PointerType(p.ctx.Int8Type(), 0)),
|
|
||||||
}, "")
|
}, "")
|
||||||
p.builder.CreateUnreachable()
|
p.builder.CreateUnreachable()
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ func LowerInterrupts(mod llvm.Module) []error {
|
||||||
var errs []error
|
var errs []error
|
||||||
|
|
||||||
ctx := mod.Context()
|
ctx := mod.Context()
|
||||||
i8ptrType := llvm.PointerType(ctx.Int8Type(), 0)
|
|
||||||
builder := ctx.NewBuilder()
|
builder := ctx.NewBuilder()
|
||||||
defer builder.Dispose()
|
defer builder.Dispose()
|
||||||
|
|
||||||
|
@ -95,7 +94,6 @@ func LowerInterrupts(mod llvm.Module) []error {
|
||||||
builder.CreateCall(funcPtr, []llvm.Value{
|
builder.CreateCall(funcPtr, []llvm.Value{
|
||||||
num,
|
num,
|
||||||
context,
|
context,
|
||||||
llvm.Undef(i8ptrType),
|
|
||||||
}, "")
|
}, "")
|
||||||
}
|
}
|
||||||
call.EraseFromParentAsInstruction()
|
call.EraseFromParentAsInstruction()
|
||||||
|
|
14
transform/testdata/interface.ll
предоставленный
14
transform/testdata/interface.ll
предоставленный
|
@ -10,7 +10,7 @@ target triple = "armv7m-none-eabi"
|
||||||
@"reflect/types.type:basic:int" = private constant %runtime.typecodeID zeroinitializer
|
@"reflect/types.type:basic:int" = private constant %runtime.typecodeID zeroinitializer
|
||||||
@"reflect/methods.NeverImplementedMethod()" = linkonce_odr constant i8 0
|
@"reflect/methods.NeverImplementedMethod()" = linkonce_odr constant i8 0
|
||||||
@"reflect/methods.Double() int" = 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 }
|
@"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*)
|
declare i1 @runtime.typeAssert(i32, i8*)
|
||||||
|
@ -19,7 +19,7 @@ declare void @runtime.printint16(i16)
|
||||||
declare void @runtime.printint32(i32)
|
declare void @runtime.printint32(i32)
|
||||||
declare void @runtime.printptr(i32)
|
declare void @runtime.printptr(i32)
|
||||||
declare void @runtime.printnl()
|
declare void @runtime.printnl()
|
||||||
declare void @runtime.nilPanic(i8*, i8*)
|
declare void @runtime.nilPanic(i8*)
|
||||||
|
|
||||||
define void @printInterfaces() {
|
define void @printInterfaces() {
|
||||||
call void @printInterface(i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* inttoptr (i32 5 to i8*))
|
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
|
br i1 %isDoubler, label %typeswitch.Doubler, label %typeswitch.notDoubler
|
||||||
|
|
||||||
typeswitch.Doubler:
|
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)
|
call void @runtime.printint32(i32 %doubler.result)
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
|
@ -73,18 +73,18 @@ typeswitch.notInt16:
|
||||||
ret void
|
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 = mul i32 %receiver, 2
|
||||||
ret i32 %ret
|
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
|
%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
|
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
|
declare i1 @Doubler$typeassert(i32 %typecode) #1
|
||||||
|
|
||||||
|
|
16
transform/testdata/interface.out.ll
предоставленный
16
transform/testdata/interface.out.ll
предоставленный
|
@ -18,7 +18,7 @@ declare void @runtime.printptr(i32)
|
||||||
|
|
||||||
declare void @runtime.printnl()
|
declare void @runtime.printnl()
|
||||||
|
|
||||||
declare void @runtime.nilPanic(i8*, i8*)
|
declare void @runtime.nilPanic(i8*)
|
||||||
|
|
||||||
define void @printInterfaces() {
|
define void @printInterfaces() {
|
||||||
call void @printInterface(i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* inttoptr (i32 5 to i8*))
|
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
|
br i1 %isDoubler, label %typeswitch.Doubler, label %typeswitch.notDoubler
|
||||||
|
|
||||||
typeswitch.Doubler: ; preds = %typeswitch.notUnmatched
|
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)
|
call void @runtime.printint32(i32 %doubler.result)
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
|
@ -69,28 +69,28 @@ typeswitch.notInt16: ; preds = %typeswitch.notByte
|
||||||
ret void
|
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 = mul i32 %receiver, 2
|
||||||
ret i32 %ret
|
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
|
%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
|
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:
|
entry:
|
||||||
%"named:Number.icmp" = icmp eq i32 %actualType, ptrtoint (%runtime.typecodeID* @"reflect/types.type:named:Number" to i32)
|
%"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"
|
br i1 %"named:Number.icmp", label %"named:Number", label %"named:Number.next"
|
||||||
|
|
||||||
"named:Number": ; preds = %entry
|
"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
|
ret i32 %0
|
||||||
|
|
||||||
"named:Number.next": ; preds = %entry
|
"named:Number.next": ; preds = %entry
|
||||||
call void @runtime.nilPanic(i8* undef, i8* undef)
|
call void @runtime.nilPanic(i8* undef)
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
28
transform/testdata/interrupt.ll
предоставленный
28
transform/testdata/interrupt.ll
предоставленный
|
@ -7,33 +7,33 @@ target triple = "armv7em-none-eabi"
|
||||||
%"runtime/interrupt.handle" = type { i8*, i32, %"runtime/interrupt.Interrupt" }
|
%"runtime/interrupt.handle" = type { i8*, i32, %"runtime/interrupt.Interrupt" }
|
||||||
%"runtime/interrupt.Interrupt" = type { i32 }
|
%"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.UART0 = internal global %machine.UART { %machine.RingBuffer* @"machine$alloc.335" }
|
||||||
@"machine$alloc.335" = internal global %machine.RingBuffer zeroinitializer
|
@"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")
|
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:
|
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.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, 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) })
|
call void @"runtime/interrupt.use"(%"runtime/interrupt.Interrupt" { i32 ptrtoint (%"runtime/interrupt.handle"* @"runtime/interrupt.$interrupt2" to i32) })
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @UARTE0_UART0_IRQHandler() {
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @NFCT_IRQHandler() {
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,22 +45,22 @@ entry:
|
||||||
]
|
]
|
||||||
|
|
||||||
switch.body2:
|
switch.body2:
|
||||||
call void @"runtime/interrupt.callHandlers"(i32 2, i8* undef, i8* undef)
|
call void @"runtime/interrupt.callHandlers"(i32 2, i8* undef)
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
switch.body5:
|
switch.body5:
|
||||||
call void @"runtime/interrupt.callHandlers"(i32 5, i8* undef, i8* undef)
|
call void @"runtime/interrupt.callHandlers"(i32 5, i8* undef)
|
||||||
ret void
|
ret void
|
||||||
|
|
||||||
switch.done:
|
switch.done:
|
||||||
ret void
|
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:
|
entry:
|
||||||
%unpack.ptr = bitcast i8* %context to %machine.UART*
|
%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
|
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)
|
||||||
|
|
22
transform/testdata/interrupt.out.ll
предоставленный
22
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.UART0 = internal global %machine.UART { %machine.RingBuffer* @"machine$alloc.335" }
|
||||||
@"machine$alloc.335" = internal global %machine.RingBuffer zeroinitializer
|
@"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")
|
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:
|
entry:
|
||||||
call void @"device/arm.SetPriority"(i32 2, i32 192, i8* undef, i8* undef)
|
call void @"device/arm.SetPriority"(i32 2, i32 192, i8* undef)
|
||||||
call void @"device/arm.EnableIRQ"(i32 2, i8* undef, i8* undef)
|
call void @"device/arm.EnableIRQ"(i32 2, i8* undef)
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @UARTE0_UART0_IRQHandler() {
|
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
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ entry:
|
||||||
]
|
]
|
||||||
|
|
||||||
switch.body2: ; preds = %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
|
ret void
|
||||||
|
|
||||||
switch.body5: ; preds = %entry
|
switch.body5: ; preds = %entry
|
||||||
|
@ -47,11 +47,11 @@ switch.done: ; preds = %entry
|
||||||
ret void
|
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:
|
entry:
|
||||||
%unpack.ptr = bitcast i8* %context to %machine.UART*
|
%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
|
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)
|
||||||
|
|
10
transform/testdata/reflect-implements.ll
предоставленный
10
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
|
; 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
|
; type of reflect.Type. This function can be optimized because errorType is
|
||||||
; known at compile time (after the interp pass has run).
|
; 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:
|
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
|
ret i1 %result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ entry:
|
||||||
; func isUnknown(typ, itf reflect.Type) bool {
|
; func isUnknown(typ, itf reflect.Type) bool {
|
||||||
; return typ.Implements(itf)
|
; 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:
|
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
|
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
|
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" }
|
attributes #0 = { "tinygo-invoke"="reflect/methods.Implements(reflect.Type) bool" "tinygo-methods"="reflect/methods.Align() int; reflect/methods.Implements(reflect.Type) bool" }
|
||||||
|
|
8
transform/testdata/reflect-implements.out.ll
предоставленный
8
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.rawType$methodset" = linkonce_odr constant [20 x %runtime.interfaceMethodInfo] zeroinitializer
|
||||||
@"reflect/types.type:basic:uintptr" = linkonce_odr constant %runtime.typecodeID 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:
|
entry:
|
||||||
%0 = ptrtoint i8* %typ.value to i32
|
%0 = ptrtoint i8* %typ.value to i32
|
||||||
%1 = call i1 @"error.$typeassert"(i32 %0)
|
%1 = call i1 @"error.$typeassert"(i32 %0)
|
||||||
ret i1 %1
|
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:
|
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
|
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
|
declare i1 @"error.$typeassert"(i32) #1
|
||||||
|
|
||||||
|
|
10
transform/testdata/stringequal.ll
предоставленный
10
transform/testdata/stringequal.ll
предоставленный
|
@ -3,17 +3,17 @@ target triple = "armv7m-none-eabi"
|
||||||
|
|
||||||
@zeroString = constant [0 x i8] zeroinitializer
|
@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:
|
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
|
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:
|
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
|
%1 = xor i1 %0, true
|
||||||
ret i1 %1
|
ret i1 %1
|
||||||
}
|
}
|
||||||
|
|
6
transform/testdata/stringequal.out.ll
предоставленный
6
transform/testdata/stringequal.out.ll
предоставленный
|
@ -3,15 +3,15 @@ target triple = "armv7m-none-eabi"
|
||||||
|
|
||||||
@zeroString = constant [0 x i8] zeroinitializer
|
@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:
|
entry:
|
||||||
%0 = icmp eq i32 %s1.len, 0
|
%0 = icmp eq i32 %s1.len, 0
|
||||||
ret i1 %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:
|
entry:
|
||||||
%0 = icmp eq i32 %s1.len, 0
|
%0 = icmp eq i32 %s1.len, 0
|
||||||
%1 = xor i1 %0, true
|
%1 = xor i1 %0, true
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче