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

Method insertBasicBlock

compiler/llvm.go:33–43  ·  view source on GitHub ↗

insertBasicBlock inserts a new basic block after the current basic block. This is useful when inserting new basic blocks while converting a *ssa.BasicBlock to a llvm.BasicBlock and the LLVM basic block needs some extra blocks. It does not update b.blockExits, this must be done by the caller.

(name string)

Source from the content-addressed store, hash-verified

31// extra blocks.
32// It does not update b.blockExits, this must be done by the caller.
33func (b *builder) insertBasicBlock(name string) llvm.BasicBlock {
34 currentBB := b.Builder.GetInsertBlock()
35 nextBB := llvm.NextBasicBlock(currentBB)
36 if nextBB.IsNil() {
37 // Last basic block in the function, so add one to the end.
38 return b.ctx.AddBasicBlock(b.llvmFn, name)
39 }
40 // Insert a basic block before the next basic block - that is, at the
41 // current insert location.
42 return b.ctx.InsertBasicBlock(nextBB, name)
43}
44
45// emitLifetimeEnd signals the end of an (alloca) lifetime by calling the
46// llvm.lifetime.end intrinsic. It is commonly used together with

Callers 6

createRunDefersMethod · 0.95
createTypeAssertMethod · 0.95
createRuntimeAssertMethod · 0.95
createSyscallnMethod · 0.95
createInstructionMethod · 0.95

Calls 1

IsNilMethod · 0.80

Tested by

no test coverage detected