示例#1
0
        public void Delete()
        {
            if(m_handle == null)
                throw new InvalidOperationException("BasicBlock is null");

            Native.DeleteBasicBlock(m_handle);
            m_handle = null;
        }
示例#2
0
        public BasicBlock(string name, Function function)
        {
            Guard.ArgumentNull(name, "name");
            Guard.ArgumentNull(function, "function");

            m_handle = Native.AppendBasicBlock(function.Handle, name);
            m_name = name;
        }
示例#3
0
        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;
        }
示例#4
0
文件: IRBuilder.cs 项目: mcwchitos/CC
        public BasicBlock GetInsertPoint()
        {
            LLVMBasicBlockRef *bb = Native.GetInsertBlock(m_builder);

            if (bb == null)
            {
                return(null);
            }

            return(new BasicBlock(null, bb));
        }
示例#5
0
文件: IRBuilder.cs 项目: mcwchitos/CC
        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));
        }
示例#6
0
 public BasicBlock(string name, LLVMBasicBlockRef *handle)
     : base((LLVMValueRef *)handle)
 {
     m_name = name;  // base.name, calls LLVM API to fetch Value name
 }