Skip to content

Commit bba3c70

Browse files
committed
Add support for LLVM 17 (but don't use it as default yet)
1 parent 32ed56c commit bba3c70

11 files changed

+53
-161
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ jobs:
4545
- name: Test default LLVM
4646
run:
4747
go test -v
48+
test-macos-llvm-17:
49+
runs-on: macos-latest
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v2
53+
- name: Install LLVM
54+
run: |
55+
brew update
56+
brew install llvm@17
57+
- name: Test LLVM 17
58+
run:
59+
go test -v -tags=llvm17
4860
test-linux-llvm-14:
4961
runs-on: ubuntu-20.04
5062
steps:
@@ -90,3 +102,17 @@ jobs:
90102
- name: Test default LLVM
91103
run:
92104
go test -v
105+
test-linux-llvm-17:
106+
runs-on: ubuntu-20.04
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@v2
110+
- name: Install LLVM
111+
run: |
112+
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main' | sudo tee /etc/apt/sources.list.d/llvm.list
113+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
114+
sudo apt-get update
115+
sudo apt-get install --no-install-recommends llvm-17-dev
116+
- name: Test LLVM 17
117+
run:
118+
go test -v -tags=llvm17

backports.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
#include "llvm-c/DebugInfo.h"
33
#include "llvm-c/Types.h"
4-
#include "llvm-c/Transforms/PassManagerBuilder.h"
54

65
#ifdef __cplusplus
76
extern "C" {

executionengine_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,6 @@ func TestFactorial(t *testing.T) {
7878
}
7979
defer engine.Dispose()
8080

81-
pass := NewPassManager()
82-
defer pass.Dispose()
83-
84-
pass.AddSCCPPass()
85-
pass.AddInstructionCombiningPass()
86-
pass.AddPromoteMemoryToRegisterPass()
87-
pass.AddGVNPass()
88-
pass.AddCFGSimplificationPass()
89-
pass.Run(mod)
90-
9181
exec_args := []GenericValue{NewGenericValueFromInt(ctx.Int32Type(), 10, false)}
9282
exec_res := engine.RunFunction(fac, exec_args)
9383
var fac10 uint64 = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1

ir.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -980,10 +980,6 @@ func ConstIntCast(v Value, t Type, signed bool) (rv Value) {
980980
return
981981
}
982982
func ConstFPCast(v Value, t Type) (rv Value) { rv.C = C.LLVMConstFPCast(v.C, t.C); return }
983-
func ConstSelect(cond, iftrue, iffalse Value) (rv Value) {
984-
rv.C = C.LLVMConstSelect(cond.C, iftrue.C, iffalse.C)
985-
return
986-
}
987983
func ConstExtractElement(vec, i Value) (rv Value) {
988984
rv.C = C.LLVMConstExtractElement(vec.C, i.C)
989985
return

llvm_config_darwin_llvm16.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !byollvm && darwin && !llvm14 && !llvm15
1+
//go:build !byollvm && darwin && !llvm14 && !llvm15 && !llvm17
22

33
package llvm
44

llvm_config_darwin_llvm17.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//go:build !byollvm && darwin && llvm17
2+
3+
package llvm
4+
5+
// Automatically generated by `make config BUILDDIR=`, do not edit.
6+
7+
// #cgo amd64 CPPFLAGS: -I/usr/local/opt/llvm@17/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
8+
// #cgo amd64 CXXFLAGS: -std=c++17
9+
// #cgo amd64 LDFLAGS: -L/usr/local/opt/llvm@17/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM -lz -lcurses -lm -lxml2
10+
// #cgo arm64 CPPFLAGS: -I/opt/homebrew/opt/llvm@17/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
11+
// #cgo arm64 CXXFLAGS: -std=c++17
12+
// #cgo arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@17/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM -lz -lcurses -lm -lxml2
13+
import "C"
14+
15+
type run_build_sh int

llvm_config_linux_llvm16.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !byollvm && linux && !llvm14 && !llvm15
1+
//go:build !byollvm && linux && !llvm14 && !llvm15 && !llvm17
22

33
package llvm
44

llvm_config_linux_llvm17.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build !byollvm && linux && llvm17
2+
3+
package llvm
4+
5+
// #cgo CPPFLAGS: -I/usr/include/llvm-17 -I/usr/include/llvm-c-17 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
6+
// #cgo CXXFLAGS: -std=c++17
7+
// #cgo LDFLAGS: -L/usr/lib/llvm-17/lib -lLLVM-17
8+
import "C"
9+
10+
type run_build_sh int

transforms_ipo.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

transforms_pmbuilder.go

Lines changed: 0 additions & 63 deletions
This file was deleted.

transforms_scalar.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)