Exemple #1
0
        public static LLVMBool CreateMemoryBufferWithSTDIN(out LLVMMemoryBufferRef OutMemBuf, out string OutMessage)
        {
            var retVal = CreateMemoryBufferWithSTDIN(out OutMemBuf, out IntPtr message);

            OutMessage = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Exemple #2
0
        public static LLVMBool ParseIRInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, out LLVMModuleRef OutM, out string OutMessage)
        {
            var retVal = ParseIRInContext(ContextRef, MemBuf, out OutM, out IntPtr message);

            OutMessage = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Exemple #3
0
        public static LLVMBool GetBitcodeModule(LLVMMemoryBufferRef MemBuf, out LLVMModuleRef OutM, out string OutMessage)
        {
            var retVal = GetBitcodeModule(MemBuf, out OutM, out IntPtr message);

            OutMessage = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Exemple #4
0
        public LLVMModuleRef ParseIR(LLVMMemoryBufferRef MemBuf)
        {
            if (!TryParseIR(MemBuf, out LLVMModuleRef M, out string Message))
            {
                throw new ExternalException(Message);
            }

            return(M);
        }
Exemple #5
0
        public LLVMModuleRef GetBitcodeModule(LLVMMemoryBufferRef MemBuf)
        {
            if (!TryGetBitcodeModule(MemBuf, out LLVMModuleRef M, out string Message))
            {
                throw new ExternalException(Message);
            }

            return(M);
        }
Exemple #6
0
        public bool TryParseIR(LLVMMemoryBufferRef MemBuf, out LLVMModuleRef OutM, out string OutMessage)
        {
            fixed(LLVMModuleRef *pOutM = &OutM)
            {
                sbyte *pMessage;
                var    result = LLVM.ParseIRInContext(this, MemBuf, (LLVMOpaqueModule **)pOutM, &pMessage);

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

                return(result == 0);
            }
        }
Exemple #7
0
 public static extern int GetBufferSize(LLVMMemoryBufferRef @MemBuf);
 public bool GetBitcodeModuleProviderInContext(LLVMMemoryBufferRef @MemBuf, out LLVMModuleProviderRef @OutMP, out IntPtr @OutMessage)
 {
     return LLVM.GetBitcodeModuleProviderInContext(this, @MemBuf, out @OutMP, out @OutMessage);
 }
 public bool ParseIRInContext(LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage)
 {
     return LLVM.ParseIRInContext(this, @MemBuf, out @OutM, out @OutMessage);
 }
Exemple #10
0
 public static extern LLVMBool TargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef @T, LLVMModuleRef @M, LLVMCodeGenFileType @codegen, out IntPtr @ErrorMessage, out LLVMMemoryBufferRef @OutMemBuf);
Exemple #11
0
 public static extern LLVMBool ParseIRInContext(LLVMContextRef @ContextRef, LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage);
Exemple #12
0
 public bool GetBitcodeModuleInContext(LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage)
 {
     return(LLVM.GetBitcodeModuleInContext(this, @MemBuf, out @OutM, out @OutMessage));
 }
Exemple #13
0
        public static LLVMBool TargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T, LLVMModuleRef M, LLVMCodeGenFileType codegen, out string ErrorMessage, out LLVMMemoryBufferRef OutMemBuf)
        {
            var retVal = TargetMachineEmitToMemoryBuffer(T, M, codegen, out IntPtr message, out OutMemBuf);

            ErrorMessage = message != IntPtr.Zero && retVal.Value != 0 ? Marshal.PtrToStringAnsi(message) : null;
            DisposeMessage(message);
            return(retVal);
        }
Exemple #14
0
 public static extern LLVMBool GetBitcodeModuleProviderInContext(LLVMContextRef @ContextRef, LLVMMemoryBufferRef @MemBuf, out LLVMModuleProviderRef @OutMP, out IntPtr @OutMessage);
Exemple #15
0
 public static extern void DisposeMemoryBuffer(LLVMMemoryBufferRef @MemBuf);
Exemple #16
0
 public static extern LLVMObjectFileRef CreateObjectFile(LLVMMemoryBufferRef @MemBuf);
Exemple #17
0
 public static extern LLVMBool CreateMemoryBufferWithSTDIN(out LLVMMemoryBufferRef @OutMemBuf, out IntPtr @OutMessage);
Exemple #18
0
 public static extern LLVMBool CreateMemoryBufferWithContentsOfFile([MarshalAs(UnmanagedType.LPStr)] string @Path, out LLVMMemoryBufferRef @OutMemBuf, out IntPtr @OutMessage);
Exemple #19
0
 public static extern string GetBufferStart(LLVMMemoryBufferRef @MemBuf);
Exemple #20
0
 public static extern LLVMBool ParseBitcode(LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutModule, out IntPtr @OutMessage);
Exemple #21
0
 public bool ParseIRInContext(LLVMMemoryBufferRef @MemBuf, out LLVMModuleRef @OutM, out IntPtr @OutMessage)
 {
     return(LLVM.ParseIRInContext(this, @MemBuf, out @OutM, out @OutMessage));
 }
Exemple #22
0
 public static extern IntPtr GetBufferStart(LLVMMemoryBufferRef MemBuf);