about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-10-01 15:37:48 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-10-01 15:37:48 +0200
commiteded3690869bad32185607000a0d3996e81d2073 (patch)
tree603362f9793cd3442f38bcb9606ac1ca530254af
parentbc61fb263d7f51b29d5e6b92ef583b577a849fff (diff)
downloadrust-eded3690869bad32185607000a0d3996e81d2073.tar.gz
rust-eded3690869bad32185607000a0d3996e81d2073.zip
Update Cranelift
This version no longer has the old x86 backend
-rw-r--r--Cargo.lock20
-rw-r--r--src/debuginfo/mod.rs44
-rw-r--r--src/lib.rs8
3 files changed, 24 insertions, 48 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a55c2efe031..e2f6b92e6ba 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -34,7 +34,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 [[package]]
 name = "cranelift-bforest"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "cranelift-entity",
 ]
@@ -42,7 +42,7 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "cranelift-bforest",
  "cranelift-codegen-meta",
@@ -58,7 +58,7 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen-meta"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "cranelift-codegen-shared",
  "cranelift-entity",
@@ -67,17 +67,17 @@ dependencies = [
 [[package]]
 name = "cranelift-codegen-shared"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 
 [[package]]
 name = "cranelift-entity"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 
 [[package]]
 name = "cranelift-frontend"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "cranelift-codegen",
  "log",
@@ -88,7 +88,7 @@ dependencies = [
 [[package]]
 name = "cranelift-jit"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -105,7 +105,7 @@ dependencies = [
 [[package]]
 name = "cranelift-module"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -116,7 +116,7 @@ dependencies = [
 [[package]]
 name = "cranelift-native"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "cranelift-codegen",
  "libc",
@@ -126,7 +126,7 @@ dependencies = [
 [[package]]
 name = "cranelift-object"
 version = "0.77.0"
-source = "git+https://github.com/bytecodealliance/wasmtime.git#fa108d9a86827a28c7bfb8ff98033734b2a5fd33"
+source = "git+https://github.com/bytecodealliance/wasmtime.git#bae4ec642798ff448ca88eab771b6fcea71e7884"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs
index 6d172817cb1..dd19dd5d2b9 100644
--- a/src/debuginfo/mod.rs
+++ b/src/debuginfo/mod.rs
@@ -10,7 +10,7 @@ use crate::prelude::*;
 use rustc_index::vec::IndexVec;
 
 use cranelift_codegen::entity::EntityRef;
-use cranelift_codegen::ir::{LabelValueLoc, StackSlots, ValueLabel, ValueLoc};
+use cranelift_codegen::ir::{LabelValueLoc, ValueLabel};
 use cranelift_codegen::isa::TargetIsa;
 use cranelift_codegen::ValueLocRange;
 
@@ -67,7 +67,12 @@ impl<'tcx> DebugContext<'tcx> {
             rustc_interface::util::version_str().unwrap_or("unknown version"),
             cranelift_codegen::VERSION,
         );
-        let comp_dir = tcx.sess.opts.working_dir.to_string_lossy(FileNameDisplayPreference::Remapped).into_owned();
+        let comp_dir = tcx
+            .sess
+            .opts
+            .working_dir
+            .to_string_lossy(FileNameDisplayPreference::Remapped)
+            .into_owned();
         let (name, file_info) = match tcx.sess.local_crate_source_file.clone() {
             Some(path) => {
                 let name = path.to_string_lossy().into_owned();
@@ -250,7 +255,7 @@ impl<'tcx> DebugContext<'tcx> {
 
         // FIXME make it more reliable and implement scopes before re-enabling this.
         if false {
-            let value_labels_ranges = context.build_value_labels_ranges(isa).unwrap();
+            let value_labels_ranges = std::collections::HashMap::new(); // FIXME
 
             for (local, _local_decl) in mir.local_decls.iter_enumerated() {
                 let ty = self.tcx.subst_and_normalize_erasing_regions(
@@ -264,7 +269,6 @@ impl<'tcx> DebugContext<'tcx> {
                     self,
                     isa,
                     symbol,
-                    context,
                     &local_map,
                     &value_labels_ranges,
                     Place { local, projection: ty::List::empty() },
@@ -283,7 +287,6 @@ fn place_location<'tcx>(
     debug_context: &mut DebugContext<'tcx>,
     isa: &dyn TargetIsa,
     symbol: usize,
-    context: &Context,
     local_map: &IndexVec<mir::Local, CPlace<'tcx>>,
     #[allow(rustc::default_hash_types)] value_labels_ranges: &std::collections::HashMap<
         ValueLabel,
@@ -306,12 +309,7 @@ fn place_location<'tcx>(
                                 addend: i64::from(value_loc_range.start),
                             },
                             end: Address::Symbol { symbol, addend: i64::from(value_loc_range.end) },
-                            data: translate_loc(
-                                isa,
-                                value_loc_range.loc,
-                                &context.func.stack_slots,
-                            )
-                            .unwrap(),
+                            data: translate_loc(isa, value_loc_range.loc).unwrap(),
                         })
                         .collect(),
                 );
@@ -340,34 +338,14 @@ fn place_location<'tcx>(
             AttributeValue::Exprloc(Expression::new())
 
             // For PointerBase::Stack:
-            //AttributeValue::Exprloc(translate_loc(ValueLoc::Stack(*stack_slot), &context.func.stack_slots).unwrap())
+            //AttributeValue::Exprloc(translate_loc(ValueLoc::Stack(*stack_slot)).unwrap())
         }
     }
 }
 
 // Adapted from https://github.com/CraneStation/wasmtime/blob/5a1845b4caf7a5dba8eda1fef05213a532ed4259/crates/debug/src/transform/expression.rs#L59-L137
-fn translate_loc(
-    isa: &dyn TargetIsa,
-    loc: LabelValueLoc,
-    stack_slots: &StackSlots,
-) -> Option<Expression> {
+fn translate_loc(isa: &dyn TargetIsa, loc: LabelValueLoc) -> Option<Expression> {
     match loc {
-        LabelValueLoc::ValueLoc(ValueLoc::Reg(reg)) => {
-            let machine_reg = isa.map_dwarf_register(reg).unwrap();
-            let mut expr = Expression::new();
-            expr.op_reg(gimli::Register(machine_reg));
-            Some(expr)
-        }
-        LabelValueLoc::ValueLoc(ValueLoc::Stack(ss)) => {
-            if let Some(ss_offset) = stack_slots[ss].offset {
-                let mut expr = Expression::new();
-                expr.op_breg(X86_64::RBP, i64::from(ss_offset) + 16);
-                Some(expr)
-            } else {
-                None
-            }
-        }
-        LabelValueLoc::ValueLoc(ValueLoc::Unassigned) => unreachable!(),
         LabelValueLoc::Reg(reg) => {
             let machine_reg = isa.map_regalloc_reg_to_dwarf(reg).unwrap();
             let mut expr = Expression::new();
diff --git a/src/lib.rs b/src/lib.rs
index 2ceccdd3499..41ac4602151 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -268,16 +268,14 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Box<dyn isa::Tar
 
     let flags = settings::Flags::new(flags_builder);
 
-    let variant = cranelift_codegen::isa::BackendVariant::MachInst;
-
     let isa_builder = match sess.opts.cg.target_cpu.as_deref() {
         Some("native") => {
-            let builder = cranelift_native::builder_with_options(variant, true).unwrap();
+            let builder = cranelift_native::builder_with_options(true).unwrap();
             builder
         }
         Some(value) => {
             let mut builder =
-                cranelift_codegen::isa::lookup_variant(target_triple.clone(), variant)
+                cranelift_codegen::isa::lookup(target_triple.clone())
                     .unwrap_or_else(|err| {
                         sess.fatal(&format!("can't compile for {}: {}", target_triple, err));
                     });
@@ -288,7 +286,7 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Box<dyn isa::Tar
         }
         None => {
             let mut builder =
-                cranelift_codegen::isa::lookup_variant(target_triple.clone(), variant)
+                cranelift_codegen::isa::lookup(target_triple.clone())
                     .unwrap_or_else(|err| {
                         sess.fatal(&format!("can't compile for {}: {}", target_triple, err));
                     });