Example #1
0
        public static void AddIncoming(LLVMValueRef PhiNode, LLVMValueRef[] IncomingValues, LLVMBasicBlockRef[] IncomingBlocks, uint Count)
        {
            if (Count == 0)
            {
                return;
            }

            AddIncoming(PhiNode, out IncomingValues[0], out IncomingBlocks[0], Count);
        }
Example #2
0
 public FnCompiler(DetailLogger log, SymbolTableWalker walker,
     LLVMContextRef context, LLVMModuleRef module, LLVMBuilderRef builder, LLVMValueRef self)
 {
     this.log = log;
     this.walker = walker;
     this.context = context;
     this.module = module;
     this.builder = builder;
     this.self = self;
 }
Example #3
0
        public static LLVMValueRef BuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer, LLVMValueRef[] Indices, string Name)
        {
            if (Indices.Length == 0)
            {
                LLVMValueRef dummy;
                return BuildInBoundsGEP(B, Pointer, out dummy, 0, Name);
            }

            return BuildInBoundsGEP(B, Pointer, out Indices[0], (uint)Indices.Length, Name);
        }
Example #4
0
        public static LLVMValueRef ConstArray(LLVMTypeRef ElementTy, LLVMValueRef[] ConstantVals)
        {
            if (ConstantVals.Length == 0)
            {
                LLVMValueRef dummy;
                return ConstArray(ElementTy, out dummy, 0);
            }

            return ConstArray(ElementTy, out ConstantVals[0], (uint)ConstantVals.Length);
        }
Example #5
0
        public static LLVMValueRef BuildInvoke(LLVMBuilderRef param0, LLVMValueRef Fn, LLVMValueRef[] Args, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, string Name)
        {
            if (Args.Length == 0)
            {
                LLVMValueRef dummy;
                return BuildInvoke(param0, Fn, out dummy, 0, Then, Catch, Name);
            }

            return BuildInvoke(param0, Fn, out Args[0], (uint)Args.Length, Then, Catch, Name);
        }
Example #6
0
        public static LLVMValueRef ConstExtractValue(LLVMValueRef AggConstant, uint[] IdxList)
        {
            if (IdxList.Length == 0)
            {
                uint dummy;
                return ConstExtractValue(AggConstant, out dummy, 0);
            }

            return ConstExtractValue(AggConstant, out IdxList[0], (uint)IdxList.Length);
        }
Example #7
0
        public void SetLLVMRegister(string variableName, ClepsType variableType, LLVMValueRef llvmValueRef)
        {
            var localVariablesBlockWithVar = LocalVariableBlocks.Where(b => b.ContainsKey(variableName)).LastOrDefault();
            Debug.Assert(localVariablesBlockWithVar != null);
            
            LLVMRegister ret = localVariablesBlockWithVar[variableName];
            Debug.Assert(ret.VariableType == variableType);

            localVariablesBlockWithVar[variableName] = new LLVMRegister(variableType, llvmValueRef);
        }
Example #8
0
        public static LLVMValueRef BuildCall(LLVMBuilderRef param0, LLVMValueRef Fn, LLVMValueRef[] Args, string Name)
        {
            if (Args.Length == 0)
            {
                LLVMValueRef dummy;
                return BuildCall(param0, Fn, out dummy, 0, Name);
            }

            return BuildCall(param0, Fn, out Args[0], (uint)Args.Length, Name);
        }
Example #9
0
        public static LLVMValueRef MDNode(LLVMValueRef[] Vals)
        {
            if (Vals.Length == 0)
            {
                LLVMValueRef dummy;
                return MDNode(out dummy, 0);
            }

            return MDNode(out Vals[0], (uint)Vals.Length);
        }
Example #10
0
        public static LLVMValueRef[] GetMDNodeOperands(LLVMValueRef V)
        {
            uint count = GetMDNodeNumOperands(V);
            var buffer = new LLVMValueRef[count];

            if (count > 0)
            {
                GetMDNodeOperands(V, out buffer[0]);
            }

            return buffer;
        }
Example #11
0
        public static LLVMValueRef[] GetParams(LLVMValueRef Fn)
        {
            uint count = CountParams(Fn);
            var buffer = new LLVMValueRef[count];

            if (count > 0)
            {
                GetParams(Fn, out buffer[0]);
            }

            return buffer;
        }
Example #12
0
 internal ReturnInst(LLVMValueRef handle) : base(handle.IsAReturnInst)
 {
 }
Example #13
0
 public LLVMGenericValueRef RunFunction(LLVMValueRef @F, LLVMGenericValueRef[] @Args)
 {
     return(LLVM.RunFunction(this.instance, @F, @Args));
 }
Example #14
0
 public LLVMBasicBlockRef AppendBasicBlockInContext(LLVMValueRef @Fn, string @Name)
 {
     return LLVM.AppendBasicBlockInContext(this, @Fn, @Name);
 }
Example #15
0
 public int RunFunctionAsMain(LLVMValueRef @F, uint @ArgC, string[] @ArgV, string[] @EnvP)
 {
     return LLVM.RunFunctionAsMain(this.instance, @F, @ArgC, @ArgV, @EnvP);
 }
Example #16
0
 public static extern LLVMValueRef DIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef @D, LLVMValueRef @Storage, LLVMMetadataRef @VarInfo, LLVMMetadataRef @Expr, LLVMBasicBlockRef @Block);
Example #17
0
 public static extern LLVMValueRef DIBuilderInsertValueAtEnd(LLVMDIBuilderRef @D, LLVMValueRef @Val, ulong @Offset, LLVMMetadataRef @VarInfo, LLVMMetadataRef @Expr, LLVMBasicBlockRef @Block);
 private protected UnaryInstruction(LLVMValueRef handle) : base(handle.IsAUnaryInstruction)
 {
 }
Example #19
0
 internal BitCastInst(LLVMValueRef handle) : base(handle.IsABitCastInst)
 {
 }
 internal static new UnaryInstruction Create(LLVMValueRef handle) => handle switch
 {
Example #21
0
 public bool FindFunction(string @Name, out LLVMValueRef @OutFn)
 {
     return(LLVM.FindFunction(this.instance, @Name, out @OutFn));
 }
Example #22
0
 public void FreeMachineCodeForFunction(LLVMValueRef @F)
 {
     LLVM.FreeMachineCodeForFunction(this.instance, @F);
 }
Example #23
0
 public IntPtr GetPointerToGlobal(LLVMValueRef @Global)
 {
     return(LLVM.GetPointerToGlobal(this.instance, @Global));
 }
Example #24
0
 public static extern ulong GetFunctionAttr2(LLVMValueRef @Fn);
Example #25
0
 internal FenceInst(LLVMValueRef handle) : base(handle.IsAFenceInst)
 {
 }
Example #26
0
 public static extern void RemoveFunctionAttr2(LLVMValueRef @Fn, ulong @PA);
Example #27
0
 public IntPtr RecompileAndRelinkFunction(LLVMValueRef @Fn)
 {
     return LLVM.RecompileAndRelinkFunction(this.instance, @Fn);
 }
Example #28
0
        public static LLVMValueRef ConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef[] ConstantVals)
        {
            if (ConstantVals.Length == 0)
            {
                LLVMValueRef dummy;
                return ConstNamedStruct(StructTy, out dummy, 0);
            }

            return ConstNamedStruct(StructTy, out ConstantVals[0], (uint)ConstantVals.Length);
        }
Example #29
0
 public bool FindFunction(string @Name, out LLVMValueRef @OutFn)
 {
     return LLVM.FindFunction(this.instance, @Name, out @OutFn);
 }
Example #30
0
        public static LLVMValueRef ConstVector(LLVMValueRef[] ScalarConstantVars)
        {
            if (ScalarConstantVars.Length == 0)
            {
                LLVMValueRef dummy;
                return ConstVector(out dummy, 0);
            }

            return ConstVector(out ScalarConstantVars[0], (uint)ScalarConstantVars.Length);
        }
Example #31
0
 public static extern LLVMMetadataRef ConstantAsMetadata(LLVMValueRef @Val);
Example #32
0
 public int RunFunctionAsMain(LLVMValueRef @F, uint @ArgC, string[] @ArgV, string[] @EnvP)
 {
     return(LLVM.RunFunctionAsMain(this.instance, @F, @ArgC, @ArgV, @EnvP));
 }
Example #33
0
        public static LLVMValueRef ConstStructInContext(LLVMContextRef C, LLVMValueRef[] ConstantVals, bool Packed)
        {
            if (ConstantVals.Length == 0)
            {
                LLVMValueRef dummy;
                return ConstStructInContext(C, out dummy, 0, Packed);
            }

            return ConstStructInContext(C, out ConstantVals[0], (uint)ConstantVals.Length, Packed);
        }
Example #34
0
 public static extern void SetMetadata2(LLVMValueRef @Inst, uint @KindID, LLVMMetadataRef @MD);
Example #35
0
 public static LLVMValueRef BuildAggregateRet(LLVMBuilderRef param0, LLVMValueRef[] RetVals)
 {
     return BuildAggregateRet(param0, out RetVals[0], (uint)RetVals.Length);
 }
Example #36
0
 public static extern LLVMMetadataRef DIBuilderCreateFunction(LLVMDIBuilderRef @D, LLVMMetadataRef @Scope, [MarshalAs(UnmanagedType.LPStr)] string @Name, [MarshalAs(UnmanagedType.LPStr)] string @LinkageName, LLVMMetadataRef @File, uint @Line, LLVMMetadataRef @CompositeType, int @IsLocalToUnit, int @IsDefinition, uint @ScopeLine, uint @Flags, int @IsOptimized, LLVMValueRef @Function);
Example #37
0
        public static LLVMValueRef[] GetNamedMetadataOperands(LLVMModuleRef M, string name)
        {
            uint count = GetNamedMetadataNumOperands(M, name);
            var buffer = new LLVMValueRef[count];

            if (count > 0)
            {
                GetNamedMetadataOperands(M, name, out buffer[0]);
            }

            return buffer;
        }
Example #38
0
 internal static new CmpInst Create(LLVMValueRef handle) => handle switch
 {
Example #39
0
        public static LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F, LLVMGenericValueRef[] Args)
        {
            if (Args.Length == 0)
            {
                LLVMGenericValueRef dummy;
                return RunFunction(EE, F, 0, out dummy);
            }

            return RunFunction(EE, F, (uint)Args.Length, out Args[0]);
        }
Example #40
0
 public IntPtr RecompileAndRelinkFunction(LLVMValueRef @Fn)
 {
     return(LLVM.RecompileAndRelinkFunction(this.instance, @Fn));
 }
Example #41
0
        public static LLVMValueRef MDNodeInContext(LLVMContextRef C, LLVMValueRef[] Vals)
        {
            if (Vals.Length == 0)
            {
                LLVMValueRef dummy;
                return MDNodeInContext(C, out dummy, 0);
            }

            return MDNodeInContext(C, out Vals[0], (uint)Vals.Length);
        }
Example #42
0
 public void AddGlobalMapping(LLVMValueRef @Global, IntPtr @Addr)
 {
     LLVM.AddGlobalMapping(this.instance, @Global, @Addr);
 }
Example #43
0
 private protected CmpInst(LLVMValueRef handle) : base(handle.IsACmpInst)
 {
 }
Example #44
0
 internal ConstantInt(LLVMValueRef handle) : base(handle.IsAConstantInt, LLVMValueKind.LLVMConstantIntValueKind)
 {
 }
Example #45
0
        public static LLVMValueRef ConstGEP(LLVMValueRef ConstantVal, LLVMValueRef[] ConstantIndices)
        {
            if (ConstantIndices.Length == 0)
            {
                LLVMValueRef dummy;
                return ConstGEP(ConstantVal, out dummy, 0);
            }

            return ConstGEP(ConstantVal, out ConstantIndices[0], (uint)ConstantIndices.Length);
        }
Example #46
0
 public LLVMValueRef MDNodeInContext(LLVMValueRef[] @Vals)
 {
     return LLVM.MDNodeInContext(this, @Vals);
 }
Example #47
0
 internal LoadInst(LLVMValueRef handle) : base(handle.IsALoadInst)
 {
 }
Example #48
0
 internal GlobalIFunc(LLVMValueRef handle) : base(handle.IsAGlobalIFunc, LLVMValueKind.LLVMGlobalIFuncValueKind)
 {
 }
Example #49
0
 public ScoreVal(Span span, TyRef ty, LLVMValueRef value)
 {
     this.ty = ty;
     this.value = value;
 }
Example #50
0
 internal Function(LLVMValueRef handle) : base(handle.IsAFunction, LLVMValueKind.LLVMFunctionValueKind)
 {
 }
Example #51
0
 public LLVMValueRef ConstStructInContext(LLVMValueRef[] @ConstantVals, bool @Packed)
 {
     return LLVM.ConstStructInContext(this, @ConstantVals, @Packed);
 }
Example #52
0
 internal BlockAddress(LLVMValueRef handle) : base(handle.IsABlockAddress, LLVMValueKind.LLVMBlockAddressValueKind)
 {
 }
Example #53
0
 public IntPtr GetPointerToGlobal(LLVMValueRef @Global)
 {
     return LLVM.GetPointerToGlobal(this.instance, @Global);
 }
Example #54
0
 internal InsertElementInst(LLVMValueRef handle) : base(handle.IsAInsertElementInst)
 {
 }
Example #55
0
 public LLVMGenericValueRef RunFunction(LLVMValueRef @F, LLVMGenericValueRef[] @Args)
 {
     return LLVM.RunFunction(this.instance, @F, @Args);
 }
 internal ConstantDataArray(LLVMValueRef handle) : base(handle.IsAConstantDataArray, LLVMValueKind.LLVMConstantDataArrayValueKind)
 {
 }
Example #57
0
 public void AddGlobalMapping(LLVMValueRef @Global, IntPtr @Addr)
 {
     LLVM.AddGlobalMapping(this.instance, @Global, @Addr);
 }
 public Int32CompilerResult(LLVMValueRef reference)
 {
     this.reference = reference;
 }
Example #59
0
 public void FreeMachineCodeForFunction(LLVMValueRef @F)
 {
     LLVM.FreeMachineCodeForFunction(this.instance, @F);
 }
 internal AtomicCmpXchgInst(LLVMValueRef handle) : base(handle.IsAAtomicCmpXchgInst)
 {
 }