diff --git a/.gitignore b/.gitignore index f9515586..c239768c 100644 --- a/.gitignore +++ b/.gitignore @@ -184,3 +184,4 @@ FakesAssemblies/ *.exe *.dll *.db +*.ide diff --git a/Conversions.cs b/Conversions.cs index c368d4dc..95ed22cd 100644 --- a/Conversions.cs +++ b/Conversions.cs @@ -1,5 +1,7 @@ namespace LLVMSharp { + using System; + partial struct LLVMBool { public static implicit operator bool(LLVMBool b) @@ -25,4 +27,27 @@ public static implicit operator LLVMBasicBlockRef(LLVMValueRef v) return LLVM.ValueAsBasicBlock(v); } } + + partial struct size_t + { + public static implicit operator size_t(int b) + { + return new size_t(new IntPtr(b)); + } + + public static implicit operator size_t(long b) + { + return new size_t(new IntPtr(b)); + } + + public static implicit operator int(size_t v) + { + return v.Pointer.ToInt32(); + } + + public static implicit operator long(size_t b) + { + return b.Pointer.ToInt64(); + } + } } \ No newline at end of file diff --git a/Generated.Custom.cs b/Generated.Custom.cs index 1b27ecdf..e23a0d8f 100644 --- a/Generated.Custom.cs +++ b/Generated.Custom.cs @@ -13,34 +13,6 @@ public size_t(IntPtr Pointer) public IntPtr Pointer; } - public partial struct LLVMOpaqueMetadata - { - } - - public partial struct LLVMOpaqueDIBuilder - { - } - - public partial struct LLVMMetadataRef - { - public LLVMMetadataRef(IntPtr pointer) - { - this.Pointer = pointer; - } - - public IntPtr Pointer; - } - - public partial struct LLVMDIBuilderRef - { - public LLVMDIBuilderRef(IntPtr pointer) - { - this.Pointer = pointer; - } - - public IntPtr Pointer; - } - public static partial class LLVM { [DllImport(libraryPath, EntryPoint = "LLVMAddFunctionAttr2", CallingConvention = CallingConvention.Cdecl)] diff --git a/Generated.cs b/Generated.cs index 278f8f81..2271f447 100644 --- a/Generated.cs +++ b/Generated.cs @@ -205,6 +205,16 @@ public LLVMBasicBlockRef(IntPtr pointer) public IntPtr Pointer; } + public partial struct LLVMMetadataRef + { + public LLVMMetadataRef(IntPtr pointer) + { + this.Pointer = pointer; + } + + public IntPtr Pointer; + } + public partial struct LLVMBuilderRef { public LLVMBuilderRef(IntPtr pointer) @@ -215,6 +225,16 @@ public LLVMBuilderRef(IntPtr pointer) public IntPtr Pointer; } + public partial struct LLVMDIBuilderRef + { + public LLVMDIBuilderRef(IntPtr pointer) + { + this.Pointer = pointer; + } + + public IntPtr Pointer; + } + public partial struct LLVMModuleProviderRef { public LLVMModuleProviderRef(IntPtr pointer) @@ -371,10 +391,10 @@ public LLVMMCJITMemoryManagerRef(IntPtr pointer) } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate IntPtr LLVMMemoryManagerAllocateCodeSectionCallback(IntPtr @Opaque, int @Size, uint @Alignment, uint @SectionID, [MarshalAs(UnmanagedType.LPStr)] string @SectionName); + public delegate IntPtr LLVMMemoryManagerAllocateCodeSectionCallback(IntPtr @Opaque, IntPtr @Size, uint @Alignment, uint @SectionID, [MarshalAs(UnmanagedType.LPStr)] string @SectionName); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate IntPtr LLVMMemoryManagerAllocateDataSectionCallback(IntPtr @Opaque, int @Size, uint @Alignment, uint @SectionID, [MarshalAs(UnmanagedType.LPStr)] string @SectionName, int @IsReadOnly); + public delegate IntPtr LLVMMemoryManagerAllocateDataSectionCallback(IntPtr @Opaque, IntPtr @Size, uint @Alignment, uint @SectionID, [MarshalAs(UnmanagedType.LPStr)] string @SectionName, LLVMBool @IsReadOnly); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int LLVMMemoryManagerFinalizeMemoryCallback(IntPtr @Opaque, out IntPtr @ErrMsg); @@ -465,6 +485,26 @@ public LLVMRelocationIteratorRef(IntPtr pointer) public IntPtr Pointer; } + public partial struct LLVMSharedModuleRef + { + public LLVMSharedModuleRef(IntPtr pointer) + { + this.Pointer = pointer; + } + + public IntPtr Pointer; + } + + public partial struct LLVMSharedObjectBufferRef + { + public LLVMSharedObjectBufferRef(IntPtr pointer) + { + this.Pointer = pointer; + } + + public IntPtr Pointer; + } + public partial struct LLVMOrcJITStackRef { public LLVMOrcJITStackRef(IntPtr pointer) @@ -518,36 +558,6 @@ public enum LLVMVerifierFailureAction : int @LLVMReturnStatusAction = 2, } - public enum LLVMAttribute : int - { - @LLVMZExtAttribute = 1, - @LLVMSExtAttribute = 2, - @LLVMNoReturnAttribute = 4, - @LLVMInRegAttribute = 8, - @LLVMStructRetAttribute = 16, - @LLVMNoUnwindAttribute = 32, - @LLVMNoAliasAttribute = 64, - @LLVMByValAttribute = 128, - @LLVMNestAttribute = 256, - @LLVMReadNoneAttribute = 512, - @LLVMReadOnlyAttribute = 1024, - @LLVMNoInlineAttribute = 2048, - @LLVMAlwaysInlineAttribute = 4096, - @LLVMOptimizeForSizeAttribute = 8192, - @LLVMStackProtectAttribute = 16384, - @LLVMStackProtectReqAttribute = 32768, - @LLVMAlignment = 2031616, - @LLVMNoCaptureAttribute = 2097152, - @LLVMNoRedZoneAttribute = 4194304, - @LLVMNoImplicitFloatAttribute = 8388608, - @LLVMNakedAttribute = 16777216, - @LLVMInlineHintAttribute = 33554432, - @LLVMStackAlignment = 469762048, - @LLVMReturnsTwice = 536870912, - @LLVMUWTable = 1073741824, - @LLVMNonLazyBind = -2147483648, - } - public enum LLVMOpcode : int { @LLVMRet = 1, @@ -1101,7 +1111,7 @@ public static partial class LLVM public static extern uint GetNamedMetadataNumOperands(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMGetNamedMetadataOperands", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetNamedMetadataOperands(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name, out LLVMValueRef @Dest); + internal static extern void GetNamedMetadataOperands(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name, out LLVMValueRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMAddNamedMetadataOperand", CallingConvention = CallingConvention.Cdecl)] public static extern void AddNamedMetadataOperand(LLVMModuleRef @M, [MarshalAs(UnmanagedType.LPStr)] string @Name, LLVMValueRef @Val); @@ -1221,7 +1231,7 @@ public static partial class LLVM public static extern LLVMTypeRef PPCFP128Type(); [DllImport(libraryPath, EntryPoint = "LLVMFunctionType", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMTypeRef FunctionType(LLVMTypeRef @ReturnType, out LLVMTypeRef @ParamTypes, uint @ParamCount, LLVMBool @IsVarArg); + internal static extern LLVMTypeRef FunctionType(LLVMTypeRef @ReturnType, out LLVMTypeRef @ParamTypes, uint @ParamCount, LLVMBool @IsVarArg); [DllImport(libraryPath, EntryPoint = "LLVMIsFunctionVarArg", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMBool IsFunctionVarArg(LLVMTypeRef @FunctionTy); @@ -1233,13 +1243,13 @@ public static partial class LLVM public static extern uint CountParamTypes(LLVMTypeRef @FunctionTy); [DllImport(libraryPath, EntryPoint = "LLVMGetParamTypes", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetParamTypes(LLVMTypeRef @FunctionTy, out LLVMTypeRef @Dest); + internal static extern void GetParamTypes(LLVMTypeRef @FunctionTy, out LLVMTypeRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMStructTypeInContext", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMTypeRef StructTypeInContext(LLVMContextRef @C, out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); + internal static extern LLVMTypeRef StructTypeInContext(LLVMContextRef @C, out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMStructType", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMTypeRef StructType(out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); + internal static extern LLVMTypeRef StructType(out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMStructCreateNamed", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMTypeRef StructCreateNamed(LLVMContextRef @C, [MarshalAs(UnmanagedType.LPStr)] string @Name); @@ -1248,13 +1258,13 @@ public static partial class LLVM public static extern string GetStructName(LLVMTypeRef @Ty); [DllImport(libraryPath, EntryPoint = "LLVMStructSetBody", CallingConvention = CallingConvention.Cdecl)] - public static extern void StructSetBody(LLVMTypeRef @StructTy, out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); + internal static extern void StructSetBody(LLVMTypeRef @StructTy, out LLVMTypeRef @ElementTypes, uint @ElementCount, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMCountStructElementTypes", CallingConvention = CallingConvention.Cdecl)] public static extern uint CountStructElementTypes(LLVMTypeRef @StructTy); [DllImport(libraryPath, EntryPoint = "LLVMGetStructElementTypes", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetStructElementTypes(LLVMTypeRef @StructTy, out LLVMTypeRef @Dest); + internal static extern void GetStructElementTypes(LLVMTypeRef @StructTy, out LLVMTypeRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMStructGetTypeAtIndex", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMTypeRef StructGetTypeAtIndex(LLVMTypeRef @StructTy, uint @i); @@ -1268,6 +1278,12 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMGetElementType", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMTypeRef GetElementType(LLVMTypeRef @Ty); + [DllImport(libraryPath, EntryPoint = "LLVMGetSubtypes", CallingConvention = CallingConvention.Cdecl)] + internal static extern void GetSubtypes(LLVMTypeRef @Tp, out LLVMTypeRef @Arr); + + [DllImport(libraryPath, EntryPoint = "LLVMGetNumContainedTypes", CallingConvention = CallingConvention.Cdecl)] + public static extern uint GetNumContainedTypes(LLVMTypeRef @Tp); + [DllImport(libraryPath, EntryPoint = "LLVMArrayType", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMTypeRef ArrayType(LLVMTypeRef @ElementType, uint @ElementCount); @@ -1614,7 +1630,7 @@ public static partial class LLVM public static extern LLVMValueRef ConstInt(LLVMTypeRef @IntTy, ulong @N, LLVMBool @SignExtend); [DllImport(libraryPath, EntryPoint = "LLVMConstIntOfArbitraryPrecision", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstIntOfArbitraryPrecision(LLVMTypeRef @IntTy, uint @NumWords, int[] @Words); + public static extern LLVMValueRef ConstIntOfArbitraryPrecision(LLVMTypeRef @IntTy, uint @NumWords, [MarshalAs(UnmanagedType.LPArray)] int[] @Words); [DllImport(libraryPath, EntryPoint = "LLVMConstIntOfString", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef ConstIntOfString(LLVMTypeRef @IntTy, [MarshalAs(UnmanagedType.LPStr)] string @Text, byte @Radix); @@ -1653,22 +1669,22 @@ public static partial class LLVM public static extern string GetAsString(LLVMValueRef @c, out size_t @Length); [DllImport(libraryPath, EntryPoint = "LLVMConstStructInContext", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstStructInContext(LLVMContextRef @C, out LLVMValueRef @ConstantVals, uint @Count, LLVMBool @Packed); + internal static extern LLVMValueRef ConstStructInContext(LLVMContextRef @C, out LLVMValueRef @ConstantVals, uint @Count, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMConstStruct", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstStruct(out LLVMValueRef @ConstantVals, uint @Count, LLVMBool @Packed); + internal static extern LLVMValueRef ConstStruct(out LLVMValueRef @ConstantVals, uint @Count, LLVMBool @Packed); [DllImport(libraryPath, EntryPoint = "LLVMConstArray", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstArray(LLVMTypeRef @ElementTy, out LLVMValueRef @ConstantVals, uint @Length); + internal static extern LLVMValueRef ConstArray(LLVMTypeRef @ElementTy, out LLVMValueRef @ConstantVals, uint @Length); [DllImport(libraryPath, EntryPoint = "LLVMConstNamedStruct", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstNamedStruct(LLVMTypeRef @StructTy, out LLVMValueRef @ConstantVals, uint @Count); + internal static extern LLVMValueRef ConstNamedStruct(LLVMTypeRef @StructTy, out LLVMValueRef @ConstantVals, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMGetElementAsConstant", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef GetElementAsConstant(LLVMValueRef @C, uint @idx); [DllImport(libraryPath, EntryPoint = "LLVMConstVector", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstVector(out LLVMValueRef @ScalarConstantVals, uint @Size); + internal static extern LLVMValueRef ConstVector(out LLVMValueRef @ScalarConstantVals, uint @Size); [DllImport(libraryPath, EntryPoint = "LLVMGetConstOpcode", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMOpcode GetConstOpcode(LLVMValueRef @ConstantVal); @@ -1733,6 +1749,9 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMConstUDiv", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef ConstUDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); + [DllImport(libraryPath, EntryPoint = "LLVMConstExactUDiv", CallingConvention = CallingConvention.Cdecl)] + public static extern LLVMValueRef ConstExactUDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); + [DllImport(libraryPath, EntryPoint = "LLVMConstSDiv", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef ConstSDiv(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); @@ -1776,10 +1795,10 @@ public static partial class LLVM public static extern LLVMValueRef ConstAShr(LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstGEP", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstGEP(LLVMValueRef @ConstantVal, out LLVMValueRef @ConstantIndices, uint @NumIndices); + internal static extern LLVMValueRef ConstGEP(LLVMValueRef @ConstantVal, out LLVMValueRef @ConstantIndices, uint @NumIndices); [DllImport(libraryPath, EntryPoint = "LLVMConstInBoundsGEP", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstInBoundsGEP(LLVMValueRef @ConstantVal, out LLVMValueRef @ConstantIndices, uint @NumIndices); + internal static extern LLVMValueRef ConstInBoundsGEP(LLVMValueRef @ConstantVal, out LLVMValueRef @ConstantIndices, uint @NumIndices); [DllImport(libraryPath, EntryPoint = "LLVMConstTrunc", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef ConstTrunc(LLVMValueRef @ConstantVal, LLVMTypeRef @ToType); @@ -1851,10 +1870,10 @@ public static partial class LLVM public static extern LLVMValueRef ConstShuffleVector(LLVMValueRef @VectorAConstant, LLVMValueRef @VectorBConstant, LLVMValueRef @MaskConstant); [DllImport(libraryPath, EntryPoint = "LLVMConstExtractValue", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstExtractValue(LLVMValueRef @AggConstant, out uint @IdxList, uint @NumIdx); + internal static extern LLVMValueRef ConstExtractValue(LLVMValueRef @AggConstant, out uint @IdxList, uint @NumIdx); [DllImport(libraryPath, EntryPoint = "LLVMConstInsertValue", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef ConstInsertValue(LLVMValueRef @AggConstant, LLVMValueRef @ElementValueConstant, out uint @IdxList, uint @NumIdx); + internal static extern LLVMValueRef ConstInsertValue(LLVMValueRef @AggConstant, LLVMValueRef @ElementValueConstant, out uint @IdxList, uint @NumIdx); [DllImport(libraryPath, EntryPoint = "LLVMConstInlineAsm", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef ConstInlineAsm(LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @AsmString, [MarshalAs(UnmanagedType.LPStr)] string @Constraints, LLVMBool @HasSideEffects, LLVMBool @IsAlignStack); @@ -1988,12 +2007,15 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMSetGC", CallingConvention = CallingConvention.Cdecl)] public static extern void SetGC(LLVMValueRef @Fn, [MarshalAs(UnmanagedType.LPStr)] string @Name); - [DllImport(libraryPath, EntryPoint = "LLVMAddFunctionAttr", CallingConvention = CallingConvention.Cdecl)] - public static extern void AddFunctionAttr(LLVMValueRef @Fn, LLVMAttribute @PA); - [DllImport(libraryPath, EntryPoint = "LLVMAddAttributeAtIndex", CallingConvention = CallingConvention.Cdecl)] public static extern void AddAttributeAtIndex(LLVMValueRef @F, LLVMAttributeIndex @Idx, LLVMAttributeRef @A); + [DllImport(libraryPath, EntryPoint = "LLVMGetAttributeCountAtIndex", CallingConvention = CallingConvention.Cdecl)] + public static extern uint GetAttributeCountAtIndex(LLVMValueRef @F, LLVMAttributeIndex @Idx); + + [DllImport(libraryPath, EntryPoint = "LLVMGetAttributesAtIndex", CallingConvention = CallingConvention.Cdecl)] + internal static extern void GetAttributesAtIndex(LLVMValueRef @F, LLVMAttributeIndex @Idx, out LLVMAttributeRef @Attrs); + [DllImport(libraryPath, EntryPoint = "LLVMGetEnumAttributeAtIndex", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMAttributeRef GetEnumAttributeAtIndex(LLVMValueRef @F, LLVMAttributeIndex @Idx, uint @KindID); @@ -2009,17 +2031,11 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMAddTargetDependentFunctionAttr", CallingConvention = CallingConvention.Cdecl)] public static extern void AddTargetDependentFunctionAttr(LLVMValueRef @Fn, [MarshalAs(UnmanagedType.LPStr)] string @A, [MarshalAs(UnmanagedType.LPStr)] string @V); - [DllImport(libraryPath, EntryPoint = "LLVMGetFunctionAttr", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMAttribute GetFunctionAttr(LLVMValueRef @Fn); - - [DllImport(libraryPath, EntryPoint = "LLVMRemoveFunctionAttr", CallingConvention = CallingConvention.Cdecl)] - public static extern void RemoveFunctionAttr(LLVMValueRef @Fn, LLVMAttribute @PA); - [DllImport(libraryPath, EntryPoint = "LLVMCountParams", CallingConvention = CallingConvention.Cdecl)] public static extern uint CountParams(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetParams", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetParams(LLVMValueRef @Fn, out LLVMValueRef @Params); + internal static extern void GetParams(LLVMValueRef @Fn, out LLVMValueRef @Params); [DllImport(libraryPath, EntryPoint = "LLVMGetParam", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef GetParam(LLVMValueRef @Fn, uint @Index); @@ -2039,15 +2055,6 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMGetPreviousParam", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef GetPreviousParam(LLVMValueRef @Arg); - [DllImport(libraryPath, EntryPoint = "LLVMAddAttribute", CallingConvention = CallingConvention.Cdecl)] - public static extern void AddAttribute(LLVMValueRef @Arg, LLVMAttribute @PA); - - [DllImport(libraryPath, EntryPoint = "LLVMRemoveAttribute", CallingConvention = CallingConvention.Cdecl)] - public static extern void RemoveAttribute(LLVMValueRef @Arg, LLVMAttribute @PA); - - [DllImport(libraryPath, EntryPoint = "LLVMGetAttribute", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMAttribute GetAttribute(LLVMValueRef @Arg); - [DllImport(libraryPath, EntryPoint = "LLVMSetParamAlignment", CallingConvention = CallingConvention.Cdecl)] public static extern void SetParamAlignment(LLVMValueRef @Arg, uint @Align); @@ -2058,10 +2065,16 @@ public static partial class LLVM public static extern LLVMValueRef MDString([MarshalAs(UnmanagedType.LPStr)] string @Str, uint @SLen); [DllImport(libraryPath, EntryPoint = "LLVMMDNodeInContext", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef MDNodeInContext(LLVMContextRef @C, out LLVMValueRef @Vals, uint @Count); + internal static extern LLVMValueRef MDNodeInContext(LLVMContextRef @C, out LLVMValueRef @Vals, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMMDNode", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef MDNode(out LLVMValueRef @Vals, uint @Count); + internal static extern LLVMValueRef MDNode(out LLVMValueRef @Vals, uint @Count); + + [DllImport(libraryPath, EntryPoint = "LLVMMetadataAsValue", CallingConvention = CallingConvention.Cdecl)] + public static extern LLVMValueRef MetadataAsValue(LLVMContextRef @C, LLVMMetadataRef @MD); + + [DllImport(libraryPath, EntryPoint = "LLVMValueAsMetadata", CallingConvention = CallingConvention.Cdecl)] + public static extern LLVMMetadataRef ValueAsMetadata(LLVMValueRef @Val); [DllImport(libraryPath, EntryPoint = "LLVMGetMDString", CallingConvention = CallingConvention.Cdecl)] public static extern string GetMDString(LLVMValueRef @V, out uint @Length); @@ -2070,7 +2083,7 @@ public static partial class LLVM public static extern uint GetMDNodeNumOperands(LLVMValueRef @V); [DllImport(libraryPath, EntryPoint = "LLVMGetMDNodeOperands", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetMDNodeOperands(LLVMValueRef @V, out LLVMValueRef @Dest); + internal static extern void GetMDNodeOperands(LLVMValueRef @V, out LLVMValueRef @Dest); [DllImport(libraryPath, EntryPoint = "LLVMBasicBlockAsValue", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BasicBlockAsValue(LLVMBasicBlockRef @BB); @@ -2094,7 +2107,7 @@ public static partial class LLVM public static extern uint CountBasicBlocks(LLVMValueRef @Fn); [DllImport(libraryPath, EntryPoint = "LLVMGetBasicBlocks", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetBasicBlocks(LLVMValueRef @Fn, out LLVMBasicBlockRef @BasicBlocks); + internal static extern void GetBasicBlocks(LLVMValueRef @Fn, out LLVMBasicBlockRef @BasicBlocks); [DllImport(libraryPath, EntryPoint = "LLVMGetFirstBasicBlock", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMBasicBlockRef GetFirstBasicBlock(LLVMValueRef @Fn); @@ -2186,18 +2199,18 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMGetInstructionCallConv", CallingConvention = CallingConvention.Cdecl)] public static extern uint GetInstructionCallConv(LLVMValueRef @Instr); - [DllImport(libraryPath, EntryPoint = "LLVMAddInstrAttribute", CallingConvention = CallingConvention.Cdecl)] - public static extern void AddInstrAttribute(LLVMValueRef @Instr, uint @index, LLVMAttribute @param2); - - [DllImport(libraryPath, EntryPoint = "LLVMRemoveInstrAttribute", CallingConvention = CallingConvention.Cdecl)] - public static extern void RemoveInstrAttribute(LLVMValueRef @Instr, uint @index, LLVMAttribute @param2); - [DllImport(libraryPath, EntryPoint = "LLVMSetInstrParamAlignment", CallingConvention = CallingConvention.Cdecl)] public static extern void SetInstrParamAlignment(LLVMValueRef @Instr, uint @index, uint @Align); [DllImport(libraryPath, EntryPoint = "LLVMAddCallSiteAttribute", CallingConvention = CallingConvention.Cdecl)] public static extern void AddCallSiteAttribute(LLVMValueRef @C, LLVMAttributeIndex @Idx, LLVMAttributeRef @A); + [DllImport(libraryPath, EntryPoint = "LLVMGetCallSiteAttributeCount", CallingConvention = CallingConvention.Cdecl)] + public static extern uint GetCallSiteAttributeCount(LLVMValueRef @C, LLVMAttributeIndex @Idx); + + [DllImport(libraryPath, EntryPoint = "LLVMGetCallSiteAttributes", CallingConvention = CallingConvention.Cdecl)] + internal static extern void GetCallSiteAttributes(LLVMValueRef @C, LLVMAttributeIndex @Idx, out LLVMAttributeRef @Attrs); + [DllImport(libraryPath, EntryPoint = "LLVMGetCallSiteEnumAttribute", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMAttributeRef GetCallSiteEnumAttribute(LLVMValueRef @C, LLVMAttributeIndex @Idx, uint @KindID); @@ -2262,7 +2275,7 @@ public static partial class LLVM public static extern void SetIsInBounds(LLVMValueRef @GEP, LLVMBool @InBounds); [DllImport(libraryPath, EntryPoint = "LLVMAddIncoming", CallingConvention = CallingConvention.Cdecl)] - public static extern void AddIncoming(LLVMValueRef @PhiNode, out LLVMValueRef @IncomingValues, out LLVMBasicBlockRef @IncomingBlocks, uint @Count); + internal static extern void AddIncoming(LLVMValueRef @PhiNode, out LLVMValueRef @IncomingValues, out LLVMBasicBlockRef @IncomingBlocks, uint @Count); [DllImport(libraryPath, EntryPoint = "LLVMCountIncoming", CallingConvention = CallingConvention.Cdecl)] public static extern uint CountIncoming(LLVMValueRef @PhiNode); @@ -2325,7 +2338,7 @@ public static partial class LLVM public static extern LLVMValueRef BuildRet(LLVMBuilderRef @param0, LLVMValueRef @V); [DllImport(libraryPath, EntryPoint = "LLVMBuildAggregateRet", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef BuildAggregateRet(LLVMBuilderRef @param0, out LLVMValueRef @RetVals, uint @N); + internal static extern LLVMValueRef BuildAggregateRet(LLVMBuilderRef @param0, out LLVMValueRef @RetVals, uint @N); [DllImport(libraryPath, EntryPoint = "LLVMBuildBr", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BuildBr(LLVMBuilderRef @param0, LLVMBasicBlockRef @Dest); @@ -2340,7 +2353,7 @@ public static partial class LLVM public static extern LLVMValueRef BuildIndirectBr(LLVMBuilderRef @B, LLVMValueRef @Addr, uint @NumDests); [DllImport(libraryPath, EntryPoint = "LLVMBuildInvoke", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef BuildInvoke(LLVMBuilderRef @param0, LLVMValueRef @Fn, out LLVMValueRef @Args, uint @NumArgs, LLVMBasicBlockRef @Then, LLVMBasicBlockRef @Catch, [MarshalAs(UnmanagedType.LPStr)] string @Name); + internal static extern LLVMValueRef BuildInvoke(LLVMBuilderRef @param0, LLVMValueRef @Fn, out LLVMValueRef @Args, uint @NumArgs, LLVMBasicBlockRef @Then, LLVMBasicBlockRef @Catch, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildLandingPad", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BuildLandingPad(LLVMBuilderRef @B, LLVMTypeRef @Ty, LLVMValueRef @PersFn, uint @NumClauses, [MarshalAs(UnmanagedType.LPStr)] string @Name); @@ -2411,6 +2424,9 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMBuildUDiv", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BuildUDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); + [DllImport(libraryPath, EntryPoint = "LLVMBuildExactUDiv", CallingConvention = CallingConvention.Cdecl)] + public static extern LLVMValueRef BuildExactUDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); + [DllImport(libraryPath, EntryPoint = "LLVMBuildSDiv", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BuildSDiv(LLVMBuilderRef @param0, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name); @@ -2487,10 +2503,10 @@ public static partial class LLVM public static extern LLVMValueRef BuildStore(LLVMBuilderRef @param0, LLVMValueRef @Val, LLVMValueRef @Ptr); [DllImport(libraryPath, EntryPoint = "LLVMBuildGEP", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef BuildGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, out LLVMValueRef @Indices, uint @NumIndices, [MarshalAs(UnmanagedType.LPStr)] string @Name); + internal static extern LLVMValueRef BuildGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, out LLVMValueRef @Indices, uint @NumIndices, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildInBoundsGEP", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef BuildInBoundsGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, out LLVMValueRef @Indices, uint @NumIndices, [MarshalAs(UnmanagedType.LPStr)] string @Name); + internal static extern LLVMValueRef BuildInBoundsGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, out LLVMValueRef @Indices, uint @NumIndices, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildStructGEP", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BuildStructGEP(LLVMBuilderRef @B, LLVMValueRef @Pointer, uint @Idx, [MarshalAs(UnmanagedType.LPStr)] string @Name); @@ -2583,7 +2599,7 @@ public static partial class LLVM public static extern LLVMValueRef BuildPhi(LLVMBuilderRef @param0, LLVMTypeRef @Ty, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildCall", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMValueRef BuildCall(LLVMBuilderRef @param0, LLVMValueRef @Fn, out LLVMValueRef @Args, uint @NumArgs, [MarshalAs(UnmanagedType.LPStr)] string @Name); + internal static extern LLVMValueRef BuildCall(LLVMBuilderRef @param0, LLVMValueRef @Fn, out LLVMValueRef @Args, uint @NumArgs, [MarshalAs(UnmanagedType.LPStr)] string @Name); [DllImport(libraryPath, EntryPoint = "LLVMBuildSelect", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMValueRef BuildSelect(LLVMBuilderRef @param0, LLVMValueRef @If, LLVMValueRef @Then, LLVMValueRef @Else, [MarshalAs(UnmanagedType.LPStr)] string @Name); @@ -3147,7 +3163,7 @@ public static partial class LLVM public static extern int RunFunctionAsMain(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @ArgC, string[] @ArgV, string[] @EnvP); [DllImport(libraryPath, EntryPoint = "LLVMRunFunction", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @NumArgs, out LLVMGenericValueRef @Args); + internal static extern LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F, uint @NumArgs, out LLVMGenericValueRef @Args); [DllImport(libraryPath, EntryPoint = "LLVMFreeMachineCodeForFunction", CallingConvention = CallingConvention.Cdecl)] public static extern void FreeMachineCodeForFunction(LLVMExecutionEngineRef @EE, LLVMValueRef @F); @@ -3311,6 +3327,18 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMGetRelocationValueString", CallingConvention = CallingConvention.Cdecl)] public static extern string GetRelocationValueString(LLVMRelocationIteratorRef @RI); + [DllImport(libraryPath, EntryPoint = "LLVMOrcMakeSharedModule", CallingConvention = CallingConvention.Cdecl)] + public static extern LLVMSharedModuleRef OrcMakeSharedModule(LLVMModuleRef @Mod); + + [DllImport(libraryPath, EntryPoint = "LLVMOrcDisposeSharedModuleRef", CallingConvention = CallingConvention.Cdecl)] + public static extern void OrcDisposeSharedModuleRef(LLVMSharedModuleRef @SharedMod); + + [DllImport(libraryPath, EntryPoint = "LLVMOrcMakeSharedObjectBuffer", CallingConvention = CallingConvention.Cdecl)] + public static extern LLVMSharedObjectBufferRef OrcMakeSharedObjectBuffer(LLVMMemoryBufferRef @ObjBuffer); + + [DllImport(libraryPath, EntryPoint = "LLVMOrcDisposeSharedObjectBufferRef", CallingConvention = CallingConvention.Cdecl)] + public static extern void OrcDisposeSharedObjectBufferRef(LLVMSharedObjectBufferRef @SharedObjBuffer); + [DllImport(libraryPath, EntryPoint = "LLVMOrcCreateInstance", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMOrcJITStackRef OrcCreateInstance(LLVMTargetMachineRef @TM); @@ -3324,7 +3352,7 @@ public static partial class LLVM public static extern void OrcDisposeMangledSymbol(IntPtr @MangledSymbol); [DllImport(libraryPath, EntryPoint = "LLVMOrcCreateLazyCompileCallback", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMOrcTargetAddress OrcCreateLazyCompileCallback(LLVMOrcJITStackRef @JITStack, LLVMOrcLazyCompileCallbackFn @Callback, IntPtr @CallbackCtx); + public static extern LLVMOrcErrorCode OrcCreateLazyCompileCallback(LLVMOrcJITStackRef @JITStack, out LLVMOrcTargetAddress @RetAddr, LLVMOrcLazyCompileCallbackFn @Callback, IntPtr @CallbackCtx); [DllImport(libraryPath, EntryPoint = "LLVMOrcCreateIndirectStub", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMOrcErrorCode OrcCreateIndirectStub(LLVMOrcJITStackRef @JITStack, [MarshalAs(UnmanagedType.LPStr)] string @StubName, LLVMOrcTargetAddress @InitAddr); @@ -3333,22 +3361,22 @@ public static partial class LLVM public static extern LLVMOrcErrorCode OrcSetIndirectStubPointer(LLVMOrcJITStackRef @JITStack, [MarshalAs(UnmanagedType.LPStr)] string @StubName, LLVMOrcTargetAddress @NewAddr); [DllImport(libraryPath, EntryPoint = "LLVMOrcAddEagerlyCompiledIR", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMOrcModuleHandle OrcAddEagerlyCompiledIR(LLVMOrcJITStackRef @JITStack, LLVMModuleRef @Mod, LLVMOrcSymbolResolverFn @SymbolResolver, IntPtr @SymbolResolverCtx); + public static extern LLVMOrcErrorCode OrcAddEagerlyCompiledIR(LLVMOrcJITStackRef @JITStack, out LLVMOrcModuleHandle @RetHandle, LLVMSharedModuleRef @Mod, LLVMOrcSymbolResolverFn @SymbolResolver, IntPtr @SymbolResolverCtx); [DllImport(libraryPath, EntryPoint = "LLVMOrcAddLazilyCompiledIR", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMOrcModuleHandle OrcAddLazilyCompiledIR(LLVMOrcJITStackRef @JITStack, LLVMModuleRef @Mod, LLVMOrcSymbolResolverFn @SymbolResolver, IntPtr @SymbolResolverCtx); + public static extern LLVMOrcErrorCode OrcAddLazilyCompiledIR(LLVMOrcJITStackRef @JITStack, out LLVMOrcModuleHandle @RetHandle, LLVMSharedModuleRef @Mod, LLVMOrcSymbolResolverFn @SymbolResolver, IntPtr @SymbolResolverCtx); [DllImport(libraryPath, EntryPoint = "LLVMOrcAddObjectFile", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMOrcModuleHandle OrcAddObjectFile(LLVMOrcJITStackRef @JITStack, LLVMObjectFileRef @Obj, LLVMOrcSymbolResolverFn @SymbolResolver, IntPtr @SymbolResolverCtx); + public static extern LLVMOrcErrorCode OrcAddObjectFile(LLVMOrcJITStackRef @JITStack, out LLVMOrcModuleHandle @RetHandle, LLVMSharedObjectBufferRef @Obj, LLVMOrcSymbolResolverFn @SymbolResolver, IntPtr @SymbolResolverCtx); [DllImport(libraryPath, EntryPoint = "LLVMOrcRemoveModule", CallingConvention = CallingConvention.Cdecl)] - public static extern void OrcRemoveModule(LLVMOrcJITStackRef @JITStack, LLVMOrcModuleHandle @H); + public static extern LLVMOrcErrorCode OrcRemoveModule(LLVMOrcJITStackRef @JITStack, LLVMOrcModuleHandle @H); [DllImport(libraryPath, EntryPoint = "LLVMOrcGetSymbolAddress", CallingConvention = CallingConvention.Cdecl)] - public static extern LLVMOrcTargetAddress OrcGetSymbolAddress(LLVMOrcJITStackRef @JITStack, [MarshalAs(UnmanagedType.LPStr)] string @SymbolName); + public static extern LLVMOrcErrorCode OrcGetSymbolAddress(LLVMOrcJITStackRef @JITStack, out LLVMOrcTargetAddress @RetAddr, [MarshalAs(UnmanagedType.LPStr)] string @SymbolName); [DllImport(libraryPath, EntryPoint = "LLVMOrcDisposeInstance", CallingConvention = CallingConvention.Cdecl)] - public static extern void OrcDisposeInstance(LLVMOrcJITStackRef @JITStack); + public static extern LLVMOrcErrorCode OrcDisposeInstance(LLVMOrcJITStackRef @JITStack); [DllImport(libraryPath, EntryPoint = "LLVMLoadLibraryPermanently", CallingConvention = CallingConvention.Cdecl)] public static extern LLVMBool LoadLibraryPermanently([MarshalAs(UnmanagedType.LPStr)] string @Filename); @@ -3449,6 +3477,9 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMAddCFGSimplificationPass", CallingConvention = CallingConvention.Cdecl)] public static extern void AddCFGSimplificationPass(LLVMPassManagerRef @PM); + [DllImport(libraryPath, EntryPoint = "LLVMAddLateCFGSimplificationPass", CallingConvention = CallingConvention.Cdecl)] + public static extern void AddLateCFGSimplificationPass(LLVMPassManagerRef @PM); + [DllImport(libraryPath, EntryPoint = "LLVMAddDeadStoreEliminationPass", CallingConvention = CallingConvention.Cdecl)] public static extern void AddDeadStoreEliminationPass(LLVMPassManagerRef @PM); @@ -3461,6 +3492,9 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMAddGVNPass", CallingConvention = CallingConvention.Cdecl)] public static extern void AddGVNPass(LLVMPassManagerRef @PM); + [DllImport(libraryPath, EntryPoint = "LLVMAddNewGVNPass", CallingConvention = CallingConvention.Cdecl)] + public static extern void AddNewGVNPass(LLVMPassManagerRef @PM); + [DllImport(libraryPath, EntryPoint = "LLVMAddIndVarSimplifyPass", CallingConvention = CallingConvention.Cdecl)] public static extern void AddIndVarSimplifyPass(LLVMPassManagerRef @PM); @@ -3539,6 +3573,9 @@ public static partial class LLVM [DllImport(libraryPath, EntryPoint = "LLVMAddEarlyCSEPass", CallingConvention = CallingConvention.Cdecl)] public static extern void AddEarlyCSEPass(LLVMPassManagerRef @PM); + [DllImport(libraryPath, EntryPoint = "LLVMAddEarlyCSEMemSSAPass", CallingConvention = CallingConvention.Cdecl)] + public static extern void AddEarlyCSEMemSSAPass(LLVMPassManagerRef @PM); + [DllImport(libraryPath, EntryPoint = "LLVMAddLowerExpectIntrinsicPass", CallingConvention = CallingConvention.Cdecl)] public static extern void AddLowerExpectIntrinsicPass(LLVMPassManagerRef @PM); diff --git a/LLVMSharp.csproj b/LLVMSharp.csproj index 8b6916b1..b5b21772 100644 --- a/LLVMSharp.csproj +++ b/LLVMSharp.csproj @@ -1,35 +1,7 @@ - - - + - Debug - AnyCPU - {E230F816-0E92-4AE4-83E4-24D74DEB9609} - Library - LLVMSharp - LLVMSharp - v4.0 + netstandard1.1 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - @@ -38,13 +10,15 @@ + + + - - - - + + + \ No newline at end of file diff --git a/LLVMSharp.sln b/LLVMSharp.sln index d126f170..0144c661 100644 --- a/LLVMSharp.sln +++ b/LLVMSharp.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24201.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26014.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLVMSharp", "LLVMSharp.csproj", "{E230F816-0E92-4AE4-83E4-24D74DEB9609}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLVMSharp", "LLVMSharp.csproj", "{134605B0-3140-4C9A-BE4B-E8720933620B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E230F816-0E92-4AE4-83E4-24D74DEB9609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E230F816-0E92-4AE4-83E4-24D74DEB9609}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E230F816-0E92-4AE4-83E4-24D74DEB9609}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E230F816-0E92-4AE4-83E4-24D74DEB9609}.Release|Any CPU.Build.0 = Release|Any CPU + {134605B0-3140-4C9A-BE4B-E8720933620B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {134605B0-3140-4C9A-BE4B-E8720933620B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {134605B0-3140-4C9A-BE4B-E8720933620B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {134605B0-3140-4C9A-BE4B-E8720933620B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Overloads.cs b/Overloads.cs index a005d77f..221fe710 100644 --- a/Overloads.cs +++ b/Overloads.cs @@ -260,6 +260,12 @@ public static void AddIncoming(LLVMValueRef PhiNode, LLVMValueRef[] IncomingValu public static LLVMValueRef BuildAggregateRet(LLVMBuilderRef param0, LLVMValueRef[] RetVals) { + if (RetVals.Length == 0) + { + LLVMValueRef dummy; + return BuildAggregateRet(param0, out dummy, 0); + } + return BuildAggregateRet(param0, out RetVals[0], (uint)RetVals.Length); } @@ -317,5 +323,29 @@ public static LLVMGenericValueRef RunFunction(LLVMExecutionEngineRef EE, LLVMVal return RunFunction(EE, F, (uint)Args.Length, out Args[0]); } + + public static LLVMTypeRef[] GetSubtypes(LLVMTypeRef Tp) + { + var arr = new LLVMTypeRef[GetNumContainedTypes(Tp)]; + GetSubtypes(Tp, out arr[0]); + + return arr; + } + + public static LLVMAttributeRef[] GetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx) + { + var arr = new LLVMAttributeRef[GetAttributeCountAtIndex(F, Idx)]; + GetAttributesAtIndex(F, Idx, out arr[0]); + + return arr; + } + + public static LLVMAttributeRef[] GetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx) + { + var arr = new LLVMAttributeRef[GetCallSiteAttributeCount(C, Idx)]; + GetCallSiteAttributes(C, Idx, out arr[0]); + + return arr; + } } } \ No newline at end of file diff --git a/project.json b/project.json new file mode 100644 index 00000000..45ab869d --- /dev/null +++ b/project.json @@ -0,0 +1,29 @@ +{ + "authors": [ "mjsabby" ], + "buildOptions": { + "compile": { + "exclude": [ "KaleidoscopeTutorial", "tools" ] + }, + "debugType": "portable" + }, + "dependencies": {}, + "description": "LLVM C# bindings for .NET Core and .NET Framework", + "frameworks": { + "net45": {}, + "netstandard1.1": { + "dependencies": { + "System.Runtime": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime.InteropServices": "4.0.0" + } + } + }, + "packOptions": { + "licenseUrl": "https://raw.githubusercontent.com/Microsoft/LLVMSharp/master/LICENSE.txt", + "owners": [ "mjsabby" ], + "projectUrl": "https://github.com/Microsoft/LLVMSharp", + "summary": "LLVM C# bindings for .NET Core and .NET Framework", + "tags": [ "llvm", "clang", "libLLVM", "kaleidoscope", "libclang", "clangsharp", "llvmsharp", "ast", "c++", "c", "roslyn", "compilers", "parsers", "clang.net", "llvm.net", "bindings", "pinvoke" ] + }, + "version": "3.9.1" +} \ No newline at end of file