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

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