diff options
Diffstat (limited to 'src/llvm/value.rs')
-rw-r--r-- | src/llvm/value.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/llvm/value.rs b/src/llvm/value.rs index 9b79c69..219c855 100644 --- a/src/llvm/value.rs +++ b/src/llvm/value.rs @@ -1,8 +1,9 @@ use llvm_sys::{ analysis::{LLVMVerifierFailureAction, LLVMVerifyFunction}, core::{ - LLVMCountBasicBlocks, LLVMCountParams, LLVMDumpValue, LLVMGetParam, LLVMGetReturnType, - LLVMGetValueKind, LLVMGetValueName2, LLVMSetValueName2, LLVMTypeOf, + LLVMAppendExistingBasicBlock, LLVMCountBasicBlocks, LLVMCountParams, LLVMDumpValue, + LLVMGetParam, LLVMGetReturnType, LLVMGetValueKind, LLVMGetValueName2, LLVMSetValueName2, + LLVMTypeOf, }, prelude::LLVMValueRef, LLVMTypeKind, LLVMValueKind, @@ -12,6 +13,7 @@ use std::ffi::CStr; use std::marker::PhantomData; use std::ops::Deref; +use super::BasicBlock; use super::Type; /// Wrapper for a LLVM Value Reference. @@ -156,6 +158,13 @@ impl<'llvm> FnValue<'llvm> { unsafe { LLVMCountBasicBlocks(self.value_ref()) as usize } } + /// Append a Basic Block to the end of the function value. + pub fn append_basic_block(&self, bb: BasicBlock<'llvm>) { + unsafe { + LLVMAppendExistingBasicBlock(self.value_ref(), bb.bb_ref()); + } + } + /// Verify that the given function is valid. pub fn verify(&self) -> bool { unsafe { |