Esempio n. 1
0
        public LLVMExecutionEngineRef CreateMCJITCompiler(ref LLVMMCJITCompilerOptions Options)
        {
            if (!TryCreateMCJITCompiler(out LLVMExecutionEngineRef JIT, ref Options, out string Error))
            {
                throw new ExternalException(Error);
            }

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

                if (pError == 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. 3
0
        public bool TryCreateMCJITCompiler(out LLVMExecutionEngineRef OutJIT, out string OutError)
        {
            var Options = LLVMMCJITCompilerOptions.Create();

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