Exemplo n.º 1
0
 public LLVMGenericValueRef RunFunction(LLVMValueRef @F, LLVMGenericValueRef[] @Args)
 {
     return LLVM.RunFunction(this.instance, @F, @Args);
 }
Exemplo n.º 2
0
 public static extern LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @NumArgs, out LLVMGenericValueRef @Args);
Exemplo n.º 3
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]);
        }
Exemplo n.º 4
0
 public static extern ulong GenericValueToInt(LLVMGenericValueRef @GenVal, LLVMBool @IsSigned);
Exemplo n.º 5
0
 public static extern IntPtr GenericValueToPointer(LLVMGenericValueRef @GenVal);
Exemplo n.º 6
0
 public static extern uint GenericValueIntWidth(LLVMGenericValueRef @GenValRef);
Exemplo n.º 7
0
 public static extern double GenericValueToFloat(LLVMTypeRef @TyRef, LLVMGenericValueRef @GenVal);
Exemplo n.º 8
0
 public static extern void DisposeGenericValue(LLVMGenericValueRef @GenVal);
Exemplo n.º 9
0
 public double GenericValueToFloat(LLVMGenericValueRef @GenVal)
 {
     return LLVM.GenericValueToFloat(this, @GenVal);
 }
Exemplo n.º 10
0
 public double GenericValueToFloat(LLVMGenericValueRef @GenVal)
 {
     return(LLVM.GenericValueToFloat(this, @GenVal));
 }
Exemplo n.º 11
0
 public double GenericValueToFloat(LLVMGenericValueRef GenVal) => LLVM.GenericValueToFloat(this, GenVal);
Exemplo n.º 12
0
        public int RunJit()
        {
            if (_main.Pointer == IntPtr.Zero)
            {
                throw new Exception("No main() found.");
            }

            //LLVM.LinkInInterpreter();
            //LLVM.LinkInMCJIT();

            LLVMExecutionEngineRef EE;
            IntPtr error;
            if (LLVM.CreateExecutionEngineForModule(out EE, _module, out error))
            {
                string errMessage = Marshal.PtrToStringAuto(error);
                throw new Exception(string.Format("Failed to create execution engine: \'{0}\'", errMessage));
            }

            LLVM.DisposeMessage(error);

            Debug.WriteLine("calling main()");
            // Call the main function with no arguments:
            LLVMGenericValueRef[] noargs = new LLVMGenericValueRef[0];
            LLVMGenericValueRef gv = LLVM.RunFunction(EE, _main, noargs);

            int statusCode = (int)LLVM.GenericValueToInt(gv, true);
            Debug.WriteLine("Result: {0}", statusCode);

            return statusCode;
        }