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)
| 31 | // extra blocks. |
| 32 | // It does not update b.blockExits, this must be done by the caller. |
| 33 | func (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 |
no test coverage detected