Skip to content
Permalink
Browse files

Updating the libLLVM and LLVMSharp version to v9.0.0 (#121)

* Updating the libLLVM and LLVMSharp version to v9.0.0

* Regenerating the libLLVM bindings for 9.0.0

* Moving the libLLVM interop types to the LLVMSharp.Interop namespace

* Adding wrapper types for the new/missing native types

* Cleaning up the codebase to use simplified usings

* Renaming various usages of Pointer to Handle

* Fixing LLVMSharp.UnitTests.IR.ComparesGreaterThan to use valid IR

* Fixing LLVMSharp.UnitTests.IR.ReturnsSizeOf to use valid IR
  • Loading branch information
tannergooding committed Nov 25, 2019
1 parent 6f70324 commit 52b94ee3bc0a61ee81ed8ce2f62cb6d4bf6656d3
Showing with 1,665 additions and 1,329 deletions.
  1. +1 −1 Directory.Build.props
  2. +1 −1 Directory.Build.targets
  3. +7 −7 sources/LLVMSharp/Interop.Extensions/LLVMAttributeRef.cs
  4. +18 −20 sources/LLVMSharp/Interop.Extensions/LLVMBasicBlockRef.cs
  5. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMBinaryRef.cs
  6. +170 −320 sources/LLVMSharp/Interop.Extensions/LLVMBuilderRef.cs
  7. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMComdatRef.cs
  8. +38 −52 sources/LLVMSharp/Interop.Extensions/LLVMContextRef.cs
  9. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMDIBuilderRef.cs
  10. +7 −7 sources/LLVMSharp/Interop.Extensions/LLVMDiagnosticInfoRef.cs
  11. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMDisasmContextRef.cs
  12. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMErrorRef.cs
  13. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMErrorTypeId.cs
  14. +25 −30 sources/LLVMSharp/Interop.Extensions/LLVMExecutionEngineRef.cs
  15. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMGenericValueRef.cs
  16. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMJITEventListenerRef.cs
  17. +1 −1 sources/LLVMSharp/Interop.Extensions/LLVMMCJITCompilerOptions.cs
  18. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMMCJITMemoryManagerRef.cs
  19. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMMemoryBufferRef.cs
  20. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMMetadataRef.cs
  21. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMModuleFlagEntry.cs
  22. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMModuleProviderRef.cs
  23. +66 −97 sources/LLVMSharp/Interop.Extensions/LLVMModuleRef.cs
  24. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMNamedMDNodeRef.cs
  25. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMObjectFileRef.cs
  26. +0 −26 sources/LLVMSharp/Interop.Extensions/LLVMOptRemarkParserRef.cs
  27. +5 −5 sources/LLVMSharp/Interop.Extensions/LLVMOrcJITStackRef.cs
  28. +10 −10 sources/LLVMSharp/Interop.Extensions/LLVMPassManagerBuilderRef.cs
  29. +10 −10 sources/LLVMSharp/Interop.Extensions/LLVMPassManagerRef.cs
  30. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMPassRegistryRef.cs
  31. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMRelocationIteratorRef.cs
  32. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMRemarkArgRef.cs
  33. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMRemarkDebugLocRef.cs
  34. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMRemarkEntryRef.cs
  35. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMRemarkParserRef.cs
  36. +26 −0 sources/LLVMSharp/Interop.Extensions/LLVMRemarkStringRef.cs
  37. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMSectionIteratorRef.cs
  38. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMSymbolIteratorRef.cs
  39. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMTargetDataRef.cs
  40. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMTargetLibraryInfoRef.cs
  41. +23 −25 sources/LLVMSharp/Interop.Extensions/LLVMTargetMachineRef.cs
  42. +13 −15 sources/LLVMSharp/Interop.Extensions/LLVMTargetRef.cs
  43. +31 −31 sources/LLVMSharp/Interop.Extensions/LLVMTypeRef.cs
  44. +8 −8 sources/LLVMSharp/Interop.Extensions/LLVMUseRef.cs
  45. +170 −190 sources/LLVMSharp/Interop.Extensions/LLVMValueRef.cs
  46. +26 −0 sources/LLVMSharp/Interop.Extensions/lto_code_gen_t.cs
  47. +26 −0 sources/LLVMSharp/Interop.Extensions/lto_input_t.cs
  48. +26 −0 sources/LLVMSharp/Interop.Extensions/lto_module_t.cs
  49. +26 −0 sources/LLVMSharp/Interop.Extensions/thinlto_code_gen_t.cs
  50. +319 −48 sources/LLVMSharp/Interop/LLVM.cs
  51. +1 −1 sources/LLVMSharp/Interop/LLVMAtomicOrdering.cs
  52. +1 −1 sources/LLVMSharp/Interop/LLVMAtomicRMWBinOp.cs
  53. +1 −1 sources/LLVMSharp/Interop/LLVMAttributeIndex.cs
  54. +26 −0 sources/LLVMSharp/Interop/LLVMBinaryType.cs
  55. +1 −1 sources/LLVMSharp/Interop/LLVMByteOrdering.cs
  56. +1 −1 sources/LLVMSharp/Interop/LLVMCallConv.cs
  57. +1 −1 sources/LLVMSharp/Interop/LLVMCodeGenFileType.cs
  58. +1 −1 sources/LLVMSharp/Interop/LLVMCodeGenOptLevel.cs
  59. +1 −1 sources/LLVMSharp/Interop/LLVMCodeModel.cs
  60. +1 −1 sources/LLVMSharp/Interop/LLVMComdat.cs
  61. +1 −1 sources/LLVMSharp/Interop/LLVMComdatSelectionKind.cs
  62. +2 −3 sources/LLVMSharp/Interop/LLVMDIFlags.cs
  63. +1 −1 sources/LLVMSharp/Interop/LLVMDLLStorageClass.cs
  64. +1 −1 sources/LLVMSharp/Interop/LLVMDWARFEmissionKind.cs
  65. +1 −1 sources/LLVMSharp/Interop/LLVMDWARFSourceLanguage.cs
  66. +1 −1 sources/LLVMSharp/Interop/LLVMDiagnosticHandler.cs
  67. +1 −1 sources/LLVMSharp/Interop/LLVMDiagnosticSeverity.cs
  68. +1 −1 sources/LLVMSharp/Interop/LLVMFatalErrorHandler.cs
  69. +1 −1 sources/LLVMSharp/Interop/LLVMInlineAsmDialect.cs
  70. +1 −1 sources/LLVMSharp/Interop/LLVMIntPredicate.cs
  71. +1 −1 sources/LLVMSharp/Interop/LLVMLandingPadClauseTy.cs
  72. +1 −1 sources/LLVMSharp/Interop/LLVMLinkage.cs
  73. +1 −1 sources/LLVMSharp/Interop/LLVMLinkerMode.cs
  74. +1 −1 sources/LLVMSharp/Interop/LLVMMCJITCompilerOptions.cs
  75. +1 −1 sources/LLVMSharp/Interop/LLVMMemoryManagerAllocateCodeSectionCallback.cs
  76. +1 −1 sources/LLVMSharp/Interop/LLVMMemoryManagerAllocateDataSectionCallback.cs
  77. +1 −1 sources/LLVMSharp/Interop/LLVMMemoryManagerDestroyCallback.cs
  78. +1 −1 sources/LLVMSharp/Interop/LLVMMemoryManagerFinalizeMemoryCallback.cs
  79. +2 −1 sources/LLVMSharp/Interop/LLVMMetadataKind.cs
  80. +1 −1 sources/LLVMSharp/Interop/LLVMModuleFlagBehavior.cs
  81. +1 −1 sources/LLVMSharp/Interop/LLVMOpInfo1.cs
  82. +1 −1 sources/LLVMSharp/Interop/LLVMOpInfoCallback.cs
  83. +1 −1 sources/LLVMSharp/Interop/LLVMOpInfoSymbol1.cs
  84. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueAttributeRef.cs
  85. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueBasicBlock.cs
  86. +2 −2 sources/LLVMSharp/Interop/{LLVMOptRemarkOpaqueParser.cs → LLVMOpaqueBinary.cs}
  87. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueBuilder.cs
  88. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueContext.cs
  89. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueDIBuilder.cs
  90. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueDiagnosticInfo.cs
  91. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueError.cs
  92. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueExecutionEngine.cs
  93. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueGenericValue.cs
  94. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueJITEventListener.cs
  95. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueLTOCodeGenerator.cs
  96. +2 −7 sources/LLVMSharp/Interop/{LLVMOptRemarkArg.cs → LLVMOpaqueLTOInput.cs}
  97. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueLTOModule.cs
  98. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueMCJITMemoryManager.cs
  99. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueMemoryBuffer.cs
  100. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueMetadata.cs
  101. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueModule.cs
  102. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueModuleFlagEntry.cs
  103. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueModuleProvider.cs
  104. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueNamedMDNode.cs
  105. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueObjectFile.cs
  106. +1 −1 sources/LLVMSharp/Interop/LLVMOpaquePassManager.cs
  107. +1 −1 sources/LLVMSharp/Interop/LLVMOpaquePassManagerBuilder.cs
  108. +1 −1 sources/LLVMSharp/Interop/LLVMOpaquePassRegistry.cs
  109. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueRelocationIterator.cs
  110. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueSectionIterator.cs
  111. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueSymbolIterator.cs
  112. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueTargetData.cs
  113. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueTargetLibraryInfotData.cs
  114. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueTargetMachine.cs
  115. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueThinLTOCodeGenerator.cs
  116. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueType.cs
  117. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueUse.cs
  118. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueValue.cs
  119. +1 −1 sources/LLVMSharp/Interop/LLVMOpaqueValueMetadataEntry.cs
  120. +2 −1 sources/LLVMSharp/Interop/LLVMOpcode.cs
  121. +0 −29 sources/LLVMSharp/Interop/LLVMOptRemarkEntry.cs
  122. +1 −1 sources/LLVMSharp/Interop/LLVMOrcLazyCompileCallbackFn.cs
  123. +1 −1 sources/LLVMSharp/Interop/LLVMOrcOpaqueJITStack.cs
  124. +1 −1 sources/LLVMSharp/Interop/LLVMOrcSymbolResolverFn.cs
  125. +1 −1 sources/LLVMSharp/Interop/LLVMRealPredicate.cs
  126. +1 −1 sources/LLVMSharp/Interop/LLVMRelocMode.cs
  127. +2 −7 sources/LLVMSharp/Interop/{LLVMOptRemarkStringRef.cs → LLVMRemarkOpaqueArg.cs}
  128. +2 −9 sources/LLVMSharp/Interop/{LLVMOptRemarkDebugLoc.cs → LLVMRemarkOpaqueDebugLoc.cs}
  129. +11 −0 sources/LLVMSharp/Interop/LLVMRemarkOpaqueEntry.cs
  130. +11 −0 sources/LLVMSharp/Interop/LLVMRemarkOpaqueParser.cs
  131. +11 −0 sources/LLVMSharp/Interop/LLVMRemarkOpaqueString.cs
  132. +18 −0 sources/LLVMSharp/Interop/LLVMRemarkType.cs
  133. +1 −1 sources/LLVMSharp/Interop/LLVMSymbolLookupCallback.cs
  134. +1 −1 sources/LLVMSharp/Interop/LLVMTarget.cs
  135. +1 −1 sources/LLVMSharp/Interop/LLVMThreadLocalMode.cs
  136. +1 −1 sources/LLVMSharp/Interop/LLVMTypeKind.cs
  137. +1 −1 sources/LLVMSharp/Interop/LLVMUnnamedAddr.cs
  138. +1 −1 sources/LLVMSharp/Interop/LLVMValueKind.cs
  139. +1 −1 sources/LLVMSharp/Interop/LLVMVerifierFailureAction.cs
  140. +1 −1 sources/LLVMSharp/Interop/LLVMVisibility.cs
  141. +1 −1 sources/LLVMSharp/Interop/LLVMYieldCallback.cs
  142. +1 −1 sources/LLVMSharp/Interop/LTOObjectBuffer.cs
  143. +1 −1 sources/LLVMSharp/Interop/llvm_lto_status.cs
  144. +1 −1 sources/LLVMSharp/Interop/lto_codegen_diagnostic_severity_t.cs
  145. +1 −1 sources/LLVMSharp/Interop/lto_codegen_model.cs
  146. +1 −1 sources/LLVMSharp/Interop/lto_debug_model.cs
  147. +1 −1 sources/LLVMSharp/Interop/lto_diagnostic_handler_t.cs
  148. +1 −1 sources/LLVMSharp/Interop/lto_symbol_attributes.cs
  149. +20 −19 tests/LLVMSharp.UnitTests/Examples.cs
  150. +125 −131 tests/LLVMSharp.UnitTests/IR.cs
  151. +1 −0 tests/LLVMSharp.UnitTests/Modules.cs
  152. +1 −0 tests/LLVMSharp.UnitTests/Targets.cs
  153. +1 −0 tests/LLVMSharp.UnitTests/Types.cs
  154. +1 −0 tests/LLVMSharp.UnitTests/Utilities.cs
@@ -40,7 +40,7 @@
<Company>Microsoft</Company>
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
<Product>LLVMSharp</Product>
<VersionPrefix>8.0.0</VersionPrefix>
<VersionPrefix>9.0.0</VersionPrefix>
<VersionSuffix>beta</VersionSuffix>
</PropertyGroup>

@@ -22,7 +22,7 @@

<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageReference Update="libLLVM" Version="8.0.0" />
<PackageReference Update="libLLVM" Version="9.0.0" />
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.0.0" />
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.3.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.4.0" />
@@ -2,16 +2,16 @@

using System;

namespace LLVMSharp
namespace LLVMSharp.Interop
{
public unsafe partial struct LLVMAttributeRef : IEquatable<LLVMAttributeRef>
{
public LLVMAttributeRef(IntPtr pointer)
public LLVMAttributeRef(IntPtr handle)
{
Pointer = pointer;
Handle = handle;
}

public IntPtr Pointer;
public IntPtr Handle;

public static implicit operator LLVMAttributeRef(LLVMOpaqueAttributeRef* value)
{
@@ -20,7 +20,7 @@ public LLVMAttributeRef(IntPtr pointer)

public static implicit operator LLVMOpaqueAttributeRef*(LLVMAttributeRef value)
{
return (LLVMOpaqueAttributeRef*)value.Pointer;
return (LLVMOpaqueAttributeRef*)value.Handle;
}

public static bool operator ==(LLVMAttributeRef left, LLVMAttributeRef right) => left.Equals(right);
@@ -29,8 +29,8 @@ public LLVMAttributeRef(IntPtr pointer)

public override bool Equals(object obj) => obj is LLVMAttributeRef other && Equals(other);

public bool Equals(LLVMAttributeRef other) => Pointer == other.Pointer;
public bool Equals(LLVMAttributeRef other) => Handle == other.Handle;

public override int GetHashCode() => Pointer.GetHashCode();
public override int GetHashCode() => Handle.GetHashCode();
}
}
@@ -2,16 +2,16 @@

using System;

namespace LLVMSharp
namespace LLVMSharp.Interop
{
public unsafe partial struct LLVMBasicBlockRef : IEquatable<LLVMBasicBlockRef>
{
public LLVMBasicBlockRef(IntPtr pointer)
public LLVMBasicBlockRef(IntPtr handle)
{
Pointer = pointer;
Handle = handle;
}

public IntPtr Pointer;
public IntPtr Handle;

public static explicit operator LLVMBasicBlockRef(LLVMOpaqueValue* value)
{
@@ -25,27 +25,27 @@ public LLVMBasicBlockRef(IntPtr pointer)

public static implicit operator LLVMOpaqueBasicBlock*(LLVMBasicBlockRef value)
{
return (LLVMOpaqueBasicBlock*)value.Pointer;
return (LLVMOpaqueBasicBlock*)value.Handle;
}

public static implicit operator LLVMOpaqueValue*(LLVMBasicBlockRef value)
{
return (LLVMOpaqueValue*)value.Pointer;
return (LLVMOpaqueValue*)value.Handle;
}

public LLVMValueRef FirstInstruction => (Pointer != IntPtr.Zero) ? LLVM.GetFirstInstruction(this) : default;
public LLVMValueRef FirstInstruction => (Handle != IntPtr.Zero) ? LLVM.GetFirstInstruction(this) : default;

public LLVMValueRef LastInstruction => (Pointer != IntPtr.Zero) ? LLVM.GetLastInstruction(this) : default;
public LLVMValueRef LastInstruction => (Handle != IntPtr.Zero) ? LLVM.GetLastInstruction(this) : default;

public LLVMBasicBlockRef Next => (Pointer != IntPtr.Zero) ? LLVM.GetNextBasicBlock(this) : default;
public LLVMBasicBlockRef Next => (Handle != IntPtr.Zero) ? LLVM.GetNextBasicBlock(this) : default;

public LLVMValueRef Parent => (Pointer != IntPtr.Zero) ? LLVM.GetBasicBlockParent(this) : default;
public LLVMValueRef Parent => (Handle != IntPtr.Zero) ? LLVM.GetBasicBlockParent(this) : default;

public LLVMBasicBlockRef Previous => (Pointer != IntPtr.Zero) ? LLVM.GetPreviousBasicBlock(this) : default;
public LLVMBasicBlockRef Previous => (Handle != IntPtr.Zero) ? LLVM.GetPreviousBasicBlock(this) : default;

public LLVMValueRef Terminator => (Pointer != IntPtr.Zero) ? LLVM.GetBasicBlockTerminator(this) : default;
public LLVMValueRef Terminator => (Handle != IntPtr.Zero) ? LLVM.GetBasicBlockTerminator(this) : default;

public static bool operator ==(LLVMBasicBlockRef left, LLVMBasicBlockRef right) => left.Pointer == right.Pointer;
public static bool operator ==(LLVMBasicBlockRef left, LLVMBasicBlockRef right) => left.Handle == right.Handle;

public static bool operator !=(LLVMBasicBlockRef left, LLVMBasicBlockRef right) => !(left == right);

@@ -57,16 +57,14 @@ public LLVMBasicBlockRef(IntPtr pointer)

public override bool Equals(object obj) => obj is LLVMBasicBlockRef other && Equals(other);

public bool Equals(LLVMBasicBlockRef other) => Pointer == other.Pointer;
public bool Equals(LLVMBasicBlockRef other) => Handle == other.Handle;

public override int GetHashCode() => Pointer.GetHashCode();
public override int GetHashCode() => Handle.GetHashCode();

public LLVMBasicBlockRef InsertBasicBlock(string Name)
{
using (var marshaledName = new MarshaledString(Name))
{
return LLVM.InsertBasicBlock(this, marshaledName);
}
using var marshaledName = new MarshaledString(Name);
return LLVM.InsertBasicBlock(this, marshaledName);
}

public void MoveAfter(LLVMBasicBlockRef MovePos) => LLVM.MoveBasicBlockAfter(this, MovePos);
@@ -90,6 +88,6 @@ public string PrintToString()

public void RemoveFromParent() => LLVM.RemoveBasicBlockFromParent(this);

public override string ToString() => (Pointer != IntPtr.Zero) ? PrintToString() : string.Empty;
public override string ToString() => (Handle != IntPtr.Zero) ? PrintToString() : string.Empty;
}
}
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information.

using System;

namespace LLVMSharp.Interop
{
public unsafe partial struct LLVMBinaryRef
{
public LLVMBinaryRef(IntPtr handle)
{
Handle = handle;
}

public IntPtr Handle;

public static implicit operator LLVMBinaryRef(LLVMOpaqueBinary* Comdat)
{
return new LLVMBinaryRef((IntPtr)Comdat);
}

public static implicit operator LLVMOpaqueBinary*(LLVMBinaryRef Comdat)
{
return (LLVMOpaqueBinary*)Comdat.Handle;
}
}
}

0 comments on commit 52b94ee

Please sign in to comment.
You can’t perform that action at this time.