MCPcopy Index your code
hub / github.com/tinygo-org/tinygo / writeStackPointer

Method writeStackPointer

compiler/llvm.go:457–468  ·  view source on GitHub ↗

writeStackPointer emits a LLVM intrinsic call that updates the current stack pointer.

(sp llvm.Value)

Source from the content-addressed store, hash-verified

455// writeStackPointer emits a LLVM intrinsic call that updates the current stack
456// pointer.
457func (b *builder) writeStackPointer(sp llvm.Value) {
458 name := "llvm.stackrestore.p0"
459 if llvmutil.Version() < 18 {
460 name = "llvm.stackrestore" // backwards compatibility with LLVM 17 and below
461 }
462 stackrestore := b.mod.NamedFunction(name)
463 if stackrestore.IsNil() {
464 fnType := llvm.FunctionType(b.ctx.VoidType(), []llvm.Type{b.dataPtrType}, false)
465 stackrestore = llvm.AddFunction(b.mod, name, fnType)
466 }
467 b.CreateCall(stackrestore.GlobalValueType(), stackrestore, []llvm.Value{sp}, "")
468}
469
470// createZExtOrTrunc lets the input value fit in the output type bits, by zero
471// extending or truncating the integer.

Callers 2

createSyscallMethod · 0.95
createSyscallnMethod · 0.95

Calls 2

VersionFunction · 0.92
IsNilMethod · 0.80

Tested by

no test coverage detected