Esempio n. 1
0
        public static LLVMBool RemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M, out LLVMModuleRef OutMod, out string OutError)
        {
            var retVal = RemoveModule(EE, M, out OutMod, out IntPtr message);

            OutError = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Esempio n. 2
0
        public static LLVMBool CreateJITCompilerForModule(out LLVMExecutionEngineRef OutJIT, LLVMModuleRef M, uint OptLevel, out string OutError)
        {
            var retVal = CreateJITCompilerForModule(out OutJIT, M, OptLevel, out IntPtr message);

            OutError = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Esempio 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]));
        }
Esempio n. 4
0
        public static unsafe LLVMBool CreateMCJITCompilerForModule(out LLVMExecutionEngineRef OutJIT, LLVMModuleRef M, LLVMMCJITCompilerOptions Options, out string OutError)
        {
            LLVMBool retVal;
            IntPtr   message;

            retVal = CreateMCJITCompilerForModule(out OutJIT, M, out Options, (IntPtr)(sizeof(LLVMMCJITCompilerOptions)), out message);

            OutError = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Esempio n. 5
0
        public bool TryCreateInterpreter(out LLVMExecutionEngineRef OutInterp, out string OutError)
        {
            fixed(LLVMExecutionEngineRef *pOutInterp = &OutInterp)
            {
                sbyte *pError;
                var    result = LLVM.CreateInterpreterForModule((LLVMOpaqueExecutionEngine **)pOutInterp, this, &pError);

                if (pError is null)
                {
                    OutError = string.Empty;
                }
                else
                {
                    var span = new ReadOnlySpan <byte>(pError, int.MaxValue);
                    OutError = span.Slice(0, span.IndexOf((byte)'\0')).AsString();
                }

                return(result == 0);
            }
        }
Esempio n. 6
0
        public bool TryCreateMCJITCompiler(out LLVMExecutionEngineRef OutJIT, ref LLVMMCJITCompilerOptions Options, out string OutError)
        {
            fixed(LLVMExecutionEngineRef *pOutJIT = &OutJIT)
            fixed(LLVMMCJITCompilerOptions * pOptions = &Options)
            {
                sbyte *pError;
                var    result = LLVM.CreateMCJITCompilerForModule((LLVMOpaqueExecutionEngine **)pOutJIT, this, pOptions, (UIntPtr)Marshal.SizeOf <LLVMMCJITCompilerOptions>(), &pError);

                if (pError is null)
                {
                    OutError = string.Empty;
                }
                else
                {
                    var span = new ReadOnlySpan <byte>(pError, int.MaxValue);
                    OutError = span.Slice(0, span.IndexOf((byte)'\0')).AsString();
                }

                return(result == 0);
            }
        }
Esempio n. 7
0
 public static extern void RunStaticDestructors(LLVMExecutionEngineRef @EE);
Esempio n. 8
0
 public static extern LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @NumArgs, out LLVMGenericValueRef @Args);
Esempio n. 9
0
 public static extern IntPtr RecompileAndRelinkFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @Fn);
Esempio n. 10
0
 public static extern int GetGlobalValueAddress(LLVMExecutionEngineRef @EE, [MarshalAs(UnmanagedType.LPStr)] string @Name);
Esempio n. 11
0
 public static extern void AddModuleProvider(LLVMExecutionEngineRef @EE, LLVMModuleProviderRef @MP);
Esempio n. 12
0
 public static extern void AddModule(LLVMExecutionEngineRef @EE, LLVMModuleRef @M);
Esempio n. 13
0
 public static extern void AddGlobalMapping(LLVMExecutionEngineRef @EE, LLVMValueRef @Global, IntPtr @Addr);
Esempio n. 14
0
        public bool TryCreateMCJITCompiler(out LLVMExecutionEngineRef OutJIT, out string OutError)
        {
            var Options = LLVMMCJITCompilerOptions.Create();

            return(TryCreateMCJITCompiler(out OutJIT, ref Options, out OutError));
        }
Esempio n. 15
0
 public static extern LLVMTargetDataRef GetExecutionEngineTargetData(LLVMExecutionEngineRef @EE);
Esempio n. 16
0
 public static extern LLVMTargetMachineRef GetExecutionEngineTargetMachine(LLVMExecutionEngineRef @EE);
Esempio n. 17
0
 public static extern LLVMBool CreateInterpreter(out LLVMExecutionEngineRef @OutInterp, LLVMModuleProviderRef @MP, out IntPtr @OutError);
Esempio n. 18
0
 public static extern IntPtr GetPointerToGlobal(LLVMExecutionEngineRef @EE, LLVMValueRef @Global);
Esempio n. 19
0
 public static extern LLVMBool CreateInterpreterForModule(out LLVMExecutionEngineRef @OutInterp, LLVMModuleRef @M, out IntPtr @OutError);
Esempio n. 20
0
 public static extern LLVMBool RemoveModuleProvider(LLVMExecutionEngineRef @EE, LLVMModuleProviderRef @MP, out LLVMModuleRef @OutMod, out IntPtr @OutError);
Esempio n. 21
0
 public static extern LLVMBool CreateJITCompilerForModule(out LLVMExecutionEngineRef @OutJIT, LLVMModuleRef @M, uint @OptLevel, out IntPtr @OutError);
Esempio n. 22
0
 public static extern int RunFunctionAsMain(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @ArgC, string[] @ArgV, string[] @EnvP);
Esempio n. 23
0
 public static extern LLVMBool CreateMCJITCompilerForModule(out LLVMExecutionEngineRef @OutJIT, LLVMModuleRef @M, out LLVMMCJITCompilerOptions @Options, int @SizeOfOptions, out IntPtr @OutError);
Esempio n. 24
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]);
        }
Esempio n. 25
0
 public static extern void DisposeExecutionEngine(LLVMExecutionEngineRef @EE);
Esempio n. 26
0
 public static extern LLVMBool FindFunction(LLVMExecutionEngineRef @EE, [MarshalAs(UnmanagedType.LPStr)] string @Name, out LLVMValueRef @OutFn);
Esempio n. 27
0
 public static extern void FreeMachineCodeForFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F);
Esempio n. 28
0
 internal ExecutionEngine(LLVMExecutionEngineRef ee)
 {
     this.instance = ee;
 }
Esempio n. 29
0
 internal ExecutionEngine(LLVMExecutionEngineRef ee)
 {
     this.instance = ee;
 }