Skip to content

Commit

Permalink
Upgrade to LLVM 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mjsabby committed Sep 15, 2017
1 parent 3e192c3 commit 2dd8325
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 161 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -184,3 +184,4 @@ FakesAssemblies/
*.exe
*.dll
*.db
*.ide
25 changes: 25 additions & 0 deletions Conversions.cs
@@ -1,5 +1,7 @@
namespace LLVMSharp
{
using System;

partial struct LLVMBool
{
public static implicit operator bool(LLVMBool b)
Expand All @@ -25,4 +27,27 @@ partial struct LLVMValueRef
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();
}
}
}
28 changes: 0 additions & 28 deletions Generated.Custom.cs
Expand Up @@ -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)]
Expand Down
221 changes: 129 additions & 92 deletions Generated.cs

Large diffs are not rendered by default.

42 changes: 8 additions & 34 deletions LLVMSharp.csproj
@@ -1,35 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E230F816-0E92-4AE4-83E4-24D74DEB9609}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>LLVMSharp</RootNamespace>
<AssemblyName>LLVMSharp</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFramework>netstandard1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Conversions.cs" />
<Compile Include="ExecutionEngine.cs" />
Expand All @@ -38,13 +10,15 @@
<Compile Include="IRBuilder.cs" />
<Compile Include="LLVMBasicBlockRef.cs" />
<Compile Include="LLVMContextRef.cs" />
<Compile Include="LLVMTypeRef.cs" />
<Compile Include="LLVMTypeRef.Static.cs" />
<Compile Include="LLVMValueRef.cs" />
<Compile Include="LLVMValueRef.Static.cs" />
<Compile Include="Overloads.cs" />
<Compile Include="Module.cs" />
<Compile Include="PassManager.cs" />
<Compile Include="LLVMTypeRef.cs" />
<Compile Include="Overloads.cs" />
<Compile Include="LLVMValueRef.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.0" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions LLVMSharp.sln
@@ -1,20 +1,20 @@

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
Debug|Any CPU = Debug|Any CPU
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
Expand Down
30 changes: 30 additions & 0 deletions Overloads.cs
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}
}
}
29 changes: 29 additions & 0 deletions 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"
}

0 comments on commit 2dd8325

Please sign in to comment.