Пример #1
0
 public static void InitializeMCJITCompilerOptions(LLVMMCJITCompilerOptions Options)
 {
     unsafe
     {
         InitializeMCJITCompilerOptions(&Options, sizeof(LLVMMCJITCompilerOptions));
     }
 }
Пример #2
0
        public LLVMExecutionEngineRef CreateMCJITCompiler(ref LLVMMCJITCompilerOptions Options)
        {
            if (!TryCreateMCJITCompiler(out LLVMExecutionEngineRef JIT, ref Options, out string Error))
            {
                throw new ExternalException(Error);
            }

            return(JIT);
        }
Пример #3
0
        public static ExecutionEngine CreateMCJITCompiler(Module module, LLVMMCJITCompilerOptions options)
        {
            LLVM.InitializeMCJITCompilerOptions(options);
            if (LLVM.CreateMCJITCompilerForModule(out var instance, module.instance, options, out var error))
            {
                ThrowError(error);
            }

            return(new ExecutionEngine(instance));
        }
Пример #4
0
        public static ExecutionEngine CreateMCJITCompiler(Module module, LLVMMCJITCompilerOptions options, int optionsSize)
        {
            LLVM.InitializeMCJITCompilerOptions(out options, optionsSize);

            IntPtr error;
            LLVMExecutionEngineRef instance;
            if (LLVM.CreateMCJITCompilerForModule(out instance, module.instance, out options, optionsSize, out error))
            {
                ThrowError(error);
            }

            return new ExecutionEngine(instance);
        }
Пример #5
0
        public static ExecutionEngine CreateMCJITCompiler(Module module, LLVMMCJITCompilerOptions options, size_t optionsSize)
        {
            LLVM.InitializeMCJITCompilerOptions(out options, optionsSize);

            IntPtr error;
            LLVMExecutionEngineRef instance;

            if (LLVM.CreateMCJITCompilerForModule(out instance, module.instance, out options, optionsSize, out error))
            {
                ThrowError(error);
            }

            return(new ExecutionEngine(instance));
        }
Пример #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);
            }
        }
Пример #7
0
        public static LLVMBool CreateMCJITCompilerForModule(out LLVMExecutionEngineRef OutJIT, LLVMModuleRef M, LLVMMCJITCompilerOptions Options, out string OutError)
        {
            LLVMBool retVal;
            IntPtr   message;

            unsafe
            {
                retVal = CreateMCJITCompilerForModule(out OutJIT, M, &Options, sizeof(LLVMMCJITCompilerOptions), out message);
            }

            OutError = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Пример #8
0
 public static extern void InitializeMCJITCompilerOptions(out LLVMMCJITCompilerOptions @Options, int @SizeOfOptions);
Пример #9
0
 public static extern LLVMBool CreateMCJITCompilerForModule(out LLVMExecutionEngineRef @OutJIT, LLVMModuleRef @M, out LLVMMCJITCompilerOptions @Options, int @SizeOfOptions, out IntPtr @OutError);
Пример #10
0
 public static unsafe void InitializeMCJITCompilerOptions(LLVMMCJITCompilerOptions Options)
 {
     InitializeMCJITCompilerOptions(out Options, (IntPtr)(sizeof(LLVMMCJITCompilerOptions)));
 }
Пример #11
0
        public bool TryCreateMCJITCompiler(out LLVMExecutionEngineRef OutJIT, out string OutError)
        {
            var Options = LLVMMCJITCompilerOptions.Create();

            return(TryCreateMCJITCompiler(out OutJIT, ref Options, out OutError));
        }