Skip to content

Commit

Permalink
Remove support for LLVM 11 and LLVM 12
Browse files Browse the repository at this point in the history
Also clean up some old stuff from before LLVM 11.
  • Loading branch information
aykevl committed Jun 25, 2022
1 parent 512c94c commit 4cc1e6d
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 203 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,6 @@ name: Test
on: [push, pull_request]

jobs:
test-macos-llvm-11:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install LLVM
run: |
brew install llvm@11
- name: Test LLVM 11
run:
go test -v -tags=llvm11
test-macos-llvm-12:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install LLVM
run: |
brew install llvm@12
- name: Test LLVM 12
run:
go test -v -tags=llvm12
test-macos-llvm-13:
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -84,31 +62,3 @@ jobs:
- name: Test default LLVM
run:
go test -v
test-linux-llvm-12:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install LLVM
run: |
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main' | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install --no-install-recommends llvm-12-dev
- name: Test LLVM 12
run:
go test -v -tags=llvm12
test-linux-llvm-11:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install LLVM
run: |
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install --no-install-recommends llvm-11-dev
- name: Test LLVM 11
run:
go test -v -tags=llvm11
52 changes: 0 additions & 52 deletions backports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,12 @@
#include "llvm/Transforms/Coroutines.h"
#include "llvm-c/DebugInfo.h"

namespace llvm {

#if LLVM_VERSION_MAJOR < 11
inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {
return reinterpret_cast<PassManagerBuilder*>(P);
}

inline LLVMPassManagerBuilderRef wrap(PassManagerBuilder *P) {
return reinterpret_cast<LLVMPassManagerBuilderRef>(P);
}
#endif

} // end namespace llvm

void LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints_backport(LLVMPassManagerBuilderRef PMB) {
llvm::PassManagerBuilder *Builder = llvm::unwrap(PMB);
llvm::addCoroutinePassesToExtensionPoints(*Builder);
}

void LLVMGlobalObjectAddMetadata(LLVMValueRef Global, unsigned KindID, LLVMMetadataRef MD) {
llvm::MDNode *N = MD ? llvm::unwrap<llvm::MDNode>(MD) : nullptr;
llvm::GlobalObject *O = llvm::unwrap<llvm::GlobalObject>(Global);
O->addMetadata(KindID, *N);
}

LLVMMetadataRef
LLVMGoDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
const char *Name, size_t NameLen,
LLVMMetadataRef File, unsigned LineNo,
LLVMMetadataRef Scope, uint32_t AlignInBits) {
#if LLVM_VERSION_MAJOR >= 10
return LLVMDIBuilderCreateTypedef(Builder, Type, Name, NameLen, File, LineNo, Scope, AlignInBits);
#else
return LLVMDIBuilderCreateTypedef(Builder, Type, Name, NameLen, File, LineNo, Scope);
#endif
}

LLVMMetadataRef LLVMGoDIBuilderCreateCompileUnit(
LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen,
const char *SDK, size_t SDKLen) {

#if LLVM_VERSION_MAJOR >= 11
return LLVMDIBuilderCreateCompileUnit(Builder, Lang, FileRef, Producer,
ProducerLen, isOptimized, Flags, FlagsLen, RuntimeVer, SplitName,
SplitNameLen, Kind, DWOId, SplitDebugInlining, DebugInfoForProfiling,
SysRoot, SysRootLen, SDK, SDKLen);
#else
return LLVMDIBuilderCreateCompileUnit(Builder, Lang, FileRef, Producer,
ProducerLen, isOptimized, Flags, FlagsLen, RuntimeVer, SplitName,
SplitNameLen, Kind, DWOId, SplitDebugInlining, DebugInfoForProfiling);
#endif
}

// See https://reviews.llvm.org/D119431
LLVMMemoryBufferRef LLVMGoWriteThinLTOBitcodeToMemoryBuffer(LLVMModuleRef M) {
std::string Data;
Expand Down
20 changes: 0 additions & 20 deletions backports.go

This file was deleted.

17 changes: 0 additions & 17 deletions backports.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,8 @@
extern "C" {
#endif

void LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints_backport(LLVMPassManagerBuilderRef PMB);

void LLVMGlobalObjectAddMetadata(LLVMValueRef objValue, unsigned KindID, LLVMMetadataRef md);

LLVMMetadataRef
LLVMGoDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
const char *Name, size_t NameLen,
LLVMMetadataRef File, unsigned LineNo,
LLVMMetadataRef Scope, uint32_t AlignInBits);

LLVMMetadataRef LLVMGoDIBuilderCreateCompileUnit(
LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen,
const char *SDK, size_t SDKLen);

LLVMMemoryBufferRef LLVMGoWriteThinLTOBitcodeToMemoryBuffer(LLVMModuleRef M);

LLVMMetadataRef LLVMGoDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
Expand Down
4 changes: 2 additions & 2 deletions dibuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (d *DIBuilder) CreateCompileUnit(cu DICompileUnit) Metadata {
defer C.free(unsafe.Pointer(sysroot))
sdk := C.CString(cu.SDK)
defer C.free(unsafe.Pointer(sdk))
result := C.LLVMGoDIBuilderCreateCompileUnit(
result := C.LLVMDIBuilderCreateCompileUnit(
d.ref,
C.LLVMDWARFSourceLanguage(cu.Language),
C.LLVMDIBuilderCreateFile(d.ref, file, C.size_t(len(cu.File)), dir, C.size_t(len(cu.Dir))),
Expand Down Expand Up @@ -557,7 +557,7 @@ type DITypedef struct {
func (d *DIBuilder) CreateTypedef(t DITypedef) Metadata {
name := C.CString(t.Name)
defer C.free(unsafe.Pointer(name))
result := C.LLVMGoDIBuilderCreateTypedef(
result := C.LLVMDIBuilderCreateTypedef(
d.ref,
t.Type.C,
name,
Expand Down
16 changes: 0 additions & 16 deletions llvm_config_darwin_llvm11.go

This file was deleted.

16 changes: 0 additions & 16 deletions llvm_config_darwin_llvm12.go

This file was deleted.

4 changes: 2 additions & 2 deletions llvm_config_darwin_llvm13.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !byollvm && darwin && !llvm11 && !llvm12
// +build !byollvm,darwin,!llvm11,!llvm12
//go:build !byollvm && darwin
// +build !byollvm,darwin

package llvm

Expand Down
13 changes: 0 additions & 13 deletions llvm_config_linux_llvm11.go

This file was deleted.

13 changes: 0 additions & 13 deletions llvm_config_linux_llvm12.go

This file was deleted.

4 changes: 2 additions & 2 deletions llvm_config_linux_llvm13.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !byollvm && linux && !llvm11 && !llvm12 && !llvm14
// +build !byollvm,linux,!llvm11,!llvm12,!llvm14
//go:build !byollvm && linux && !llvm14
// +build !byollvm,linux,!llvm14

package llvm

Expand Down

0 comments on commit 4cc1e6d

Please sign in to comment.