From cc074f2b60bd241895a3c5bb8632ae52efd4e112 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 29 Apr 2024 03:23:03 +0800 Subject: [PATCH 1/2] cast api --- z_llvmext.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/z_llvmext.go b/z_llvmext.go index d3cba42..29ff5f2 100644 --- a/z_llvmext.go +++ b/z_llvmext.go @@ -61,6 +61,31 @@ func CreateFCmp(b Builder, op FloatPredicate, lhs, rhs Value) (v Value) { return } +func CreateIntCast(b Builder, v Value, t Type) (r Value) { + r.C = C.LLVMBuildIntCast(b.C, v.C, t.C, &emptyCStr[0]) + return +} + +func CreateTrunc(b Builder, v Value, t Type) (r Value) { + r.C = C.LLVMBuildTrunc(b.C, v.C, t.C, &emptyCStr[0]) + return +} + +func CreatePtrToInt(b Builder, v Value, t Type) (r Value) { + r.C = C.LLVMBuildPtrToInt(b.C, v.C, t.C, &emptyCStr[0]) + return +} + +func CreateIntToPtr(b Builder, v Value, t Type) (r Value) { + r.C = C.LLVMBuildIntToPtr(b.C, v.C, t.C, &emptyCStr[0]) + return +} + +func CreatePointerCast(b Builder, v Value, t Type) (r Value) { + r.C = C.LLVMBuildPointerCast(b.C, v.C, t.C, &emptyCStr[0]) + return +} + func CreateAlloca(b Builder, t Type) (v Value) { v.C = C.LLVMBuildAlloca(b.C, t.C, &emptyCStr[0]) return From d083ead9053fc7201fbee3940d5a0cfd114b0f29 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 29 Apr 2024 03:29:41 +0800 Subject: [PATCH 2/2] ci: setup go --- .github/workflows/go.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index fcf9444..4930b6d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,12 +11,18 @@ jobs: strategy: matrix: llvm: [14, 15, 16, 17] + go-version: [1.18.x, 1.21.x] + steps: - name: Checkout uses: actions/checkout@v2 - name: Update Homebrew if: matrix.llvm == 17 # needed as long as LLVM 17 is still fresh run: brew update + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} - name: Install LLVM run: HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.llvm }} - name: Test LLVM ${{ matrix.llvm }}