parent
047eaf14ba
commit
399cada762
12 changed files with 39 additions and 41 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue