Skip to content

Commit

Permalink
Merge pull request #9 from xushiwei/q
Browse files Browse the repository at this point in the history
cast api
  • Loading branch information
xushiwei authored Apr 28, 2024
2 parents 6230a4e + d083ead commit 3476221
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
25 changes: 25 additions & 0 deletions z_llvmext.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3476221

Please sign in to comment.