Skip to content

Commit 399cada

Browse files
committed
Directly depend on cranelift_{codegen,frontend}
Fixes #838
1 parent 047eaf1 commit 399cada

File tree

12 files changed

+39
-41
lines changed

12 files changed

+39
-41
lines changed

Cargo.lock

+2-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ backend_object = ["object/write", "cranelift-object"]
1313

1414
[dependencies]
1515
# These have to be in sync with each other
16-
cranelift = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
16+
cranelift-codegen = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
17+
cranelift-frontend = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
1718
cranelift-module = { git = "https://github.com/bytecodealliance/cranelift/" }
1819
cranelift-faerie = { git = "https://github.com/bytecodealliance/cranelift/" }
1920
cranelift-object = { git = "https://github.com/bytecodealliance/cranelift/", optional = true }
@@ -35,7 +36,8 @@ features = ["compression", "read", "std"] # We don't need WASM support
3536

3637
# Uncomment to use local checkout of cranelift
3738
#[patch."https://github.com/bytecodealliance/cranelift/"]
38-
#cranelift = { path = "../cranelift/cranelift-umbrella", default-features = false, features = ["std"] }
39+
#cranelift-codegen = { path = "../cranelift/cranelift-codegen", default-features = false, features = ["std"] }
40+
#cranelift-frontend = { path = "../cranelift/cranelift-frontend", default-features = false, features = ["std"] }
3941
#cranelift-module = { path = "../cranelift/cranelift-module" }
4042
#cranelift-simplejit = { path = "../cranelift/cranelift-simplejit" }
4143
#cranelift-faerie = { path = "../cranelift/cranelift-faerie" }

src/abi/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ mod returning;
55

66
use rustc_target::spec::abi::Abi;
77

8+
use cranelift_codegen::ir::AbiParam;
9+
810
use self::pass_mode::*;
911
use crate::prelude::*;
1012

src/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
103103

104104
fn verify_func(tcx: TyCtxt, writer: &crate::pretty_clif::CommentWriter, func: &Function) {
105105
let flags = settings::Flags::new(settings::builder());
106-
match ::cranelift::codegen::verify_function(&func, &flags) {
106+
match ::cranelift_codegen::verify_function(&func, &flags) {
107107
Ok(_) => {}
108108
Err(err) => {
109109
tcx.sess.err(&format!("{:?}", err));
110-
let pretty_error = ::cranelift::codegen::print_errors::pretty_verifier_error(
110+
let pretty_error = ::cranelift_codegen::print_errors::pretty_verifier_error(
111111
&func,
112112
None,
113113
Some(Box::new(writer)),
@@ -195,7 +195,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
195195
targets,
196196
} => {
197197
let discr = trans_operand(fx, discr).load_scalar(fx);
198-
let mut switch = ::cranelift::frontend::Switch::new();
198+
let mut switch = ::cranelift_frontend::Switch::new();
199199
for (i, value) in values.iter().enumerate() {
200200
let ebb = fx.get_ebb(targets[i]);
201201
switch.set_entry(*value as u64, ebb);

src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::ty::layout::{Integer, Primitive};
22
use rustc_target::spec::{HasTargetSpec, Target};
33

4-
use cranelift::codegen::ir::{InstructionData, Opcode, ValueDef};
4+
use cranelift_codegen::ir::{InstructionData, Opcode, ValueDef};
55

66
use crate::prelude::*;
77

src/debuginfo/line_info.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::prelude::*;
55

66
use syntax::source_map::FileName;
77

8-
use cranelift::codegen::binemit::CodeOffset;
8+
use cranelift_codegen::binemit::CodeOffset;
99

1010
use gimli::write::{
1111
Address, AttributeValue, FileId, LineProgram, LineString, LineStringTable, UnitEntryId,
@@ -104,7 +104,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
104104
pub(crate) fn create_debug_lines(
105105
&mut self,
106106
context: &Context,
107-
isa: &dyn cranelift::codegen::isa::TargetIsa,
107+
isa: &dyn cranelift_codegen::isa::TargetIsa,
108108
source_info_set: &indexmap::IndexSet<(Span, mir::SourceScope)>,
109109
) -> CodeOffset {
110110
let tcx = self.debug_context.tcx;

src/debuginfo/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ mod line_info;
33

44
use crate::prelude::*;
55

6-
use cranelift::codegen::ir::{StackSlots, ValueLabel, ValueLoc};
7-
use cranelift::codegen::isa::RegUnit;
8-
use cranelift::codegen::ValueLocRange;
6+
use cranelift_codegen::ir::{StackSlots, ValueLabel, ValueLoc};
7+
use cranelift_codegen::isa::RegUnit;
8+
use cranelift_codegen::ValueLocRange;
99

1010
use gimli::write::{
1111
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram, LineString, Location,
@@ -253,7 +253,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
253253
pub fn define(
254254
&mut self,
255255
context: &Context,
256-
isa: &dyn cranelift::codegen::isa::TargetIsa,
256+
isa: &dyn cranelift_codegen::isa::TargetIsa,
257257
source_info_set: &indexmap::IndexSet<(Span, mir::SourceScope)>,
258258
local_map: HashMap<mir::Local, CPlace<'tcx>>,
259259
) {
@@ -312,7 +312,7 @@ fn place_location<'a, 'tcx>(
312312

313313
match cplace.inner() {
314314
CPlaceInner::Var(local) => {
315-
let value_label = cranelift::codegen::ir::ValueLabel::from_u32(local.as_u32());
315+
let value_label = cranelift_codegen::ir::ValueLabel::from_u32(local.as_u32());
316316
if let Some(value_loc_ranges) = value_labels_ranges.get(&value_label) {
317317
let loc_list = LocationList(
318318
value_loc_ranges

src/intrinsics/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ pub fn codegen_intrinsic_call<'tcx>(
633633
}
634634
_ => panic!("clif_type returned {}", clif_ty),
635635
};
636-
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
636+
fx.bcx.set_val_label(val, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
637637
fx.bcx.def_var(mir_var(var), val);
638638
}
639639
_ => {
@@ -670,7 +670,7 @@ pub fn codegen_intrinsic_call<'tcx>(
670670
}
671671
_ => panic!("clif_type returned {}", clif_ty),
672672
};
673-
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
673+
fx.bcx.set_val_label(val, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
674674
fx.bcx.def_var(mir_var(var), val);
675675
}
676676
CPlaceInner::Addr(_, _) => {

src/lib.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc::ty::query::Providers;
2525
use rustc::util::common::ErrorReported;
2626
use rustc_codegen_utils::codegen_backend::CodegenBackend;
2727

28-
use cranelift::codegen::settings;
28+
use cranelift_codegen::settings;
2929

3030
use crate::constant::ConstantCx;
3131
use crate::prelude::*;
@@ -91,12 +91,15 @@ mod prelude {
9191
pub use rustc_codegen_ssa::traits::*;
9292
pub use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleKind};
9393

94-
pub use cranelift::codegen::ir::{
95-
condcodes::IntCC, function::Function, ExternalName, FuncRef, Inst, SourceLoc, StackSlot,
96-
};
97-
pub use cranelift::codegen::isa::CallConv;
98-
pub use cranelift::codegen::Context;
99-
pub use cranelift::prelude::*;
94+
pub use cranelift_codegen::Context;
95+
pub use cranelift_codegen::ir::{AbiParam, Ebb, ExternalName, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value};
96+
pub use cranelift_codegen::ir::condcodes::{FloatCC, IntCC};
97+
pub use cranelift_codegen::ir::function::Function;
98+
pub use cranelift_codegen::ir::immediates::{Ieee32, Ieee64};
99+
pub use cranelift_codegen::ir::types;
100+
pub use cranelift_codegen::isa::{self, CallConv};
101+
pub use cranelift_codegen::settings::{self, Configurable};
102+
pub use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
100103
pub use cranelift_module::{
101104
self, Backend, DataContext, DataId, FuncId, FuncOrDataId, Linkage, Module,
102105
};
@@ -283,7 +286,7 @@ fn build_isa(sess: &Session, enable_pic: bool) -> Box<dyn isa::TargetIsa + 'stat
283286

284287
let target_triple = crate::target_triple(sess);
285288
let flags = settings::Flags::new(flags_builder);
286-
cranelift::codegen::isa::lookup(target_triple)
289+
cranelift_codegen::isa::lookup(target_triple)
287290
.unwrap()
288291
.finish(flags)
289292
}

src/pointer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::prelude::*;
22

3-
use cranelift::codegen::ir::immediates::Offset32;
3+
use cranelift_codegen::ir::immediates::Offset32;
44

55
#[derive(Copy, Clone, Debug)]
66
pub struct Pointer {

src/pretty_clif.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::borrow::Cow;
22
use std::collections::HashMap;
33
use std::fmt;
44

5-
use cranelift::codegen::{
5+
use cranelift_codegen::{
66
entity::SecondaryMap,
77
ir::{self, entities::AnyEntity, function::DisplayFunctionAnnotations},
88
write::{FuncWriter, PlainWriter},
@@ -221,7 +221,7 @@ pub fn write_clif_file<'tcx>(
221221
);
222222

223223
let mut clif = String::new();
224-
cranelift::codegen::write::decorate_function(
224+
cranelift_codegen::write::decorate_function(
225225
&mut clif_comments,
226226
&mut clif,
227227
&func,
@@ -255,7 +255,7 @@ impl<'a, 'tcx, B: Backend + 'static> fmt::Debug for FunctionCx<'_, 'tcx, B> {
255255
writeln!(f, "{:?}", self.local_map)?;
256256

257257
let mut clif = String::new();
258-
::cranelift::codegen::write::decorate_function(
258+
::cranelift_codegen::write::decorate_function(
259259
&mut &self.clif_comments,
260260
&mut clif,
261261
&self.bcx.func,

src/value_and_place.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::prelude::*;
22

3-
use cranelift::codegen::ir::immediates::Offset32;
3+
use cranelift_codegen::ir::immediates::Offset32;
44

55
fn codegen_field<'tcx>(
66
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
@@ -308,7 +308,7 @@ impl<'tcx> CPlace<'tcx> {
308308
match self.inner {
309309
CPlaceInner::Var(var) => {
310310
let val = fx.bcx.use_var(mir_var(var));
311-
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
311+
fx.bcx.set_val_label(val, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
312312
CValue::by_val(val, layout)
313313
}
314314
CPlaceInner::Addr(ptr, extra) => {
@@ -415,7 +415,7 @@ impl<'tcx> CPlace<'tcx> {
415415
let to_ptr = match self.inner {
416416
CPlaceInner::Var(var) => {
417417
let data = from.load_scalar(fx);
418-
fx.bcx.set_val_label(data, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
418+
fx.bcx.set_val_label(data, cranelift_codegen::ir::ValueLabel::from_u32(var.as_u32()));
419419
fx.bcx.def_var(mir_var(var), data);
420420
return;
421421
}

0 commit comments

Comments
 (0)