diff --git a/cranelift/bforest/src/map.rs b/cranelift/bforest/src/map.rs index 931253cae5..fb7d4d9ddf 100644 --- a/cranelift/bforest/src/map.rs +++ b/cranelift/bforest/src/map.rs @@ -429,8 +429,8 @@ where mod tests { use super::super::NodeData; use super::*; - use core::mem; use alloc::vec::Vec; + use core::mem; #[test] fn node_size() { diff --git a/cranelift/bforest/src/node.rs b/cranelift/bforest/src/node.rs index 260494b171..589bc2b5e0 100644 --- a/cranelift/bforest/src/node.rs +++ b/cranelift/bforest/src/node.rs @@ -584,8 +584,8 @@ where #[cfg(test)] mod tests { use super::*; - use core::mem; use alloc::string::ToString; + use core::mem; // Forest impl for a set implementation. struct TF(); diff --git a/cranelift/bforest/src/pool.rs b/cranelift/bforest/src/pool.rs index 6b4bae020d..e4744d2bcb 100644 --- a/cranelift/bforest/src/pool.rs +++ b/cranelift/bforest/src/pool.rs @@ -84,9 +84,9 @@ impl NodePool { F::Key: fmt::Display, { use crate::entity::EntitySet; + use alloc::vec::Vec; use core::borrow::Borrow; use core::cmp::Ordering; - use alloc::vec::Vec; // The root node can't be an inner node with just a single sub-tree. It should have been // pruned. diff --git a/cranelift/bforest/src/set.rs b/cranelift/bforest/src/set.rs index d22cb8285e..e7761a63d9 100644 --- a/cranelift/bforest/src/set.rs +++ b/cranelift/bforest/src/set.rs @@ -3,10 +3,10 @@ use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE}; use crate::packed_option::PackedOption; #[cfg(test)] +use alloc::string::String; +#[cfg(test)] use core::fmt; use core::marker::PhantomData; -#[cfg(test)] -use alloc::string::String; /// Tag type defining forest types for a set. struct SetTypes(PhantomData); @@ -357,8 +357,8 @@ where mod tests { use super::super::NodeData; use super::*; - use core::mem; use alloc::vec::Vec; + use core::mem; #[test] fn node_size() { diff --git a/cranelift/codegen/src/abi.rs b/cranelift/codegen/src/abi.rs index 8564fd5a24..e63f21b8d3 100644 --- a/cranelift/codegen/src/abi.rs +++ b/cranelift/codegen/src/abi.rs @@ -4,8 +4,8 @@ //! `TargetIsa::legalize_signature()` method. use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type}; -use core::cmp::Ordering; use alloc::vec::Vec; +use core::cmp::Ordering; /// Legalization action to perform on a single argument or return value when converting a /// signature. diff --git a/cranelift/codegen/src/cfg_printer.rs b/cranelift/codegen/src/cfg_printer.rs index c67e8b1eec..ed47475295 100644 --- a/cranelift/codegen/src/cfg_printer.rs +++ b/cranelift/codegen/src/cfg_printer.rs @@ -1,7 +1,7 @@ //! The `CFGPrinter` utility. -use core::fmt::{Display, Formatter, Result, Write}; use alloc::vec::Vec; +use core::fmt::{Display, Formatter, Result, Write}; use crate::entity::SecondaryMap; use crate::flowgraph::{BasicBlock, ControlFlowGraph}; diff --git a/cranelift/codegen/src/context.rs b/cranelift/codegen/src/context.rs index aad08a5481..ccf216d214 100644 --- a/cranelift/codegen/src/context.rs +++ b/cranelift/codegen/src/context.rs @@ -33,8 +33,8 @@ use crate::timing; use crate::unreachable_code::eliminate_unreachable_code; use crate::value_label::{build_value_labels_ranges, ComparableSourceLoc, ValueLabelsRanges}; use crate::verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult}; -use log::debug; use alloc::vec::Vec; +use log::debug; /// Persistent data structures and compilation pipeline. pub struct Context { diff --git a/cranelift/codegen/src/dominator_tree.rs b/cranelift/codegen/src/dominator_tree.rs index 737019d315..67446b21f6 100644 --- a/cranelift/codegen/src/dominator_tree.rs +++ b/cranelift/codegen/src/dominator_tree.rs @@ -6,10 +6,10 @@ use crate::ir::instructions::BranchInfo; use crate::ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value}; use crate::packed_option::PackedOption; use crate::timing; +use alloc::vec::Vec; use core::cmp; use core::cmp::Ordering; use core::mem; -use alloc::vec::Vec; /// RPO numbers are not first assigned in a contiguous way but as multiples of STRIDE, to leave /// room for modifications of the dominator tree. diff --git a/cranelift/codegen/src/ir/constant.rs b/cranelift/codegen/src/ir/constant.rs index c4d7cb0898..ff30d67734 100644 --- a/cranelift/codegen/src/ir/constant.rs +++ b/cranelift/codegen/src/ir/constant.rs @@ -10,9 +10,9 @@ use crate::ir::Constant; use crate::HashMap; -use cranelift_entity::EntityRef; use alloc::collections::BTreeMap; use alloc::vec::Vec; +use cranelift_entity::EntityRef; /// This type describes the actual constant data. pub type ConstantData = Vec; diff --git a/cranelift/codegen/src/ir/dfg.rs b/cranelift/codegen/src/ir/dfg.rs index 34ed10622d..0ff6a263c4 100644 --- a/cranelift/codegen/src/ir/dfg.rs +++ b/cranelift/codegen/src/ir/dfg.rs @@ -14,12 +14,12 @@ use crate::isa::TargetIsa; use crate::packed_option::ReservedValue; use crate::write::write_operands; use crate::HashMap; +use alloc::vec::Vec; use core::fmt; use core::iter; use core::mem; use core::ops::{Index, IndexMut}; use core::u16; -use alloc::vec::Vec; /// A data flow graph defines all instructions and extended basic blocks in a function as well as /// the data flow dependencies between them. The DFG also tracks values which can be either diff --git a/cranelift/codegen/src/ir/entities.rs b/cranelift/codegen/src/ir/entities.rs index 552a9f3ae0..1883fea258 100644 --- a/cranelift/codegen/src/ir/entities.rs +++ b/cranelift/codegen/src/ir/entities.rs @@ -455,8 +455,8 @@ impl From for AnyEntity { #[cfg(test)] mod tests { use super::*; - use core::u32; use alloc::string::ToString; + use core::u32; #[test] fn value_with_number() { diff --git a/cranelift/codegen/src/ir/extfunc.rs b/cranelift/codegen/src/ir/extfunc.rs index f09b428833..112fb31b7b 100644 --- a/cranelift/codegen/src/ir/extfunc.rs +++ b/cranelift/codegen/src/ir/extfunc.rs @@ -7,9 +7,9 @@ use crate::ir::{ArgumentLoc, ExternalName, SigRef, Type}; use crate::isa::{CallConv, RegInfo, RegUnit}; +use alloc::vec::Vec; use core::fmt; use core::str::FromStr; -use alloc::vec::Vec; /// Function signature. /// diff --git a/cranelift/codegen/src/ir/extname.rs b/cranelift/codegen/src/ir/extname.rs index d153db9cbd..3a47699acc 100644 --- a/cranelift/codegen/src/ir/extname.rs +++ b/cranelift/codegen/src/ir/extname.rs @@ -120,8 +120,8 @@ impl FromStr for ExternalName { mod tests { use super::ExternalName; use crate::ir::LibCall; - use core::u32; use alloc::string::ToString; + use core::u32; #[test] fn display_testcase() { diff --git a/cranelift/codegen/src/ir/immediates.rs b/cranelift/codegen/src/ir/immediates.rs index 5d3807671f..27320328fe 100644 --- a/cranelift/codegen/src/ir/immediates.rs +++ b/cranelift/codegen/src/ir/immediates.rs @@ -4,11 +4,11 @@ //! Each type here should have a corresponding definition in the //! `cranelift-codegen/meta/src/shared/immediates` crate in the meta language. +use alloc::vec::Vec; use core::fmt::{self, Display, Formatter}; use core::iter::FromIterator; use core::str::{from_utf8, FromStr}; use core::{i32, u32}; -use alloc::vec::Vec; /// Convert a type into a vector of bytes; all implementors in this file must use little-endian /// orderings of bytes to match WebAssembly's little-endianness. @@ -936,11 +936,11 @@ impl IntoBytes for Ieee64 { #[cfg(test)] mod tests { use super::*; + use alloc::string::ToString; use core::fmt::Display; use core::mem; use core::str::FromStr; use core::{f32, f64}; - use alloc::string::ToString; #[test] fn format_imm64() { diff --git a/cranelift/codegen/src/ir/instructions.rs b/cranelift/codegen/src/ir/instructions.rs index 97c84110aa..7eb504483f 100644 --- a/cranelift/codegen/src/ir/instructions.rs +++ b/cranelift/codegen/src/ir/instructions.rs @@ -6,10 +6,10 @@ //! A large part of this module is auto-generated from the instruction descriptions in the meta //! directory. +use alloc::vec::Vec; use core::fmt::{self, Display, Formatter}; use core::ops::{Deref, DerefMut}; use core::str::FromStr; -use alloc::vec::Vec; use crate::ir; use crate::ir::types; diff --git a/cranelift/codegen/src/ir/jumptable.rs b/cranelift/codegen/src/ir/jumptable.rs index 596e668e89..b412e807ac 100644 --- a/cranelift/codegen/src/ir/jumptable.rs +++ b/cranelift/codegen/src/ir/jumptable.rs @@ -4,9 +4,9 @@ //! The actual table of destinations is stored in a `JumpTableData` struct defined in this module. use crate::ir::entities::Ebb; +use alloc::vec::Vec; use core::fmt::{self, Display, Formatter}; use core::slice::{Iter, IterMut}; -use alloc::vec::Vec; /// Contents of a jump table. /// diff --git a/cranelift/codegen/src/ir/layout.rs b/cranelift/codegen/src/ir/layout.rs index 3d1f5e975c..7b624a92d2 100644 --- a/cranelift/codegen/src/ir/layout.rs +++ b/cranelift/codegen/src/ir/layout.rs @@ -750,8 +750,8 @@ mod tests { use crate::cursor::{Cursor, CursorPosition}; use crate::entity::EntityRef; use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc}; - use core::cmp::Ordering; use alloc::vec::Vec; + use core::cmp::Ordering; struct LayoutCursor<'f> { /// Borrowed function layout. Public so it can be re-borrowed from this cursor. diff --git a/cranelift/codegen/src/ir/stackslot.rs b/cranelift/codegen/src/ir/stackslot.rs index fb526ab50e..00dee43af4 100644 --- a/cranelift/codegen/src/ir/stackslot.rs +++ b/cranelift/codegen/src/ir/stackslot.rs @@ -6,12 +6,12 @@ use crate::entity::{Iter, IterMut, Keys, PrimaryMap}; use crate::ir::{StackSlot, Type}; use crate::packed_option::PackedOption; +use alloc::vec::Vec; use core::cmp; use core::fmt; use core::ops::{Index, IndexMut}; use core::slice; use core::str::FromStr; -use alloc::vec::Vec; #[cfg(feature = "enable-serde")] use serde::{Deserialize, Serialize}; diff --git a/cranelift/codegen/src/isa/arm32/mod.rs b/cranelift/codegen/src/isa/arm32/mod.rs index f377560581..6c00ef9089 100644 --- a/cranelift/codegen/src/isa/arm32/mod.rs +++ b/cranelift/codegen/src/isa/arm32/mod.rs @@ -15,8 +15,8 @@ use crate::isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encoding use crate::isa::Builder as IsaBuilder; use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::regalloc; -use core::fmt; use alloc::boxed::Box; +use core::fmt; use target_lexicon::{Architecture, Triple}; #[allow(dead_code)] diff --git a/cranelift/codegen/src/isa/arm64/mod.rs b/cranelift/codegen/src/isa/arm64/mod.rs index 84afc33cbd..26c28329bc 100644 --- a/cranelift/codegen/src/isa/arm64/mod.rs +++ b/cranelift/codegen/src/isa/arm64/mod.rs @@ -15,8 +15,8 @@ use crate::isa::enc_tables::{lookup_enclist, Encodings}; use crate::isa::Builder as IsaBuilder; use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::regalloc; -use core::fmt; use alloc::boxed::Box; +use core::fmt; use target_lexicon::Triple; #[allow(dead_code)] diff --git a/cranelift/codegen/src/isa/mod.rs b/cranelift/codegen/src/isa/mod.rs index fd118f1286..067dff318f 100644 --- a/cranelift/codegen/src/isa/mod.rs +++ b/cranelift/codegen/src/isa/mod.rs @@ -63,9 +63,9 @@ use crate::result::CodegenResult; use crate::settings; use crate::settings::SetResult; use crate::timing; +use alloc::boxed::Box; use core::fmt; use failure_derive::Fail; -use alloc::boxed::Box; use target_lexicon::{triple, Architecture, PointerWidth, Triple}; #[cfg(feature = "riscv")] diff --git a/cranelift/codegen/src/isa/riscv/mod.rs b/cranelift/codegen/src/isa/riscv/mod.rs index e4bd6c9bbd..79aaeaddf9 100644 --- a/cranelift/codegen/src/isa/riscv/mod.rs +++ b/cranelift/codegen/src/isa/riscv/mod.rs @@ -15,8 +15,8 @@ use crate::isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encoding use crate::isa::Builder as IsaBuilder; use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::regalloc; -use core::fmt; use alloc::boxed::Box; +use core::fmt; use target_lexicon::{PointerWidth, Triple}; #[allow(dead_code)] @@ -137,8 +137,8 @@ mod tests { use crate::ir::{Function, InstructionData, Opcode}; use crate::isa; use crate::settings::{self, Configurable}; - use core::str::FromStr; use alloc::string::{String, ToString}; + use core::str::FromStr; use target_lexicon::triple; fn encstr(isa: &dyn isa::TargetIsa, enc: Result) -> String { diff --git a/cranelift/codegen/src/isa/x86/mod.rs b/cranelift/codegen/src/isa/x86/mod.rs index 35ca485bd8..19cc41c99d 100644 --- a/cranelift/codegen/src/isa/x86/mod.rs +++ b/cranelift/codegen/src/isa/x86/mod.rs @@ -17,8 +17,8 @@ use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::regalloc; use crate::result::CodegenResult; use crate::timing; -use core::fmt; use alloc::boxed::Box; +use core::fmt; use target_lexicon::{PointerWidth, Triple}; #[allow(dead_code)] diff --git a/cranelift/codegen/src/legalizer/boundary.rs b/cranelift/codegen/src/legalizer/boundary.rs index d95d6d4239..479208751f 100644 --- a/cranelift/codegen/src/legalizer/boundary.rs +++ b/cranelift/codegen/src/legalizer/boundary.rs @@ -27,8 +27,8 @@ use crate::ir::{ }; use crate::isa::TargetIsa; use crate::legalizer::split::{isplit, vsplit}; -use log::debug; use alloc::vec::Vec; +use log::debug; /// Legalize all the function signatures in `func`. /// diff --git a/cranelift/codegen/src/legalizer/split.rs b/cranelift/codegen/src/legalizer/split.rs index c844fba214..a3fa29f267 100644 --- a/cranelift/codegen/src/legalizer/split.rs +++ b/cranelift/codegen/src/legalizer/split.rs @@ -67,9 +67,9 @@ use crate::cursor::{Cursor, CursorPosition, FuncCursor}; use crate::flowgraph::{BasicBlock, ControlFlowGraph}; use crate::ir::{self, Ebb, Inst, InstBuilder, InstructionData, Opcode, Type, Value, ValueDef}; +use alloc::vec::Vec; use core::iter; use smallvec::SmallVec; -use alloc::vec::Vec; /// Split `value` into two values using the `isplit` semantics. Do this by reusing existing values /// if possible. diff --git a/cranelift/codegen/src/print_errors.rs b/cranelift/codegen/src/print_errors.rs index 52169a3880..78ae325630 100644 --- a/cranelift/codegen/src/print_errors.rs +++ b/cranelift/codegen/src/print_errors.rs @@ -8,11 +8,11 @@ use crate::isa::TargetIsa; use crate::result::CodegenError; use crate::verifier::{VerifierError, VerifierErrors}; use crate::write::{decorate_function, FuncWriter, PlainWriter}; -use core::fmt; -use core::fmt::Write; use alloc::boxed::Box; use alloc::string::{String, ToString}; use alloc::vec::Vec; +use core::fmt; +use core::fmt::Write; /// Pretty-print a verifier error. pub fn pretty_verifier_error<'a>( diff --git a/cranelift/codegen/src/redundant_reload_remover.rs b/cranelift/codegen/src/redundant_reload_remover.rs index a0b6764454..11f13f5256 100644 --- a/cranelift/codegen/src/redundant_reload_remover.rs +++ b/cranelift/codegen/src/redundant_reload_remover.rs @@ -12,9 +12,9 @@ use crate::ir::{ }; use crate::isa::{RegInfo, RegUnit, TargetIsa}; use crate::regalloc::RegDiversions; +use alloc::vec::Vec; use core::convert::TryInto; use cranelift_entity::{PrimaryMap, SecondaryMap}; -use alloc::vec::Vec; // ============================================================================================= // A description of the redundant-fill-removal algorithm diff --git a/cranelift/codegen/src/regalloc/coalescing.rs b/cranelift/codegen/src/regalloc/coalescing.rs index 11846ff45b..c408b912fa 100644 --- a/cranelift/codegen/src/regalloc/coalescing.rs +++ b/cranelift/codegen/src/regalloc/coalescing.rs @@ -17,12 +17,12 @@ use crate::regalloc::affinity::Affinity; use crate::regalloc::liveness::Liveness; use crate::regalloc::virtregs::{VirtReg, VirtRegs}; use crate::timing; +use alloc::vec::Vec; use core::cmp; use core::fmt; use core::iter; use core::slice; use log::debug; -use alloc::vec::Vec; // # Implementation // diff --git a/cranelift/codegen/src/regalloc/liveness.rs b/cranelift/codegen/src/regalloc/liveness.rs index ba7ce60459..1b9784a198 100644 --- a/cranelift/codegen/src/regalloc/liveness.rs +++ b/cranelift/codegen/src/regalloc/liveness.rs @@ -183,9 +183,9 @@ use crate::isa::{EncInfo, OperandConstraint, TargetIsa}; use crate::regalloc::affinity::Affinity; use crate::regalloc::liverange::LiveRange; use crate::timing; +use alloc::vec::Vec; use core::mem; use core::ops::Index; -use alloc::vec::Vec; /// A set of live ranges, indexed by value number. type LiveRangeSet = SparseMap; diff --git a/cranelift/codegen/src/regalloc/liverange.rs b/cranelift/codegen/src/regalloc/liverange.rs index 5ababa53b4..266c4ca09e 100644 --- a/cranelift/codegen/src/regalloc/liverange.rs +++ b/cranelift/codegen/src/regalloc/liverange.rs @@ -476,8 +476,8 @@ mod tests { use crate::entity::EntityRef; use crate::ir::{Ebb, Inst, Value}; use crate::ir::{ExpandedProgramPoint, ProgramOrder}; - use core::cmp::Ordering; use alloc::vec::Vec; + use core::cmp::Ordering; // Dummy program order which simply compares indexes. // It is assumed that EBBs have indexes that are multiples of 10, and instructions have indexes diff --git a/cranelift/codegen/src/regalloc/pressure.rs b/cranelift/codegen/src/regalloc/pressure.rs index 2cac3bd804..c7fc1fff9a 100644 --- a/cranelift/codegen/src/regalloc/pressure.rs +++ b/cranelift/codegen/src/regalloc/pressure.rs @@ -275,9 +275,9 @@ mod tests { use super::Pressure; use crate::isa::{RegClass, TargetIsa}; use crate::regalloc::RegisterSet; + use alloc::boxed::Box; use core::borrow::Borrow; use core::str::FromStr; - use alloc::boxed::Box; use target_lexicon::triple; // Make an arm32 `TargetIsa`, if possible. diff --git a/cranelift/codegen/src/regalloc/reload.rs b/cranelift/codegen/src/regalloc/reload.rs index ed04e4fc64..0f4f595346 100644 --- a/cranelift/codegen/src/regalloc/reload.rs +++ b/cranelift/codegen/src/regalloc/reload.rs @@ -21,8 +21,8 @@ use crate::regalloc::live_value_tracker::{LiveValue, LiveValueTracker}; use crate::regalloc::liveness::Liveness; use crate::timing; use crate::topo_order::TopoOrder; -use log::debug; use alloc::vec::Vec; +use log::debug; /// Reusable data structures for the reload pass. pub struct Reload { diff --git a/cranelift/codegen/src/regalloc/solver.rs b/cranelift/codegen/src/regalloc/solver.rs index 8d651f143c..5b63b2825a 100644 --- a/cranelift/codegen/src/regalloc/solver.rs +++ b/cranelift/codegen/src/regalloc/solver.rs @@ -104,12 +104,12 @@ use crate::entity::{SparseMap, SparseMapValue}; use crate::ir::Value; use crate::isa::{RegClass, RegUnit}; use crate::regalloc::register_set::RegSetIter; +use alloc::vec::Vec; use core::cmp; use core::fmt; use core::mem; use core::u16; use log::debug; -use alloc::vec::Vec; /// A variable in the constraint problem. /// @@ -1159,8 +1159,8 @@ mod tests { use crate::ir::Value; use crate::isa::{RegClass, RegInfo, RegUnit, TargetIsa}; use crate::regalloc::RegisterSet; - use core::str::FromStr; use alloc::boxed::Box; + use core::str::FromStr; use target_lexicon::triple; // Make an arm32 `TargetIsa`, if possible. diff --git a/cranelift/codegen/src/regalloc/spilling.rs b/cranelift/codegen/src/regalloc/spilling.rs index 3b42bcb5e5..e7127b9606 100644 --- a/cranelift/codegen/src/regalloc/spilling.rs +++ b/cranelift/codegen/src/regalloc/spilling.rs @@ -27,9 +27,9 @@ use crate::regalloc::pressure::Pressure; use crate::regalloc::virtregs::VirtRegs; use crate::timing; use crate::topo_order::TopoOrder; +use alloc::vec::Vec; use core::fmt; use log::debug; -use alloc::vec::Vec; /// Return a top-level register class which contains `unit`. fn toprc_containing_regunit(unit: RegUnit, reginfo: &RegInfo) -> RegClass { diff --git a/cranelift/codegen/src/regalloc/virtregs.rs b/cranelift/codegen/src/regalloc/virtregs.rs index e3944b3cc2..628c49c286 100644 --- a/cranelift/codegen/src/regalloc/virtregs.rs +++ b/cranelift/codegen/src/regalloc/virtregs.rs @@ -18,11 +18,11 @@ use crate::entity::{EntityList, ListPool}; use crate::entity::{Keys, PrimaryMap, SecondaryMap}; use crate::ir::{Function, Value}; use crate::packed_option::PackedOption; +use alloc::vec::Vec; use core::cmp::Ordering; use core::fmt; use core::slice; use smallvec::SmallVec; -use alloc::vec::Vec; /// A virtual register reference. #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] diff --git a/cranelift/codegen/src/settings.rs b/cranelift/codegen/src/settings.rs index 99e1562cc5..44fafd0b64 100644 --- a/cranelift/codegen/src/settings.rs +++ b/cranelift/codegen/src/settings.rs @@ -22,11 +22,11 @@ use crate::constant_hash::{probe, simple_hash}; use crate::isa::TargetIsa; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; use core::fmt; use core::str; use failure_derive::Fail; -use alloc::boxed::Box; -use alloc::string::{String, ToString}; /// A string-based configurator for settings groups. /// diff --git a/cranelift/codegen/src/simple_gvn.rs b/cranelift/codegen/src/simple_gvn.rs index f88f6f7a5c..2130634c47 100644 --- a/cranelift/codegen/src/simple_gvn.rs +++ b/cranelift/codegen/src/simple_gvn.rs @@ -5,9 +5,9 @@ use crate::dominator_tree::DominatorTree; use crate::ir::{Function, Inst, InstructionData, Opcode, Type}; use crate::scoped_hash_map::ScopedHashMap; use crate::timing; +use alloc::vec::Vec; use core::cell::{Ref, RefCell}; use core::hash::{Hash, Hasher}; -use alloc::vec::Vec; /// Test whether the given opcode is unsafe to even consider for GVN. fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool { diff --git a/cranelift/codegen/src/value_label.rs b/cranelift/codegen/src/value_label.rs index e11df7b9e8..b597fdd585 100644 --- a/cranelift/codegen/src/value_label.rs +++ b/cranelift/codegen/src/value_label.rs @@ -2,12 +2,12 @@ use crate::ir::{Function, SourceLoc, Value, ValueLabel, ValueLabelAssignments, V use crate::isa::TargetIsa; use crate::regalloc::{Context, RegDiversions}; use crate::HashMap; +use alloc::collections::BTreeMap; +use alloc::vec::Vec; use core::cmp::Ordering; use core::iter::Iterator; use core::ops::Bound::*; use core::ops::Deref; -use alloc::collections::BTreeMap; -use alloc::vec::Vec; #[cfg(feature = "enable-serde")] use serde::{Deserialize, Serialize}; diff --git a/cranelift/codegen/src/verifier/mod.rs b/cranelift/codegen/src/verifier/mod.rs index fe9f1b10de..7fc33dfd67 100644 --- a/cranelift/codegen/src/verifier/mod.rs +++ b/cranelift/codegen/src/verifier/mod.rs @@ -72,12 +72,12 @@ use crate::isa::TargetIsa; use crate::iterators::IteratorExtras; use crate::settings::FlagsOrIsa; use crate::timing; -use core::cmp::Ordering; -use core::fmt::{self, Display, Formatter, Write}; -use failure_derive::Fail; use alloc::collections::BTreeSet; use alloc::string::String; use alloc::vec::Vec; +use core::cmp::Ordering; +use core::fmt::{self, Display, Formatter, Write}; +use failure_derive::Fail; pub use self::cssa::verify_cssa; pub use self::liveness::verify_liveness; diff --git a/cranelift/codegen/src/write.rs b/cranelift/codegen/src/write.rs index bc4e4ca58c..ae093f3919 100644 --- a/cranelift/codegen/src/write.rs +++ b/cranelift/codegen/src/write.rs @@ -14,9 +14,9 @@ use crate::isa::{RegInfo, TargetIsa}; use crate::packed_option::ReservedValue; use crate::value_label::ValueLabelsRanges; use crate::HashSet; -use core::fmt::{self, Write}; use alloc::string::String; use alloc::vec::Vec; +use core::fmt::{self, Write}; /// A `FuncWriter` used to decorate functions during printing. pub trait FuncWriter { diff --git a/cranelift/entity/src/boxed_slice.rs b/cranelift/entity/src/boxed_slice.rs index 302cab0235..8d01b60b7f 100644 --- a/cranelift/entity/src/boxed_slice.rs +++ b/cranelift/entity/src/boxed_slice.rs @@ -3,10 +3,10 @@ use crate::iter::{Iter, IterMut}; use crate::keys::Keys; use crate::EntityRef; +use alloc::boxed::Box; use core::marker::PhantomData; use core::ops::{Index, IndexMut}; use core::slice; -use alloc::boxed::Box; /// A slice mapping `K -> V` allocating dense entity references. /// diff --git a/cranelift/entity/src/list.rs b/cranelift/entity/src/list.rs index 263a981bb3..68cab8166b 100644 --- a/cranelift/entity/src/list.rs +++ b/cranelift/entity/src/list.rs @@ -1,9 +1,9 @@ //! Small lists of entity references. use crate::packed_option::ReservedValue; use crate::EntityRef; +use alloc::vec::Vec; use core::marker::PhantomData; use core::mem; -use alloc::vec::Vec; /// A small list of entity references allocated from a pool. /// diff --git a/cranelift/entity/src/map.rs b/cranelift/entity/src/map.rs index 937c4a49d9..7eb889e8b4 100644 --- a/cranelift/entity/src/map.rs +++ b/cranelift/entity/src/map.rs @@ -3,6 +3,7 @@ use crate::iter::{Iter, IterMut}; use crate::keys::Keys; use crate::EntityRef; +use alloc::vec::Vec; use core::cmp::min; use core::marker::PhantomData; use core::ops::{Index, IndexMut}; @@ -13,7 +14,6 @@ use serde::{ ser::{SerializeSeq, Serializer}, Deserialize, Serialize, }; -use alloc::vec::Vec; /// A mapping `K -> V` for densely indexed entity references. /// diff --git a/cranelift/entity/src/primary.rs b/cranelift/entity/src/primary.rs index a464fe60f8..974033addd 100644 --- a/cranelift/entity/src/primary.rs +++ b/cranelift/entity/src/primary.rs @@ -3,14 +3,14 @@ use crate::boxed_slice::BoxedSlice; use crate::iter::{Iter, IterMut}; use crate::keys::Keys; use crate::EntityRef; +use alloc::boxed::Box; +use alloc::vec::Vec; use core::iter::FromIterator; use core::marker::PhantomData; use core::ops::{Index, IndexMut}; use core::slice; #[cfg(feature = "enable-serde")] use serde::{Deserialize, Serialize}; -use alloc::boxed::Box; -use alloc::vec::Vec; /// A primary mapping `K -> V` allocating dense entity references. /// diff --git a/cranelift/entity/src/set.rs b/cranelift/entity/src/set.rs index 2379fe2a7d..c54ae4b31d 100644 --- a/cranelift/entity/src/set.rs +++ b/cranelift/entity/src/set.rs @@ -2,8 +2,8 @@ use crate::keys::Keys; use crate::EntityRef; -use core::marker::PhantomData; use alloc::vec::Vec; +use core::marker::PhantomData; /// A set of `K` for densely indexed entity references. /// diff --git a/cranelift/entity/src/sparse.rs b/cranelift/entity/src/sparse.rs index 43d8d4d431..57d971b281 100644 --- a/cranelift/entity/src/sparse.rs +++ b/cranelift/entity/src/sparse.rs @@ -9,10 +9,10 @@ use crate::map::SecondaryMap; use crate::EntityRef; +use alloc::vec::Vec; use core::mem; use core::slice; use core::u32; -use alloc::vec::Vec; /// Trait for extracting keys from values stored in a `SparseMap`. /// diff --git a/cranelift/frontend/src/frontend.rs b/cranelift/frontend/src/frontend.rs index 15488f7c2a..85a7725930 100644 --- a/cranelift/frontend/src/frontend.rs +++ b/cranelift/frontend/src/frontend.rs @@ -1,6 +1,7 @@ //! A frontend for building Cranelift IR from other languages. use crate::ssa::{Block, SSABuilder, SideEffects}; use crate::variable::Variable; +use alloc::vec::Vec; use cranelift_codegen::cursor::{Cursor, FuncCursor}; use cranelift_codegen::entity::{EntitySet, SecondaryMap}; use cranelift_codegen::ir; @@ -13,7 +14,6 @@ use cranelift_codegen::ir::{ }; use cranelift_codegen::isa::{TargetFrontendConfig, TargetIsa}; use cranelift_codegen::packed_option::PackedOption; -use alloc::vec::Vec; /// Structure used for translating a series of functions into Cranelift IR. /// @@ -893,13 +893,13 @@ mod tests { use super::greatest_divisible_power_of_two; use crate::frontend::{FunctionBuilder, FunctionBuilderContext}; use crate::Variable; + use alloc::string::ToString; use cranelift_codegen::entity::EntityRef; use cranelift_codegen::ir::types::*; use cranelift_codegen::ir::{AbiParam, ExternalName, Function, InstBuilder, Signature}; use cranelift_codegen::isa::CallConv; use cranelift_codegen::settings; use cranelift_codegen::verifier::verify_function; - use alloc::string::ToString; fn sample_function(lazy_seal: bool) { let mut sig = Signature::new(CallConv::SystemV); diff --git a/cranelift/frontend/src/ssa.rs b/cranelift/frontend/src/ssa.rs index 0175c6381d..dcc729ebd5 100644 --- a/cranelift/frontend/src/ssa.rs +++ b/cranelift/frontend/src/ssa.rs @@ -6,6 +6,7 @@ //! Lecture Notes in Computer Science, vol 7791. Springer, Berlin, Heidelberg use crate::Variable; +use alloc::vec::Vec; use core::mem; use core::u32; use cranelift_codegen::cursor::{Cursor, FuncCursor}; @@ -17,7 +18,6 @@ use cranelift_codegen::ir::{Ebb, Function, Inst, InstBuilder, InstructionData, T use cranelift_codegen::packed_option::PackedOption; use cranelift_codegen::packed_option::ReservedValue; use smallvec::SmallVec; -use alloc::vec::Vec; /// Structure containing the data relevant the construction of SSA for a given function. /// diff --git a/cranelift/frontend/src/switch.rs b/cranelift/frontend/src/switch.rs index 7353d7d049..25cba38ac3 100644 --- a/cranelift/frontend/src/switch.rs +++ b/cranelift/frontend/src/switch.rs @@ -1,9 +1,9 @@ use super::HashMap; use crate::frontend::FunctionBuilder; +use alloc::vec::Vec; use cranelift_codegen::ir::condcodes::IntCC; use cranelift_codegen::ir::*; use log::debug; -use alloc::vec::Vec; type EntryIndex = u64; @@ -290,8 +290,8 @@ impl ContiguousCaseRange { mod tests { use super::*; use crate::frontend::FunctionBuilderContext; - use cranelift_codegen::ir::Function; use alloc::string::ToString; + use cranelift_codegen::ir::Function; macro_rules! setup { ($default:expr, [$($index:expr,)*]) => {{