Always use extern crate std in cranelift-codegen

This commit is contained in:
bjorn3
2019-09-28 15:52:23 +02:00
committed by Dan Gohman
parent a114423d0a
commit 10e226f9ff
63 changed files with 89 additions and 90 deletions

View File

@@ -5,7 +5,7 @@
use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type}; use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type};
use core::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use alloc::vec::Vec;
/// Legalization action to perform on a single argument or return value when converting a /// Legalization action to perform on a single argument or return value when converting a
/// signature. /// signature.

View File

@@ -227,7 +227,7 @@ fn try_fold_redundant_jump(
} }
// Build a value list of first_args (unchanged) followed by second_params (rewritten). // Build a value list of first_args (unchanged) followed by second_params (rewritten).
let arguments_vec: std::vec::Vec<_> = first_args let arguments_vec: alloc::vec::Vec<_> = first_args
.iter() .iter()
.chain(second_params.iter()) .chain(second_params.iter())
.map(|x| *x) .map(|x| *x)

View File

@@ -1,7 +1,7 @@
use crate::bitset::BitSet; use crate::bitset::BitSet;
use crate::ir; use crate::ir;
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use std::vec::Vec; use alloc::vec::Vec;
type Num = u32; type Num = u32;
const NUM_BITS: usize = core::mem::size_of::<Num>() * 8; const NUM_BITS: usize = core::mem::size_of::<Num>() * 8;
@@ -42,7 +42,7 @@ impl Stackmap {
let frame_size = stack.frame_size.unwrap(); let frame_size = stack.frame_size.unwrap();
let word_size = ir::stackslot::StackSize::from(isa.pointer_bytes()); let word_size = ir::stackslot::StackSize::from(isa.pointer_bytes());
let num_words = (frame_size / word_size) as usize; let num_words = (frame_size / word_size) as usize;
let mut vec = std::vec::Vec::with_capacity(num_words); let mut vec = alloc::vec::Vec::with_capacity(num_words);
vec.resize(num_words, false); vec.resize(num_words, false);

View File

@@ -1,7 +1,7 @@
//! The `CFGPrinter` utility. //! The `CFGPrinter` utility.
use core::fmt::{Display, Formatter, Result, Write}; use core::fmt::{Display, Formatter, Result, Write};
use std::vec::Vec; use alloc::vec::Vec;
use crate::entity::SecondaryMap; use crate::entity::SecondaryMap;
use crate::flowgraph::{BasicBlock, ControlFlowGraph}; use crate::flowgraph::{BasicBlock, ControlFlowGraph};

View File

@@ -34,7 +34,7 @@ use crate::unreachable_code::eliminate_unreachable_code;
use crate::value_label::{build_value_labels_ranges, ComparableSourceLoc, ValueLabelsRanges}; use crate::value_label::{build_value_labels_ranges, ComparableSourceLoc, ValueLabelsRanges};
use crate::verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult}; use crate::verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult};
use log::debug; use log::debug;
use std::vec::Vec; use alloc::vec::Vec;
/// Persistent data structures and compilation pipeline. /// Persistent data structures and compilation pipeline.
pub struct Context { pub struct Context {

View File

@@ -9,7 +9,7 @@ use crate::timing;
use core::cmp; use core::cmp;
use core::cmp::Ordering; use core::cmp::Ordering;
use core::mem; use core::mem;
use std::vec::Vec; use alloc::vec::Vec;
/// RPO numbers are not first assigned in a contiguous way but as multiples of STRIDE, to leave /// RPO numbers are not first assigned in a contiguous way but as multiples of STRIDE, to leave
/// room for modifications of the dominator tree. /// room for modifications of the dominator tree.

View File

@@ -214,7 +214,7 @@ mod tests {
use super::*; use super::*;
use crate::cursor::{Cursor, FuncCursor}; use crate::cursor::{Cursor, FuncCursor};
use crate::ir::{types, Function, InstBuilder}; use crate::ir::{types, Function, InstBuilder};
use std::vec::Vec; use alloc::vec::Vec;
#[test] #[test]
fn empty() { fn empty() {

View File

@@ -11,8 +11,8 @@
use crate::ir::Constant; use crate::ir::Constant;
use crate::HashMap; use crate::HashMap;
use cranelift_entity::EntityRef; use cranelift_entity::EntityRef;
use std::collections::BTreeMap; use alloc::collections::BTreeMap;
use std::vec::Vec; use alloc::vec::Vec;
/// This type describes the actual constant data. /// This type describes the actual constant data.
pub type ConstantData = Vec<u8>; pub type ConstantData = Vec<u8>;

View File

@@ -19,7 +19,7 @@ use core::iter;
use core::mem; use core::mem;
use core::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use core::u16; use core::u16;
use std::vec::Vec; use alloc::vec::Vec;
/// A data flow graph defines all instructions and extended basic blocks in a function as well as /// 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 /// the data flow dependencies between them. The DFG also tracks values which can be either
@@ -1093,7 +1093,7 @@ mod tests {
use crate::cursor::{Cursor, FuncCursor}; use crate::cursor::{Cursor, FuncCursor};
use crate::ir::types; use crate::ir::types;
use crate::ir::{Function, InstructionData, Opcode, TrapCode}; use crate::ir::{Function, InstructionData, Opcode, TrapCode};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn make_inst() { fn make_inst() {

View File

@@ -456,7 +456,7 @@ impl From<Table> for AnyEntity {
mod tests { mod tests {
use super::*; use super::*;
use core::u32; use core::u32;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn value_with_number() { fn value_with_number() {

View File

@@ -9,7 +9,7 @@ use crate::ir::{ArgumentLoc, ExternalName, SigRef, Type};
use crate::isa::{CallConv, RegInfo, RegUnit}; use crate::isa::{CallConv, RegInfo, RegUnit};
use core::fmt; use core::fmt;
use core::str::FromStr; use core::str::FromStr;
use std::vec::Vec; use alloc::vec::Vec;
/// Function signature. /// Function signature.
/// ///
@@ -335,7 +335,7 @@ impl fmt::Display for ExtFuncData {
mod tests { mod tests {
use super::*; use super::*;
use crate::ir::types::{B8, F32, I32}; use crate::ir::types::{B8, F32, I32};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn argument_type() { fn argument_type() {

View File

@@ -121,7 +121,7 @@ mod tests {
use super::ExternalName; use super::ExternalName;
use crate::ir::LibCall; use crate::ir::LibCall;
use core::u32; use core::u32;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn display_testcase() { fn display_testcase() {

View File

@@ -8,7 +8,7 @@ use core::fmt::{self, Display, Formatter};
use core::iter::FromIterator; use core::iter::FromIterator;
use core::str::{from_utf8, FromStr}; use core::str::{from_utf8, FromStr};
use core::{i32, u32}; use core::{i32, u32};
use std::vec::Vec; use alloc::vec::Vec;
/// Convert a type into a vector of bytes; all implementors in this file must use little-endian /// 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. /// orderings of bytes to match WebAssembly's little-endianness.
@@ -940,7 +940,7 @@ mod tests {
use core::mem; use core::mem;
use core::str::FromStr; use core::str::FromStr;
use core::{f32, f64}; use core::{f32, f64};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn format_imm64() { fn format_imm64() {

View File

@@ -9,7 +9,7 @@
use core::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use core::ops::{Deref, DerefMut}; use core::ops::{Deref, DerefMut};
use core::str::FromStr; use core::str::FromStr;
use std::vec::Vec; use alloc::vec::Vec;
use crate::ir; use crate::ir;
use crate::ir::types; use crate::ir::types;
@@ -560,7 +560,7 @@ pub enum ResolvedConstraint {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn opcodes() { fn opcodes() {

View File

@@ -6,7 +6,7 @@
use crate::ir::entities::Ebb; use crate::ir::entities::Ebb;
use core::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use core::slice::{Iter, IterMut}; use core::slice::{Iter, IterMut};
use std::vec::Vec; use alloc::vec::Vec;
/// Contents of a jump table. /// Contents of a jump table.
/// ///
@@ -85,7 +85,7 @@ mod tests {
use super::JumpTableData; use super::JumpTableData;
use crate::entity::EntityRef; use crate::entity::EntityRef;
use crate::ir::Ebb; use crate::ir::Ebb;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn empty() { fn empty() {

View File

@@ -751,7 +751,7 @@ mod tests {
use crate::entity::EntityRef; use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc}; use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc};
use core::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use alloc::vec::Vec;
struct LayoutCursor<'f> { struct LayoutCursor<'f> {
/// Borrowed function layout. Public so it can be re-borrowed from this cursor. /// Borrowed function layout. Public so it can be re-borrowed from this cursor.

View File

@@ -209,7 +209,7 @@ fn make_funcref(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn display() { fn display() {

View File

@@ -100,7 +100,7 @@ pub struct ValueLabelStart {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum ValueLabelAssignments { pub enum ValueLabelAssignments {
/// Original value labels assigned at transform. /// Original value labels assigned at transform.
Starts(std::vec::Vec<ValueLabelStart>), Starts(alloc::vec::Vec<ValueLabelStart>),
/// A value alias to original value. /// A value alias to original value.
Alias { Alias {

View File

@@ -148,7 +148,7 @@ mod tests {
use super::*; use super::*;
use crate::entity::EntityRef; use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst}; use crate::ir::{Ebb, Inst};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn convert() { fn convert() {

View File

@@ -54,7 +54,7 @@ impl fmt::Display for SourceLoc {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::ir::SourceLoc; use crate::ir::SourceLoc;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn display() { fn display() {

View File

@@ -11,7 +11,7 @@ use core::fmt;
use core::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use core::slice; use core::slice;
use core::str::FromStr; use core::str::FromStr;
use std::vec::Vec; use alloc::vec::Vec;
#[cfg(feature = "enable-serde")] #[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@@ -343,7 +343,7 @@ mod tests {
use super::*; use super::*;
use crate::ir::types; use crate::ir::types;
use crate::ir::Function; use crate::ir::Function;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn stack_slot() { fn stack_slot() {

View File

@@ -103,7 +103,7 @@ impl FromStr for TrapCode {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::string::ToString; use alloc::string::ToString;
// Everything but user-defined codes. // Everything but user-defined codes.
const CODES: [TrapCode; 11] = [ const CODES: [TrapCode; 11] = [

View File

@@ -363,7 +363,7 @@ impl Default for Type {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn basic_scalars() { fn basic_scalars() {

View File

@@ -16,7 +16,7 @@ use crate::isa::Builder as IsaBuilder;
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use crate::regalloc; use crate::regalloc;
use core::fmt; use core::fmt;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::{Architecture, Triple}; use target_lexicon::{Architecture, Triple};
#[allow(dead_code)] #[allow(dead_code)]

View File

@@ -8,7 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-arm32.rs"));
mod tests { mod tests {
use super::{D, GPR, INFO, S}; use super::{D, GPR, INFO, S};
use crate::isa::RegUnit; use crate::isa::RegUnit;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
#[test] #[test]
fn unit_encodings() { fn unit_encodings() {

View File

@@ -16,7 +16,7 @@ use crate::isa::Builder as IsaBuilder;
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use crate::regalloc; use crate::regalloc;
use core::fmt; use core::fmt;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::Triple; use target_lexicon::Triple;
#[allow(dead_code)] #[allow(dead_code)]

View File

@@ -8,7 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-arm64.rs"));
mod tests { mod tests {
use super::INFO; use super::INFO;
use crate::isa::RegUnit; use crate::isa::RegUnit;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
#[test] #[test]
fn unit_encodings() { fn unit_encodings() {

View File

@@ -25,7 +25,7 @@
//! # fn main() { //! # fn main() {
//! use cranelift_codegen::isa; //! use cranelift_codegen::isa;
//! use cranelift_codegen::settings::{self, Configurable}; //! use cranelift_codegen::settings::{self, Configurable};
//! use std::str::FromStr; //! use alloc::str::FromStr;
//! use target_lexicon::Triple; //! use target_lexicon::Triple;
//! //!
//! let shared_builder = settings::builder(); //! let shared_builder = settings::builder();
@@ -65,7 +65,7 @@ use crate::settings::SetResult;
use crate::timing; use crate::timing;
use core::fmt; use core::fmt;
use failure_derive::Fail; use failure_derive::Fail;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::{triple, Architecture, PointerWidth, Triple}; use target_lexicon::{triple, Architecture, PointerWidth, Triple};
#[cfg(feature = "riscv")] #[cfg(feature = "riscv")]
@@ -119,7 +119,7 @@ pub fn lookup(triple: Triple) -> Result<Builder, LookupError> {
/// Look for a supported ISA with the given `name`. /// Look for a supported ISA with the given `name`.
/// Return a builder that can create a corresponding `TargetIsa`. /// Return a builder that can create a corresponding `TargetIsa`.
pub fn lookup_by_name(name: &str) -> Result<Builder, LookupError> { pub fn lookup_by_name(name: &str) -> Result<Builder, LookupError> {
use std::str::FromStr; use alloc::str::FromStr;
lookup(triple!(name)) lookup(triple!(name))
} }

View File

@@ -16,7 +16,7 @@ use crate::isa::Builder as IsaBuilder;
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa}; use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use crate::regalloc; use crate::regalloc;
use core::fmt; use core::fmt;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::{PointerWidth, Triple}; use target_lexicon::{PointerWidth, Triple};
#[allow(dead_code)] #[allow(dead_code)]
@@ -138,7 +138,7 @@ mod tests {
use crate::isa; use crate::isa;
use crate::settings::{self, Configurable}; use crate::settings::{self, Configurable};
use core::str::FromStr; use core::str::FromStr;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
use target_lexicon::triple; use target_lexicon::triple;
fn encstr(isa: &dyn isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String { fn encstr(isa: &dyn isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {

View File

@@ -8,7 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-riscv.rs"));
mod tests { mod tests {
use super::{FPR, GPR, INFO}; use super::{FPR, GPR, INFO};
use crate::isa::RegUnit; use crate::isa::RegUnit;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
#[test] #[test]
fn unit_encodings() { fn unit_encodings() {

View File

@@ -12,7 +12,7 @@ include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
mod tests { mod tests {
use super::{builder, Flags}; use super::{builder, Flags};
use crate::settings::{self, Configurable}; use crate::settings::{self, Configurable};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn display_default() { fn display_default() {

View File

@@ -18,7 +18,7 @@ use crate::regalloc;
use crate::result::CodegenResult; use crate::result::CodegenResult;
use crate::timing; use crate::timing;
use core::fmt; use core::fmt;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::{PointerWidth, Triple}; use target_lexicon::{PointerWidth, Triple};
#[allow(dead_code)] #[allow(dead_code)]

View File

@@ -8,7 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-x86.rs"));
mod tests { mod tests {
use super::*; use super::*;
use crate::isa::RegUnit; use crate::isa::RegUnit;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
#[test] #[test]
fn unit_encodings() { fn unit_encodings() {

View File

@@ -44,7 +44,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::vec::Vec; use alloc::vec::Vec;
#[test] #[test]
fn adjpairs() { fn adjpairs() {

View File

@@ -28,7 +28,7 @@ use crate::ir::{
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use crate::legalizer::split::{isplit, vsplit}; use crate::legalizer::split::{isplit, vsplit};
use log::debug; use log::debug;
use std::vec::Vec; use alloc::vec::Vec;
/// Legalize all the function signatures in `func`. /// Legalize all the function signatures in `func`.
/// ///

View File

@@ -4,7 +4,7 @@ use crate::ir;
use crate::ir::{get_libcall_funcref, InstBuilder}; use crate::ir::{get_libcall_funcref, InstBuilder};
use crate::isa::{CallConv, TargetIsa}; use crate::isa::{CallConv, TargetIsa};
use crate::legalizer::boundary::legalize_libcall_signature; use crate::legalizer::boundary::legalize_libcall_signature;
use std::vec::Vec; use alloc::vec::Vec;
/// Try to expand `inst` as a library call, returning true is successful. /// Try to expand `inst` as a library call, returning true is successful.
pub fn expand_as_libcall(inst: ir::Inst, func: &mut ir::Function, isa: &dyn TargetIsa) -> bool { pub fn expand_as_libcall(inst: ir::Inst, func: &mut ir::Function, isa: &dyn TargetIsa) -> bool {

View File

@@ -21,8 +21,8 @@ use crate::ir::{self, InstBuilder, MemFlags};
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use crate::predicates; use crate::predicates;
use crate::timing; use crate::timing;
use std::collections::BTreeSet; use alloc::collections::BTreeSet;
use std::vec::Vec; use alloc::vec::Vec;
mod boundary; mod boundary;
mod call; mod call;
@@ -373,7 +373,7 @@ fn expand_br_table_conds(
let table_size = func.jump_tables[table].len(); let table_size = func.jump_tables[table].len();
let mut cond_failed_ebb = vec![]; let mut cond_failed_ebb = vec![];
if table_size >= 1 { if table_size >= 1 {
cond_failed_ebb = std::vec::Vec::with_capacity(table_size - 1); cond_failed_ebb = alloc::vec::Vec::with_capacity(table_size - 1);
for _ in 0..table_size - 1 { for _ in 0..table_size - 1 {
cond_failed_ebb.push(func.dfg.make_ebb()); cond_failed_ebb.push(func.dfg.make_ebb());
} }

View File

@@ -69,7 +69,7 @@ use crate::flowgraph::{BasicBlock, ControlFlowGraph};
use crate::ir::{self, Ebb, Inst, InstBuilder, InstructionData, Opcode, Type, Value, ValueDef}; use crate::ir::{self, Ebb, Inst, InstBuilder, InstructionData, Opcode, Type, Value, ValueDef};
use core::iter; use core::iter;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::vec::Vec; use alloc::vec::Vec;
/// Split `value` into two values using the `isplit` semantics. Do this by reusing existing values /// Split `value` into two values using the `isplit` semantics. Do this by reusing existing values
/// if possible. /// if possible.

View File

@@ -35,16 +35,15 @@
clippy::nonminimal_bool, clippy::nonminimal_bool,
clippy::option_map_unwrap_or, clippy::option_map_unwrap_or,
clippy::option_map_unwrap_or_else, clippy::option_map_unwrap_or_else,
clippy::print_stdout, clippy::print_allocout,
clippy::unicode_not_nfc, clippy::unicode_not_nfc,
clippy::use_self clippy::use_self
) )
)] )]
#![no_std] #![no_std]
#[cfg(not(feature = "std"))] extern crate alloc;
#[macro_use]
extern crate alloc as std;
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[macro_use] #[macro_use]
extern crate std; extern crate std;

View File

@@ -11,7 +11,7 @@ use crate::ir::{
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use crate::loop_analysis::{Loop, LoopAnalysis}; use crate::loop_analysis::{Loop, LoopAnalysis};
use crate::timing; use crate::timing;
use std::vec::Vec; use alloc::vec::Vec;
/// Performs the LICM pass by detecting loops within the CFG and moving /// Performs the LICM pass by detecting loops within the CFG and moving
/// loop-invariant instructions out of them. /// loop-invariant instructions out of them.

View File

@@ -9,7 +9,7 @@ use crate::flowgraph::{BasicBlock, ControlFlowGraph};
use crate::ir::{Ebb, Function, Layout}; use crate::ir::{Ebb, Function, Layout};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
use crate::timing; use crate::timing;
use std::vec::Vec; use alloc::vec::Vec;
/// A opaque reference to a code loop. /// A opaque reference to a code loop.
#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Hash)]
@@ -237,7 +237,7 @@ mod tests {
use crate::flowgraph::ControlFlowGraph; use crate::flowgraph::ControlFlowGraph;
use crate::ir::{types, Function, InstBuilder}; use crate::ir::{types, Function, InstBuilder};
use crate::loop_analysis::{Loop, LoopAnalysis}; use crate::loop_analysis::{Loop, LoopAnalysis};
use std::vec::Vec; use alloc::vec::Vec;
#[test] #[test]
fn nested_loops_detection() { fn nested_loops_detection() {

View File

@@ -53,7 +53,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::partition_slice; use super::partition_slice;
use std::vec::Vec; use alloc::vec::Vec;
fn check(x: &[u32], want: &[u32]) { fn check(x: &[u32], want: &[u32]) {
assert_eq!(x.len(), want.len()); assert_eq!(x.len(), want.len());

View File

@@ -10,9 +10,9 @@ use crate::verifier::{VerifierError, VerifierErrors};
use crate::write::{decorate_function, FuncWriter, PlainWriter}; use crate::write::{decorate_function, FuncWriter, PlainWriter};
use core::fmt; use core::fmt;
use core::fmt::Write; use core::fmt::Write;
use std::boxed::Box; use alloc::boxed::Box;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
use std::vec::Vec; use alloc::vec::Vec;
/// Pretty-print a verifier error. /// Pretty-print a verifier error.
pub fn pretty_verifier_error<'a>( pub fn pretty_verifier_error<'a>(

View File

@@ -14,7 +14,7 @@ use crate::isa::{RegInfo, RegUnit, TargetIsa};
use crate::regalloc::RegDiversions; use crate::regalloc::RegDiversions;
use core::convert::TryInto; use core::convert::TryInto;
use cranelift_entity::{PrimaryMap, SecondaryMap}; use cranelift_entity::{PrimaryMap, SecondaryMap};
use std::vec::Vec; use alloc::vec::Vec;
// ============================================================================================= // =============================================================================================
// A description of the redundant-fill-removal algorithm // A description of the redundant-fill-removal algorithm

View File

@@ -4,7 +4,7 @@
//! between a conditional branch and the following terminator. //! between a conditional branch and the following terminator.
#![cfg(feature = "basic-blocks")] #![cfg(feature = "basic-blocks")]
use std::vec::Vec; use alloc::vec::Vec;
use crate::cursor::{Cursor, EncCursor}; use crate::cursor::{Cursor, EncCursor};
use crate::dominator_tree::DominatorTree; use crate::dominator_tree::DominatorTree;

View File

@@ -22,7 +22,7 @@ use core::fmt;
use core::iter; use core::iter;
use core::slice; use core::slice;
use log::debug; use log::debug;
use std::vec::Vec; use alloc::vec::Vec;
// # Implementation // # Implementation
// //

View File

@@ -12,7 +12,7 @@ use crate::partition_slice::partition_slice;
use crate::regalloc::affinity::Affinity; use crate::regalloc::affinity::Affinity;
use crate::regalloc::liveness::Liveness; use crate::regalloc::liveness::Liveness;
use crate::regalloc::liverange::LiveRange; use crate::regalloc::liverange::LiveRange;
use std::vec::Vec; use alloc::vec::Vec;
type ValueList = EntityList<Value>; type ValueList = EntityList<Value>;

View File

@@ -185,7 +185,7 @@ use crate::regalloc::liverange::LiveRange;
use crate::timing; use crate::timing;
use core::mem; use core::mem;
use core::ops::Index; use core::ops::Index;
use std::vec::Vec; use alloc::vec::Vec;
/// A set of live ranges, indexed by value number. /// A set of live ranges, indexed by value number.
type LiveRangeSet = SparseMap<Value, LiveRange>; type LiveRangeSet = SparseMap<Value, LiveRange>;

View File

@@ -477,7 +477,7 @@ mod tests {
use crate::ir::{Ebb, Inst, Value}; use crate::ir::{Ebb, Inst, Value};
use crate::ir::{ExpandedProgramPoint, ProgramOrder}; use crate::ir::{ExpandedProgramPoint, ProgramOrder};
use core::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use alloc::vec::Vec;
// Dummy program order which simply compares indexes. // Dummy program order which simply compares indexes.
// It is assumed that EBBs have indexes that are multiples of 10, and instructions have indexes // It is assumed that EBBs have indexes that are multiples of 10, and instructions have indexes

View File

@@ -277,7 +277,7 @@ mod tests {
use crate::regalloc::RegisterSet; use crate::regalloc::RegisterSet;
use core::borrow::Borrow; use core::borrow::Borrow;
use core::str::FromStr; use core::str::FromStr;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::triple; use target_lexicon::triple;
// Make an arm32 `TargetIsa`, if possible. // Make an arm32 `TargetIsa`, if possible.

View File

@@ -255,7 +255,7 @@ impl fmt::Display for RegisterSet {
mod tests { mod tests {
use super::*; use super::*;
use crate::isa::registers::{RegClass, RegClassData}; use crate::isa::registers::{RegClass, RegClassData};
use std::vec::Vec; use alloc::vec::Vec;
// Register classes for testing. // Register classes for testing.
const GPR: RegClass = &RegClassData { const GPR: RegClass = &RegClassData {

View File

@@ -22,7 +22,7 @@ use crate::regalloc::liveness::Liveness;
use crate::timing; use crate::timing;
use crate::topo_order::TopoOrder; use crate::topo_order::TopoOrder;
use log::debug; use log::debug;
use std::vec::Vec; use alloc::vec::Vec;
/// Reusable data structures for the reload pass. /// Reusable data structures for the reload pass.
pub struct Reload { pub struct Reload {

View File

@@ -4,7 +4,7 @@ use crate::ir::{Function, InstBuilder, InstructionData, Opcode, TrapCode};
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use crate::regalloc::live_value_tracker::LiveValueTracker; use crate::regalloc::live_value_tracker::LiveValueTracker;
use crate::regalloc::liveness::Liveness; use crate::regalloc::liveness::Liveness;
use std::vec::Vec; use alloc::vec::Vec;
fn insert_and_encode_safepoint<'f>( fn insert_and_encode_safepoint<'f>(
pos: &mut FuncCursor<'f>, pos: &mut FuncCursor<'f>,

View File

@@ -109,7 +109,7 @@ use core::fmt;
use core::mem; use core::mem;
use core::u16; use core::u16;
use log::debug; use log::debug;
use std::vec::Vec; use alloc::vec::Vec;
/// A variable in the constraint problem. /// A variable in the constraint problem.
/// ///
@@ -1160,7 +1160,7 @@ mod tests {
use crate::isa::{RegClass, RegInfo, RegUnit, TargetIsa}; use crate::isa::{RegClass, RegInfo, RegUnit, TargetIsa};
use crate::regalloc::RegisterSet; use crate::regalloc::RegisterSet;
use core::str::FromStr; use core::str::FromStr;
use std::boxed::Box; use alloc::boxed::Box;
use target_lexicon::triple; use target_lexicon::triple;
// Make an arm32 `TargetIsa`, if possible. // Make an arm32 `TargetIsa`, if possible.

View File

@@ -29,7 +29,7 @@ use crate::timing;
use crate::topo_order::TopoOrder; use crate::topo_order::TopoOrder;
use core::fmt; use core::fmt;
use log::debug; use log::debug;
use std::vec::Vec; use alloc::vec::Vec;
/// Return a top-level register class which contains `unit`. /// Return a top-level register class which contains `unit`.
fn toprc_containing_regunit(unit: RegUnit, reginfo: &RegInfo) -> RegClass { fn toprc_containing_regunit(unit: RegUnit, reginfo: &RegInfo) -> RegClass {

View File

@@ -22,7 +22,7 @@ use core::cmp::Ordering;
use core::fmt; use core::fmt;
use core::slice; use core::slice;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::vec::Vec; use alloc::vec::Vec;
/// A virtual register reference. /// A virtual register reference.
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

View File

@@ -25,8 +25,8 @@ use crate::isa::TargetIsa;
use core::fmt; use core::fmt;
use core::str; use core::str;
use failure_derive::Fail; use failure_derive::Fail;
use std::boxed::Box; use alloc::boxed::Box;
use std::string::{String, ToString}; use alloc::string::{String, ToString};
/// A string-based configurator for settings groups. /// A string-based configurator for settings groups.
/// ///
@@ -369,7 +369,7 @@ mod tests {
use super::Configurable; use super::Configurable;
use super::SetError::*; use super::SetError::*;
use super::{builder, Flags}; use super::{builder, Flags};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn display_default() { fn display_default() {

View File

@@ -7,7 +7,7 @@ use crate::scoped_hash_map::ScopedHashMap;
use crate::timing; use crate::timing;
use core::cell::{Ref, RefCell}; use core::cell::{Ref, RefCell};
use core::hash::{Hash, Hasher}; use core::hash::{Hash, Hasher};
use std::vec::Vec; use alloc::vec::Vec;
/// Test whether the given opcode is unsafe to even consider for GVN. /// Test whether the given opcode is unsafe to even consider for GVN.
fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool { fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool {

View File

@@ -252,7 +252,7 @@ mod details {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn display() { fn display() {

View File

@@ -3,7 +3,7 @@
use crate::dominator_tree::DominatorTree; use crate::dominator_tree::DominatorTree;
use crate::entity::EntitySet; use crate::entity::EntitySet;
use crate::ir::{Ebb, Layout}; use crate::ir::{Ebb, Layout};
use std::vec::Vec; use alloc::vec::Vec;
/// Present EBBs in a topological order such that all dominating EBBs are guaranteed to be visited /// Present EBBs in a topological order such that all dominating EBBs are guaranteed to be visited
/// before the current EBB. /// before the current EBB.

View File

@@ -6,8 +6,8 @@ use core::cmp::Ordering;
use core::iter::Iterator; use core::iter::Iterator;
use core::ops::Bound::*; use core::ops::Bound::*;
use core::ops::Deref; use core::ops::Deref;
use std::collections::BTreeMap; use alloc::collections::BTreeMap;
use std::vec::Vec; use alloc::vec::Vec;
#[cfg(feature = "enable-serde")] #[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@@ -75,9 +75,9 @@ use crate::timing;
use core::cmp::Ordering; use core::cmp::Ordering;
use core::fmt::{self, Display, Formatter, Write}; use core::fmt::{self, Display, Formatter, Write};
use failure_derive::Fail; use failure_derive::Fail;
use std::collections::BTreeSet; use alloc::collections::BTreeSet;
use std::string::String; use alloc::string::String;
use std::vec::Vec; use alloc::vec::Vec;
pub use self::cssa::verify_cssa; pub use self::cssa::verify_cssa;
pub use self::liveness::verify_liveness; pub use self::liveness::verify_liveness;

View File

@@ -15,8 +15,8 @@ use crate::packed_option::ReservedValue;
use crate::value_label::ValueLabelsRanges; use crate::value_label::ValueLabelsRanges;
use crate::HashSet; use crate::HashSet;
use core::fmt::{self, Write}; use core::fmt::{self, Write};
use std::string::String; use alloc::string::String;
use std::vec::Vec; use alloc::vec::Vec;
/// A `FuncWriter` used to decorate functions during printing. /// A `FuncWriter` used to decorate functions during printing.
pub trait FuncWriter { pub trait FuncWriter {
@@ -759,7 +759,7 @@ mod tests {
use crate::cursor::{Cursor, CursorPosition, FuncCursor}; use crate::cursor::{Cursor, CursorPosition, FuncCursor};
use crate::ir::types; use crate::ir::types;
use crate::ir::{ExternalName, Function, InstBuilder, StackSlotData, StackSlotKind}; use crate::ir::{ExternalName, Function, InstBuilder, StackSlotData, StackSlotKind};
use std::string::ToString; use alloc::string::ToString;
#[test] #[test]
fn basic() { fn basic() {