Skip to content

Commit

Permalink
Update to cranelift 0.86 (rust-lang#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
afonso360 authored Jul 28, 2022
1 parent e34bb03 commit 49e7731
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 54 deletions.
129 changes: 86 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { version = "0.85.3", features = ["unwind", "all-arch"] }
cranelift-frontend = "0.85.3"
cranelift-module = "0.85.3"
cranelift-native = "0.85.3"
cranelift-jit = { version = "0.85.3", optional = true }
cranelift-object = "0.85.3"
cranelift-codegen = { version = "0.86.1", features = ["unwind", "all-arch"] }
cranelift-frontend = "0.86.1"
cranelift-module = "0.86.1"
cranelift-native = "0.86.1"
cranelift-jit = { version = "0.86.1", optional = true }
cranelift-object = "0.86.1"
target-lexicon = "0.12.0"
gimli = { version = "0.26.0", default-features = false, features = ["write"]}
object = { version = "0.28.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
Expand Down
2 changes: 1 addition & 1 deletion src/abi/pass_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn reg_to_abi_param(reg: Reg) -> AbiParam {
(RegKind::Integer, 9..=16) => types::I128,
(RegKind::Float, 4) => types::F32,
(RegKind::Float, 8) => types::F64,
(RegKind::Vector, size) => types::I8.by(u16::try_from(size).unwrap()).unwrap(),
(RegKind::Vector, size) => types::I8.by(u32::try_from(size).unwrap()).unwrap(),
_ => unreachable!("{:?}", reg),
};
AbiParam::new(clif_ty)
Expand Down
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
_ => unreachable!(),
};

match scalar_to_clif_type(tcx, element).by(u16::try_from(count).unwrap()) {
match scalar_to_clif_type(tcx, element).by(u32::try_from(count).unwrap()) {
// Cranelift currently only implements icmp for 128bit vectors.
Some(vector_ty) if vector_ty.bits() == 128 => vector_ty,
_ => return None,
Expand Down
2 changes: 1 addition & 1 deletion src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub(crate) fn clif_vector_type<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx
_ => unreachable!(),
};

match scalar_to_clif_type(tcx, element).by(u16::try_from(count).unwrap()) {
match scalar_to_clif_type(tcx, element).by(u32::try_from(count).unwrap()) {
// Cranelift currently only implements icmp for 128bit vectors.
Some(vector_ty) if vector_ty.bits() == 128 => Some(vector_ty),
_ => None,
Expand Down
4 changes: 2 additions & 2 deletions src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<'tcx> CValue<'tcx> {
let clif_ty = match layout.abi {
Abi::Scalar(scalar) => scalar_to_clif_type(fx.tcx, scalar),
Abi::Vector { element, count } => scalar_to_clif_type(fx.tcx, element)
.by(u16::try_from(count).unwrap())
.by(u32::try_from(count).unwrap())
.unwrap(),
_ => unreachable!("{:?}", layout.ty),
};
Expand Down Expand Up @@ -519,7 +519,7 @@ impl<'tcx> CPlace<'tcx> {
if let ty::Array(element, len) = dst_layout.ty.kind() {
// Can only happen for vector types
let len =
u16::try_from(len.eval_usize(fx.tcx, ParamEnv::reveal_all())).unwrap();
u32::try_from(len.eval_usize(fx.tcx, ParamEnv::reveal_all())).unwrap();
let vector_ty = fx.clif_type(*element).unwrap().by(len).unwrap();

let data = match from.0 {
Expand Down

0 comments on commit 49e7731

Please sign in to comment.