Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for LLVM 18 (and use it by default) #61

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
llvm: [14, 15, 16, 17]
llvm: [14, 15, 16, 17, 18]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Update Homebrew
if: matrix.llvm == 17 # needed as long as LLVM 17 is still fresh
run: brew update
#- name: Update Homebrew
# if: matrix.llvm == 17 # needed as long as LLVM 17 is still fresh
# run: brew update
- name: Install LLVM
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.llvm }}
- name: Test LLVM ${{ matrix.llvm }}
run:
go test -v -tags=llvm${{ matrix.llvm }}
- name: Test default LLVM
if: matrix.llvm == 17
if: matrix.llvm == 18
run:
go test -v
test-linux:
runs-on: ubuntu-20.04
strategy:
matrix:
llvm: [14, 15, 16, 17]
llvm: [14, 15, 16, 17, 18]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -52,6 +52,6 @@ jobs:
run:
go test -v -tags=llvm${{ matrix.llvm }}
- name: Test default LLVM
if: matrix.llvm == 17
if: matrix.llvm == 18
run:
go test -v
25 changes: 0 additions & 25 deletions ir.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,6 @@ func ConstNUWSub(lhs, rhs Value) (v Value) { v.C = C.LLVMConstNUWSub(lhs.C, rhs.
func ConstMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstMul(lhs.C, rhs.C); return }
func ConstNSWMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstNSWMul(lhs.C, rhs.C); return }
func ConstNUWMul(lhs, rhs Value) (v Value) { v.C = C.LLVMConstNUWMul(lhs.C, rhs.C); return }
func ConstAnd(lhs, rhs Value) (v Value) { v.C = C.LLVMConstAnd(lhs.C, rhs.C); return }
func ConstOr(lhs, rhs Value) (v Value) { v.C = C.LLVMConstOr(lhs.C, rhs.C); return }
func ConstXor(lhs, rhs Value) (v Value) { v.C = C.LLVMConstXor(lhs.C, rhs.C); return }

func ConstICmp(pred IntPredicate, lhs, rhs Value) (v Value) {
Expand All @@ -937,8 +935,6 @@ func ConstFCmp(pred FloatPredicate, lhs, rhs Value) (v Value) {
}

func ConstShl(lhs, rhs Value) (v Value) { v.C = C.LLVMConstShl(lhs.C, rhs.C); return }
func ConstLShr(lhs, rhs Value) (v Value) { v.C = C.LLVMConstLShr(lhs.C, rhs.C); return }
func ConstAShr(lhs, rhs Value) (v Value) { v.C = C.LLVMConstAShr(lhs.C, rhs.C); return }

func ConstGEP(t Type, v Value, indices []Value) (rv Value) {
ptr, nvals := llvmValueRefs(indices)
Expand All @@ -951,35 +947,14 @@ func ConstInBoundsGEP(t Type, v Value, indices []Value) (rv Value) {
return
}
func ConstTrunc(v Value, t Type) (rv Value) { rv.C = C.LLVMConstTrunc(v.C, t.C); return }
func ConstSExt(v Value, t Type) (rv Value) { rv.C = C.LLVMConstSExt(v.C, t.C); return }
func ConstZExt(v Value, t Type) (rv Value) { rv.C = C.LLVMConstZExt(v.C, t.C); return }
func ConstFPTrunc(v Value, t Type) (rv Value) { rv.C = C.LLVMConstFPTrunc(v.C, t.C); return }
func ConstFPExt(v Value, t Type) (rv Value) { rv.C = C.LLVMConstFPExt(v.C, t.C); return }
func ConstUIToFP(v Value, t Type) (rv Value) { rv.C = C.LLVMConstUIToFP(v.C, t.C); return }
func ConstSIToFP(v Value, t Type) (rv Value) { rv.C = C.LLVMConstSIToFP(v.C, t.C); return }
func ConstFPToUI(v Value, t Type) (rv Value) { rv.C = C.LLVMConstFPToUI(v.C, t.C); return }
func ConstFPToSI(v Value, t Type) (rv Value) { rv.C = C.LLVMConstFPToSI(v.C, t.C); return }
func ConstPtrToInt(v Value, t Type) (rv Value) { rv.C = C.LLVMConstPtrToInt(v.C, t.C); return }
func ConstIntToPtr(v Value, t Type) (rv Value) { rv.C = C.LLVMConstIntToPtr(v.C, t.C); return }
func ConstBitCast(v Value, t Type) (rv Value) { rv.C = C.LLVMConstBitCast(v.C, t.C); return }
func ConstZExtOrBitCast(v Value, t Type) (rv Value) {
rv.C = C.LLVMConstZExtOrBitCast(v.C, t.C)
return
}
func ConstSExtOrBitCast(v Value, t Type) (rv Value) {
rv.C = C.LLVMConstSExtOrBitCast(v.C, t.C)
return
}
func ConstTruncOrBitCast(v Value, t Type) (rv Value) {
rv.C = C.LLVMConstTruncOrBitCast(v.C, t.C)
return
}
func ConstPointerCast(v Value, t Type) (rv Value) { rv.C = C.LLVMConstPointerCast(v.C, t.C); return }
func ConstIntCast(v Value, t Type, signed bool) (rv Value) {
rv.C = C.LLVMConstIntCast(v.C, t.C, boolToLLVMBool(signed))
return
}
func ConstFPCast(v Value, t Type) (rv Value) { rv.C = C.LLVMConstFPCast(v.C, t.C); return }
func ConstExtractElement(vec, i Value) (rv Value) {
rv.C = C.LLVMConstExtractElement(vec.C, i.C)
return
Expand Down
2 changes: 1 addition & 1 deletion llvm_config_darwin_llvm17.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !byollvm && darwin && !llvm14 && !llvm15 && !llvm16
//go:build !byollvm && darwin && llvm17

package llvm

Expand Down
15 changes: 15 additions & 0 deletions llvm_config_darwin_llvm18.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build !byollvm && darwin && !llvm14 && !llvm15 && !llvm16 && !llvm17

package llvm

// Automatically generated by `make config BUILDDIR=`, do not edit.

// #cgo amd64 CPPFLAGS: -I/usr/local/opt/llvm@18/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo amd64 CXXFLAGS: -std=c++17
// #cgo amd64 LDFLAGS: -L/usr/local/opt/llvm@18/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM -lz -lm
// #cgo arm64 CPPFLAGS: -I/opt/homebrew/opt/llvm@18/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo arm64 CXXFLAGS: -std=c++17
// #cgo arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@18/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM -lz -lm
import "C"

type run_build_sh int
2 changes: 1 addition & 1 deletion llvm_config_linux_llvm17.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !byollvm && linux && !llvm14 && !llvm15 && !llvm16
//go:build !byollvm && linux && llvm17

package llvm

Expand Down
10 changes: 10 additions & 0 deletions llvm_config_linux_llvm18.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build !byollvm && linux && !llvm14 && !llvm15 && !llvm16 && !llvm17

package llvm

// #cgo CPPFLAGS: -I/usr/include/llvm-18 -I/usr/include/llvm-c-18 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo CXXFLAGS: -std=c++17
// #cgo LDFLAGS: -L/usr/lib/llvm-18/lib -lLLVM-18
import "C"

type run_build_sh int
Loading