public void Delete() { if(m_handle == null) throw new InvalidOperationException("BasicBlock is null"); Native.DeleteBasicBlock(m_handle); m_handle = null; }
public BasicBlock(string name, Function function) { Guard.ArgumentNull(name, "name"); Guard.ArgumentNull(function, "function"); m_handle = Native.AppendBasicBlock(function.Handle, name); m_name = name; }
public BasicBlock(string name, LLVMBasicBlockRef* handle) { if(handle == null) throw new ArgumentNullException("handle"); if(name == null) name = Value.GetName((LLVMValueRef*)handle); m_handle = handle; m_name = name; }
public BasicBlock GetInsertPoint() { LLVMBasicBlockRef *bb = Native.GetInsertBlock(m_builder); if (bb == null) { return(null); } return(new BasicBlock(null, bb)); }
public Value BuildEntryBlockAlloca(Function function, TypeRef type, string varName = tmpvarname) { LLVMBasicBlockRef *block = Native.GetInsertBlock(m_builder); LLVMBasicBlockRef *entry = Native.GetEntryBasicBlock(function.Handle); Native.PositionBuilderAtEnd(m_builder, entry); LLVMValueRef *alloca = Native.BuildAlloca(m_builder, type.Handle, varName); Native.PositionBuilderAtEnd(m_builder, block); return(new Value(alloca)); }
public BasicBlock(string name, LLVMBasicBlockRef *handle) : base((LLVMValueRef *)handle) { m_name = name; // base.name, calls LLVM API to fetch Value name }