aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-11-20 00:26:23 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-11-21 00:11:25 +0100
commit105089e17aa19b326f6d0fd00b00edd9e3ad5564 (patch)
tree3b72a8c66921f7ee75703e1f7320949f476dcda1
parent2efe1727344b4fb372df6d6ae3cbe1fa72567542 (diff)
downloadllvm-kaleidoscope-rs-105089e17aa19b326f6d0fd00b00edd9e3ad5564.tar.gz
llvm-kaleidoscope-rs-105089e17aa19b326f6d0fd00b00edd9e3ad5564.zip
bump to llvm15
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml2
-rw-r--r--docker/Dockerfile7
-rw-r--r--src/llvm/builder.rs2
-rw-r--r--src/llvm/value.rs11
5 files changed, 14 insertions, 12 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 134607a..d59be7d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -39,9 +39,9 @@ dependencies = [
[[package]]
name = "llvm-sys"
-version = "140.0.3"
+version = "150.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b9eda9cc6f86672152125b1e112d66ab8797b7917fb202e2faee912caa76413"
+checksum = "417dbaef2fece3b186fe15704e010849279de5f7eea1caa8845558130867bdd2"
dependencies = [
"cc",
"lazy_static",
diff --git a/Cargo.toml b/Cargo.toml
index b3fa950..c21b5d2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,4 +5,4 @@ edition = "2018"
[dependencies]
libc = "0.2"
-llvm-sys = {version = "140.0", features = ["strict-versioning"]}
+llvm-sys = {version = "150.0", features = ["strict-versioning"]}
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 5a7b498..9cb8b44 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -8,10 +8,11 @@ RUN apt update && \
ca-certificates \
build-essential \
cargo \
- llvm-14 \
- llvm-14-dev \
+ llvm-15 \
+ llvm-15-dev \
+ # For polly dependency.
# https://gitlab.com/taricorp/llvm-sys.rs/-/issues/13
- libclang-common-14-dev \
+ libclang-common-15-dev \
zlib1g-dev \
&& \
rm -rf /var/lib/apt/lists/* && \
diff --git a/src/llvm/builder.rs b/src/llvm/builder.rs
index da10231..99f26b7 100644
--- a/src/llvm/builder.rs
+++ b/src/llvm/builder.rs
@@ -195,7 +195,7 @@ impl<'llvm> IRBuilder<'llvm> {
let value_ref = unsafe {
LLVMBuildCall2(
self.builder,
- fn_value.ret_type(),
+ fn_value.fn_type(),
fn_value,
args.as_mut_ptr(),
args.len() as libc::c_uint,
diff --git a/src/llvm/value.rs b/src/llvm/value.rs
index 912c14e..98d2e77 100644
--- a/src/llvm/value.rs
+++ b/src/llvm/value.rs
@@ -4,13 +4,12 @@ use llvm_sys::{
analysis::{LLVMVerifierFailureAction, LLVMVerifyFunction},
core::{
LLVMAddIncoming, LLVMAppendExistingBasicBlock, LLVMCountBasicBlocks, LLVMCountParams,
- LLVMDumpValue, LLVMGetParam, LLVMGetReturnType, LLVMGetValueKind, LLVMGetValueName2,
+ LLVMDumpValue, LLVMGetParam, LLVMGetValueKind, LLVMGetValueName2, LLVMGlobalGetValueType,
LLVMIsAFunction, LLVMIsAPHINode, LLVMSetValueName2, LLVMTypeOf,
},
prelude::LLVMValueRef,
LLVMTypeKind, LLVMValueKind,
};
-
use std::ffi::CStr;
use std::marker::PhantomData;
use std::ops::Deref;
@@ -139,13 +138,15 @@ impl<'llvm> FnValue<'llvm> {
FnValue(value)
}
- /// Get a type reference representing the return value of the given function value.
+ /// Get a type reference representing the function type (return + args) of the given function
+ /// value.
///
/// # Panics
///
/// Panics if LLVM API returns a `null` pointer.
- pub fn ret_type(&self) -> Type<'llvm> {
- let type_ref = unsafe { LLVMGetReturnType(LLVMTypeOf(self.value_ref())) };
+ pub fn fn_type(&self) -> Type<'llvm> {
+ // https://github.com/llvm/llvm-project/issues/72798
+ let type_ref = unsafe { LLVMGlobalGetValueType(self.value_ref()) };
Type::new(type_ref)
}