From d9ab5a58cf78fbfb02a3e9905810bfc169962fca Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 11 Jan 2017 20:25:40 -0800 Subject: [PATCH] Add some methods to llvm_wrap --- src/llvm_wrap.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/llvm_wrap.rs b/src/llvm_wrap.rs index 5438fd5..4b89176 100644 --- a/src/llvm_wrap.rs +++ b/src/llvm_wrap.rs @@ -147,6 +147,21 @@ pub fn BuildBr(builder: LLVMBuilderRef, unsafe { core::LLVMBuildBr(builder, dest) } } +pub fn GetInsertBlock(builder: LLVMBuilderRef) -> LLVMBasicBlockRef { + unsafe { core::LLVMGetInsertBlock(builder) } +} + +pub fn BuildPhi(builder: LLVMBuilderRef, ty: LLVMTypeRef, name: &str) -> LLVMValueRef { + let name = CString::new(name).unwrap(); + unsafe { core::LLVMBuildPhi(builder, ty, name.as_ptr()) } +} + +pub fn AddIncoming(phi: LLVMValueRef, incoming_values: *mut LLVMValueRef, incoming_blocks: *mut LLVMBasicBlockRef, + count: u32) { + + unsafe { core::LLVMAddIncoming(phi, incoming_values, incoming_blocks, count) } +} + pub fn BuildICmp(builder: LLVMBuilderRef, op: LLVMIntPredicate, lhs: LLVMValueRef,