readStackPointer emits a LLVM intrinsic call that returns the current stack pointer as an *i8.
()
| 440 | // readStackPointer emits a LLVM intrinsic call that returns the current stack |
| 441 | // pointer as an *i8. |
| 442 | func (b *builder) readStackPointer() llvm.Value { |
| 443 | name := "llvm.stacksave.p0" |
| 444 | if llvmutil.Version() < 18 { |
| 445 | name = "llvm.stacksave" // backwards compatibility with LLVM 17 and below |
| 446 | } |
| 447 | stacksave := b.mod.NamedFunction(name) |
| 448 | if stacksave.IsNil() { |
| 449 | fnType := llvm.FunctionType(b.dataPtrType, nil, false) |
| 450 | stacksave = llvm.AddFunction(b.mod, name, fnType) |
| 451 | } |
| 452 | return b.CreateCall(stacksave.GlobalValueType(), stacksave, nil, "") |
| 453 | } |
| 454 | |
| 455 | // writeStackPointer emits a LLVM intrinsic call that updates the current stack |
| 456 | // pointer. |
no test coverage detected