parent
047eaf14ba
commit
399cada762
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -63,15 +63,6 @@ name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift"
|
||||
version = "0.52.0"
|
||||
source = "git+https://github.com/bytecodealliance/cranelift/#722a345ff6ee00ade5de87eef0a605711a88e8ec"
|
||||
dependencies = [
|
||||
"cranelift-codegen 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-frontend 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.52.0"
|
||||
@ -408,8 +399,9 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"ar 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-codegen 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-faerie 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-frontend 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-module 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-object 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-simplejit 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
@ -568,7 +560,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||
"checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum cranelift 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-bforest 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-codegen 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-codegen-meta 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
|
@ -13,7 +13,8 @@ backend_object = ["object/write", "cranelift-object"]
|
||||
|
||||
[dependencies]
|
||||
# These have to be in sync with each other
|
||||
cranelift = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
|
||||
cranelift-codegen = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
|
||||
cranelift-frontend = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
|
||||
cranelift-module = { git = "https://github.com/bytecodealliance/cranelift/" }
|
||||
cranelift-faerie = { git = "https://github.com/bytecodealliance/cranelift/" }
|
||||
cranelift-object = { git = "https://github.com/bytecodealliance/cranelift/", optional = true }
|
||||
@ -35,7 +36,8 @@ features = ["compression", "read", "std"] # We don't need WASM support
|
||||
|
||||
# Uncomment to use local checkout of cranelift
|
||||
#[patch."https://github.com/bytecodealliance/cranelift/"]
|
||||
#cranelift = { path = "../cranelift/cranelift-umbrella", default-features = false, features = ["std"] }
|
||||
#cranelift-codegen = { path = "../cranelift/cranelift-codegen", default-features = false, features = ["std"] }
|
||||
#cranelift-frontend = { path = "../cranelift/cranelift-frontend", default-features = false, features = ["std"] }
|
||||
#cranelift-module = { path = "../cranelift/cranelift-module" }
|
||||
#cranelift-simplejit = { path = "../cranelift/cranelift-simplejit" }
|
||||
#cranelift-faerie = { path = "../cranelift/cranelift-faerie" }
|
||||
|
@ -5,6 +5,8 @@ mod returning;
|
||||
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use cranelift_codegen::ir::AbiParam;
|
||||
|
||||
use self::pass_mode::*;
|
||||
use crate::prelude::*;
|
||||
|
||||
|
@ -103,11 +103,11 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
|
||||
|
||||
fn verify_func(tcx: TyCtxt, writer: &crate::pretty_clif::CommentWriter, func: &Function) {
|
||||
let flags = settings::Flags::new(settings::builder());
|
||||
match ::cranelift::codegen::verify_function(&func, &flags) {
|
||||
match ::cranelift_codegen::verify_function(&func, &flags) {
|
||||
Ok(_) => {}
|
||||
Err(err) => {
|
||||
tcx.sess.err(&format!("{:?}", err));
|
||||
let pretty_error = ::cranelift::codegen::print_errors::pretty_verifier_error(
|
||||
let pretty_error = ::cranelift_codegen::print_errors::pretty_verifier_error(
|
||||
&func,
|
||||
None,
|
||||
Some(Box::new(writer)),
|
||||
@ -195,7 +195,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
|
||||
targets,
|
||||
} => {
|
||||
let discr = trans_operand(fx, discr).load_scalar(fx);
|
||||
let mut switch = ::cranelift::frontend::Switch::new();
|
||||
let mut switch = ::cranelift_frontend::Switch::new();
|
||||
for (i, value) in values.iter().enumerate() {
|
||||
let ebb = fx.get_ebb(targets[i]);
|
||||
switch.set_entry(*value as u64, ebb);
|
||||
|
@ -1,7 +1,7 @@
|
||||
use rustc::ty::layout::{Integer, Primitive};
|
||||
use rustc_target::spec::{HasTargetSpec, Target};
|
||||
|
||||
use cranelift::codegen::ir::{InstructionData, Opcode, ValueDef};
|
||||
use cranelift_codegen::ir::{InstructionData, Opcode, ValueDef};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
|
@ -5,7 +5,7 @@ use crate::prelude::*;
|
||||
|
||||
use syntax::source_map::FileName;
|
||||
|
||||
use cranelift::codegen::binemit::CodeOffset;
|
||||
use cranelift_codegen::binemit::CodeOffset;
|
||||
|
||||
use gimli::write::{
|
||||
Address, AttributeValue, FileId, LineProgram, LineString, LineStringTable, UnitEntryId,
|
||||
@ -104,7 +104,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||
pub(crate) fn create_debug_lines(
|
||||
&mut self,
|
||||
context: &Context,
|
||||
isa: &dyn cranelift::codegen::isa::TargetIsa,
|
||||
isa: &dyn cranelift_codegen::isa::TargetIsa,
|
||||
source_info_set: &indexmap::IndexSet<(Span, mir::SourceScope)>,
|
||||
) -> CodeOffset {
|
||||
let tcx = self.debug_context.tcx;
|
||||
|
@ -3,9 +3,9 @@ mod line_info;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
use cranelift::codegen::ir::{StackSlots, ValueLabel, ValueLoc};
|
||||
use cranelift::codegen::isa::RegUnit;
|
||||
use cranelift::codegen::ValueLocRange;
|
||||
use cranelift_codegen::ir::{StackSlots, ValueLabel, ValueLoc};
|
||||
use cranelift_codegen::isa::RegUnit;
|
||||
use cranelift_codegen::ValueLocRange;
|
||||
|
||||
use gimli::write::{
|
||||
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram, LineString, Location,
|
||||
@ -253,7 +253,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
||||
pub fn define(
|
||||
&mut self,
|
||||
context: &Context,
|
||||
isa: &dyn cranelift::codegen::isa::TargetIsa,
|
||||
isa: &dyn cranelift_codegen::isa::TargetIsa,
|
||||
source_info_set: &indexmap::IndexSet<(Span, mir::SourceScope)>,
|
||||
local_map: HashMap<mir::Local, CPlace<'tcx>>,
|
||||
) {
|
||||
@ -312,7 +312,7 @@ fn place_location<'a, 'tcx>(
|
||||
|
||||
match cplace.inner() {
|
||||
CPlaceInner::Var(local) => {
|
||||
let value_label = cranelift::codegen::ir::ValueLabel::from_u32(local.as_u32());
|
||||
let value_label = cranelift_codegen::ir::ValueLabel::from_u32(local.as_u32());
|
||||
if let Some(value_loc_ranges) = value_labels_ranges.get(&value_label) {
|
||||
let loc_list = LocationList(
|
||||
value_loc_ranges
|
||||
|
@ -633,7 +633,7 @@ pub fn codegen_intrinsic_call<'tcx>(
|
||||
}
|
||||
_ => panic!("clif_type returned {}", clif_ty),
|
||||
};
|
||||
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.set_val_label(val, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.def_var(mir_var(var), val);
|
||||
}
|
||||
_ => {
|
||||
@ -670,7 +670,7 @@ pub fn codegen_intrinsic_call<'tcx>(
|
||||
}
|
||||
_ => panic!("clif_type returned {}", clif_ty),
|
||||
};
|
||||
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.set_val_label(val, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.def_var(mir_var(var), val);
|
||||
}
|
||||
CPlaceInner::Addr(_, _) => {
|
||||
|
19
src/lib.rs
19
src/lib.rs
@ -25,7 +25,7 @@ use rustc::ty::query::Providers;
|
||||
use rustc::util::common::ErrorReported;
|
||||
use rustc_codegen_utils::codegen_backend::CodegenBackend;
|
||||
|
||||
use cranelift::codegen::settings;
|
||||
use cranelift_codegen::settings;
|
||||
|
||||
use crate::constant::ConstantCx;
|
||||
use crate::prelude::*;
|
||||
@ -91,12 +91,15 @@ mod prelude {
|
||||
pub use rustc_codegen_ssa::traits::*;
|
||||
pub use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleKind};
|
||||
|
||||
pub use cranelift::codegen::ir::{
|
||||
condcodes::IntCC, function::Function, ExternalName, FuncRef, Inst, SourceLoc, StackSlot,
|
||||
};
|
||||
pub use cranelift::codegen::isa::CallConv;
|
||||
pub use cranelift::codegen::Context;
|
||||
pub use cranelift::prelude::*;
|
||||
pub use cranelift_codegen::Context;
|
||||
pub use cranelift_codegen::ir::{AbiParam, Ebb, ExternalName, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value};
|
||||
pub use cranelift_codegen::ir::condcodes::{FloatCC, IntCC};
|
||||
pub use cranelift_codegen::ir::function::Function;
|
||||
pub use cranelift_codegen::ir::immediates::{Ieee32, Ieee64};
|
||||
pub use cranelift_codegen::ir::types;
|
||||
pub use cranelift_codegen::isa::{self, CallConv};
|
||||
pub use cranelift_codegen::settings::{self, Configurable};
|
||||
pub use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
|
||||
pub use cranelift_module::{
|
||||
self, Backend, DataContext, DataId, FuncId, FuncOrDataId, Linkage, Module,
|
||||
};
|
||||
@ -283,7 +286,7 @@ fn build_isa(sess: &Session, enable_pic: bool) -> Box<dyn isa::TargetIsa + 'stat
|
||||
|
||||
let target_triple = crate::target_triple(sess);
|
||||
let flags = settings::Flags::new(flags_builder);
|
||||
cranelift::codegen::isa::lookup(target_triple)
|
||||
cranelift_codegen::isa::lookup(target_triple)
|
||||
.unwrap()
|
||||
.finish(flags)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
use cranelift::codegen::ir::immediates::Offset32;
|
||||
use cranelift_codegen::ir::immediates::Offset32;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Pointer {
|
||||
|
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
||||
use cranelift::codegen::{
|
||||
use cranelift_codegen::{
|
||||
entity::SecondaryMap,
|
||||
ir::{self, entities::AnyEntity, function::DisplayFunctionAnnotations},
|
||||
write::{FuncWriter, PlainWriter},
|
||||
@ -221,7 +221,7 @@ pub fn write_clif_file<'tcx>(
|
||||
);
|
||||
|
||||
let mut clif = String::new();
|
||||
cranelift::codegen::write::decorate_function(
|
||||
cranelift_codegen::write::decorate_function(
|
||||
&mut clif_comments,
|
||||
&mut clif,
|
||||
&func,
|
||||
@ -255,7 +255,7 @@ impl<'a, 'tcx, B: Backend + 'static> fmt::Debug for FunctionCx<'_, 'tcx, B> {
|
||||
writeln!(f, "{:?}", self.local_map)?;
|
||||
|
||||
let mut clif = String::new();
|
||||
::cranelift::codegen::write::decorate_function(
|
||||
::cranelift_codegen::write::decorate_function(
|
||||
&mut &self.clif_comments,
|
||||
&mut clif,
|
||||
&self.bcx.func,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
use cranelift::codegen::ir::immediates::Offset32;
|
||||
use cranelift_codegen::ir::immediates::Offset32;
|
||||
|
||||
fn codegen_field<'tcx>(
|
||||
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
|
||||
@ -308,7 +308,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
match self.inner {
|
||||
CPlaceInner::Var(var) => {
|
||||
let val = fx.bcx.use_var(mir_var(var));
|
||||
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.set_val_label(val, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
CValue::by_val(val, layout)
|
||||
}
|
||||
CPlaceInner::Addr(ptr, extra) => {
|
||||
@ -415,7 +415,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
let to_ptr = match self.inner {
|
||||
CPlaceInner::Var(var) => {
|
||||
let data = from.load_scalar(fx);
|
||||
fx.bcx.set_val_label(data, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.set_val_label(data, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
|
||||
fx.bcx.def_var(mir_var(var), data);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user