Update no_std support for Rust 2018 Edition.

With Rust 2018 Edition, the `mod std` trick to alias `core` names to
`std` no longer works, so switch to just having the code use `core`
explicitly.

So instead, switch to just using `core::*` for things that in core.
This is more consistent with other Rust no_std code. And it allows
us to enable `no_std` mode unconditionally in the crates that support
it, which makes testing a little easier.

There actually three cases:

 - For things in std and also in core, like `cmp`: Just use them via
   `core::*`.

 - For things in std and also in alloc, like `Vec`: Import alloc as std, as
   use them from std. This allows them to work on both stable (which
   doesn't provide alloc, but we don't support no_std mode anyway) and
   nightly.

 - For HashMap and similar which are not in core or alloc, import them in
   the top-level lib.rs files from either std or the third-party hashmap_core
   crate, and then have the code use super::hashmap_core.

Also, no_std support continues to be "best effort" at this time and not
something most people need to be testing.
This commit is contained in:
Dan Gohman
2019-01-07 11:04:58 -08:00
parent 50a045363c
commit aeb9161e2c
118 changed files with 322 additions and 355 deletions

View File

@@ -94,7 +94,7 @@ The following crates support \`no\_std\`, although they do depend on liballoc:
- cranelift-native - cranelift-native
- cranelift-wasm - cranelift-wasm
- cranelift-module - cranelift-module
- cranelift-simplejit - cranelift-preopt
- cranelift - cranelift
To use no\_std mode, disable the std feature and enable the core To use no\_std mode, disable the std feature and enable the core

View File

@@ -3,6 +3,7 @@ name = "clif-wasm-fuzz"
version = "0.0.1" version = "0.0.1"
authors = ["foote@fastly.com"] authors = ["foote@fastly.com"]
publish = false publish = false
edition = "2018"
[package.metadata] [package.metadata]
cargo-fuzz = true cargo-fuzz = true

View File

@@ -13,7 +13,7 @@ function banner {
} }
# Test those packages which have no_std support. # Test those packages which have no_std support.
LIBS="codegen frontend wasm native preopt module simplejit umbrella" LIBS="codegen frontend wasm native preopt module entity bforest umbrella"
for LIB in $LIBS; do for LIB in $LIBS; do
banner "Rust unit tests in $LIB" banner "Rust unit tests in $LIB"
pushd "lib/$LIB" >/dev/null pushd "lib/$LIB" >/dev/null

View File

@@ -17,6 +17,7 @@ cranelift-entity = { path = "../entity", version = "0.26.0", default-features =
[features] [features]
default = ["std"] default = ["std"]
std = ["cranelift-entity/std"] std = ["cranelift-entity/std"]
core = []
[badges] [badges]
maintenance = { status = "experimental" } maintenance = { status = "experimental" }

View File

@@ -31,24 +31,24 @@
clippy::use_self clippy::use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. #![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))] #![cfg_attr(not(feature = "std"), feature(alloc))]
/// This replaces `std` in builds with `core`. #[cfg(test)]
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
mod std { #[macro_use]
extern crate alloc; extern crate alloc as std;
pub use self::alloc::{boxed, string, vec}; #[cfg(test)]
pub use core::*; #[cfg(feature = "std")]
} #[macro_use]
extern crate std;
#[macro_use] #[macro_use]
extern crate cranelift_entity as entity; extern crate cranelift_entity as entity;
use crate::entity::packed_option; use crate::entity::packed_option;
use std::borrow::BorrowMut; use core::borrow::BorrowMut;
use std::cmp::Ordering; use core::cmp::Ordering;
mod map; mod map;
mod node; mod node;

View File

@@ -3,8 +3,8 @@
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE}; use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
#[cfg(test)] #[cfg(test)]
use std::fmt; use core::fmt;
use std::marker::PhantomData; use core::marker::PhantomData;
#[cfg(test)] #[cfg(test)]
use std::string::String; use std::string::String;
@@ -429,7 +429,7 @@ where
mod tests { mod tests {
use super::super::NodeData; use super::super::NodeData;
use super::*; use super::*;
use std::mem; use core::mem;
use std::vec::Vec; use std::vec::Vec;
#[test] #[test]

View File

@@ -1,8 +1,8 @@
//! B+-tree nodes. //! B+-tree nodes.
use super::{slice_insert, slice_shift, Forest, Node, SetValue, INNER_SIZE}; use super::{slice_insert, slice_shift, Forest, Node, SetValue, INNER_SIZE};
use std::borrow::{Borrow, BorrowMut}; use core::borrow::{Borrow, BorrowMut};
use std::fmt; use core::fmt;
/// B+-tree node. /// B+-tree node.
/// ///
@@ -584,7 +584,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::mem; use core::mem;
use std::string::ToString; use std::string::ToString;
// Forest impl for a set implementation. // Forest impl for a set implementation.

View File

@@ -2,11 +2,11 @@
use super::node::Removed; use super::node::Removed;
use super::{slice_insert, slice_shift, Comparator, Forest, Node, NodeData, NodePool, MAX_PATH}; use super::{slice_insert, slice_shift, Comparator, Forest, Node, NodeData, NodePool, MAX_PATH};
use std::borrow::Borrow; use core::borrow::Borrow;
use std::marker::PhantomData; use core::marker::PhantomData;
#[cfg(test)] #[cfg(test)]
use std::fmt; use core::fmt;
pub(super) struct Path<F: Forest> { pub(super) struct Path<F: Forest> {
/// Number of path entries including the root and leaf nodes. /// Number of path entries including the root and leaf nodes.
@@ -706,7 +706,7 @@ impl<F: Forest> fmt::Display for Path<F> {
mod tests { mod tests {
use super::super::{Forest, NodeData, NodePool}; use super::super::{Forest, NodeData, NodePool};
use super::*; use super::*;
use std::cmp::Ordering; use core::cmp::Ordering;
struct TC(); struct TC();

View File

@@ -5,8 +5,8 @@ use super::Comparator;
use super::{Forest, Node, NodeData}; use super::{Forest, Node, NodeData};
use crate::entity::PrimaryMap; use crate::entity::PrimaryMap;
#[cfg(test)] #[cfg(test)]
use std::fmt; use core::fmt;
use std::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
/// A pool of nodes, including a free list. /// A pool of nodes, including a free list.
pub(super) struct NodePool<F: Forest> { pub(super) struct NodePool<F: Forest> {
@@ -84,8 +84,8 @@ impl<F: Forest> NodePool<F> {
F::Key: fmt::Display, F::Key: fmt::Display,
{ {
use crate::entity::SparseSet; use crate::entity::SparseSet;
use std::borrow::Borrow; use core::borrow::Borrow;
use std::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use std::vec::Vec;
// The root node can't be an inner node with just a single sub-tree. It should have been // The root node can't be an inner node with just a single sub-tree. It should have been

View File

@@ -3,8 +3,8 @@
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE}; use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
#[cfg(test)] #[cfg(test)]
use std::fmt; use core::fmt;
use std::marker::PhantomData; use core::marker::PhantomData;
#[cfg(test)] #[cfg(test)]
use std::string::String; use std::string::String;
@@ -357,7 +357,7 @@ where
mod tests { mod tests {
use super::super::NodeData; use super::super::NodeData;
use super::*; use super::*;
use std::mem; use core::mem;
use std::vec::Vec; use std::vec::Vec;
#[test] #[test]

View File

@@ -257,8 +257,8 @@ def gen_instruction_data_impl(fmt):
'pub fn eq(&self, other: &Self, pool: &ir::ValueListPool)' 'pub fn eq(&self, other: &Self, pool: &ir::ValueListPool)'
' -> bool {', ' -> bool {',
'}'): '}'):
with fmt.indented('if ::std::mem::discriminant(self) != ' with fmt.indented('if ::core::mem::discriminant(self) != '
'::std::mem::discriminant(other) {', '}'): '::core::mem::discriminant(other) {', '}'):
fmt.line('return false;') fmt.line('return false;')
with fmt.indented('match (self, other) {', '}'): with fmt.indented('match (self, other) {', '}'):
for f in InstructionFormat.all_formats: for f in InstructionFormat.all_formats:
@@ -301,7 +301,7 @@ def gen_instruction_data_impl(fmt):
hash the contents of any `ValueLists`. hash the contents of any `ValueLists`.
""") """)
with fmt.indented( with fmt.indented(
'pub fn hash<H: ::std::hash::Hasher>' 'pub fn hash<H: ::core::hash::Hasher>'
'(&self, state: &mut H, pool: &ir::ValueListPool) {', '(&self, state: &mut H, pool: &ir::ValueListPool) {',
'}'): '}'):
with fmt.indented('match *self {', '}'): with fmt.indented('match *self {', '}'):
@@ -323,13 +323,13 @@ def gen_instruction_data_impl(fmt):
members.append(field.member) members.append(field.member)
pat = n + ' { ' + ', '.join(members) + ' }' pat = n + ' { ' + ', '.join(members) + ' }'
with fmt.indented(pat + ' => {', '}'): with fmt.indented(pat + ' => {', '}'):
fmt.line('::std::hash::Hash::hash( ' fmt.line('::core::hash::Hash::hash( '
'&::std::mem::discriminant(self), state);') '&::core::mem::discriminant(self), state);')
fmt.line('::std::hash::Hash::hash(&opcode, state);') fmt.line('::core::hash::Hash::hash(&opcode, state);')
for field in f.imm_fields: for field in f.imm_fields:
fmt.line('::std::hash::Hash::hash(&{}, state);' fmt.line('::core::hash::Hash::hash(&{}, state);'
.format(field.member)) .format(field.member))
fmt.line('::std::hash::Hash::hash({}, state);' fmt.line('::core::hash::Hash::hash({}, state);'
.format(args)) .format(args))

View File

@@ -4,7 +4,7 @@
//! `TargetIsa::legalize_signature()` method. //! `TargetIsa::legalize_signature()` method.
use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type}; use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type};
use std::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use std::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

View File

@@ -16,7 +16,7 @@
use super::{Addend, CodeOffset, CodeSink, Reloc}; use super::{Addend, CodeOffset, CodeSink, Reloc};
use crate::ir::{ExternalName, JumpTable, SourceLoc, TrapCode}; use crate::ir::{ExternalName, JumpTable, SourceLoc, TrapCode};
use std::ptr::write_unaligned; use core::ptr::write_unaligned;
/// A `CodeSink` that writes binary machine code directly into memory. /// A `CodeSink` that writes binary machine code directly into memory.
/// ///

View File

@@ -13,7 +13,7 @@ pub use self::shrink::shrink_instructions;
pub use crate::regalloc::RegDiversions; pub use crate::regalloc::RegDiversions;
use crate::ir::{ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode}; use crate::ir::{ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode};
use std::fmt; use core::fmt;
/// Offset in bytes from the beginning of the function. /// Offset in bytes from the beginning of the function.
/// ///

View File

@@ -5,9 +5,9 @@
//! //!
//! If you would like to add support for larger bitsets in the future, you need to change the trait //! If you would like to add support for larger bitsets in the future, you need to change the trait
//! bound Into<u32> and the u32 in the implementation of `max_bits()`. //! bound Into<u32> and the u32 in the implementation of `max_bits()`.
use std::convert::{From, Into}; use core::convert::{From, Into};
use std::mem::size_of; use core::mem::size_of;
use std::ops::{Add, BitOr, Shl, Sub}; use core::ops::{Add, BitOr, Shl, Sub};
/// A small bitset built on a single primitive integer type /// A small bitset built on a single primitive integer type
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]

View File

@@ -1,6 +1,6 @@
//! The `CFGPrinter` utility. //! The `CFGPrinter` utility.
use std::fmt::{Display, Formatter, Result, Write}; use core::fmt::{Display, Formatter, Result, Write};
use crate::flowgraph::{BasicBlock, ControlFlowGraph}; use crate::flowgraph::{BasicBlock, ControlFlowGraph};
use crate::ir::instructions::BranchInfo; use crate::ir::instructions::BranchInfo;

View File

@@ -1,5 +1,5 @@
//! Debug tracing helpers. //! Debug tracing helpers.
use std::fmt; use core::fmt;
/// Prefix added to the log file names, just before the thread name or id. /// Prefix added to the log file names, just before the thread name or id.
pub static LOG_FILENAME_PREFIX: &str = "cranelift.dbg."; pub static LOG_FILENAME_PREFIX: &str = "cranelift.dbg.";

View File

@@ -6,9 +6,9 @@ use crate::ir::instructions::BranchInfo;
use crate::ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value}; use crate::ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
use crate::timing; use crate::timing;
use std::cmp; use core::cmp;
use std::cmp::Ordering; use core::cmp::Ordering;
use std::mem; use core::mem;
use std::vec::Vec; use std::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

View File

@@ -28,7 +28,7 @@ use crate::entity::SecondaryMap;
use crate::ir::instructions::BranchInfo; use crate::ir::instructions::BranchInfo;
use crate::ir::{Ebb, Function, Inst}; use crate::ir::{Ebb, Function, Inst};
use crate::timing; use crate::timing;
use std::mem; use core::mem;
/// A basic block denoted by its enclosing Ebb and last instruction. /// A basic block denoted by its enclosing Ebb and last instruction.
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]

View File

@@ -10,10 +10,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::collections::{HashMap, HashSet}; use super::{HashMap, HashSet};
use std::default::Default; use core::default::Default;
use std::hash::{BuildHasherDefault, Hash, Hasher}; use core::hash::{BuildHasherDefault, Hash, Hasher};
use std::ops::BitXor; use core::ops::BitXor;
pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>; pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
pub type FxHashSet<V> = HashSet<V, BuildHasherDefault<FxHasher>>; pub type FxHashSet<V> = HashSet<V, BuildHasherDefault<FxHasher>>;

View File

@@ -59,7 +59,7 @@ pub trait InstInserterBase<'f>: Sized {
fn insert_built_inst(self, inst: Inst, ctrl_typevar: Type) -> &'f mut DataFlowGraph; fn insert_built_inst(self, inst: Inst, ctrl_typevar: Type) -> &'f mut DataFlowGraph;
} }
use std::marker::PhantomData; use core::marker::PhantomData;
/// Builder that inserts an instruction at the current position. /// Builder that inserts an instruction at the current position.
/// ///

View File

@@ -4,8 +4,8 @@
//! are different rules for comparing integers and floating point numbers, so they use different //! are different rules for comparing integers and floating point numbers, so they use different
//! condition codes. //! condition codes.
use std::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use std::str::FromStr; use core::str::FromStr;
/// Common traits of condition codes. /// Common traits of condition codes.
pub trait CondCode: Copy { pub trait CondCode: Copy {

View File

@@ -10,11 +10,11 @@ use crate::ir::{Ebb, FuncRef, Inst, SigRef, Signature, Type, Value, ValueList, V
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use crate::packed_option::ReservedValue; use crate::packed_option::ReservedValue;
use crate::write::write_operands; use crate::write::write_operands;
use std::fmt; use core::fmt;
use std::iter; use core::iter;
use std::mem; use core::mem;
use std::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use std::u16; use core::u16;
/// 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

View File

@@ -20,8 +20,8 @@
//! format. //! format.
use crate::entity::entity_impl; use crate::entity::entity_impl;
use std::fmt; use core::fmt;
use std::u32; use core::u32;
/// An opaque reference to an extended basic block in a function. /// An opaque reference to an extended basic block in a function.
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
@@ -305,8 +305,8 @@ impl From<Table> for AnyEntity {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use core::u32;
use std::string::ToString; use std::string::ToString;
use std::u32;
#[test] #[test]
fn value_with_number() { fn value_with_number() {
@@ -320,7 +320,7 @@ mod tests {
#[test] #[test]
fn memory() { fn memory() {
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
use std::mem; use core::mem;
// This is the whole point of `PackedOption`. // This is the whole point of `PackedOption`.
assert_eq!( assert_eq!(
mem::size_of::<Value>(), mem::size_of::<Value>(),

View File

@@ -7,8 +7,8 @@
use crate::ir::{ArgumentLoc, ExternalName, SigRef, Type}; use crate::ir::{ArgumentLoc, ExternalName, SigRef, Type};
use crate::isa::{CallConv, RegInfo, RegUnit}; use crate::isa::{CallConv, RegInfo, RegUnit};
use std::fmt; use core::fmt;
use std::str::FromStr; use core::str::FromStr;
use std::vec::Vec; use std::vec::Vec;
/// Function signature. /// Function signature.

View File

@@ -5,9 +5,9 @@
//! Cranelift, which compiles functions independently. //! Cranelift, which compiles functions independently.
use crate::ir::LibCall; use crate::ir::LibCall;
use std::cmp; use core::cmp;
use std::fmt::{self, Write}; use core::fmt::{self, Write};
use std::str::FromStr; use core::str::FromStr;
const TESTCASE_NAME_LENGTH: usize = 16; const TESTCASE_NAME_LENGTH: usize = 16;
@@ -120,8 +120,8 @@ impl FromStr for ExternalName {
mod tests { mod tests {
use super::ExternalName; use super::ExternalName;
use crate::ir::LibCall; use crate::ir::LibCall;
use core::u32;
use std::string::ToString; use std::string::ToString;
use std::u32;
#[test] #[test]
fn display_testcase() { fn display_testcase() {

View File

@@ -16,7 +16,7 @@ use crate::ir::{JumpTableOffsets, JumpTables};
use crate::isa::{CallConv, EncInfo, Encoding, Legalize, TargetIsa}; use crate::isa::{CallConv, EncInfo, Encoding, Legalize, TargetIsa};
use crate::regalloc::RegDiversions; use crate::regalloc::RegDiversions;
use crate::write::write_function; use crate::write::write_function;
use std::fmt; use core::fmt;
/// A function. /// A function.
/// ///

View File

@@ -3,7 +3,7 @@
use crate::ir::immediates::{Imm64, Offset32}; use crate::ir::immediates::{Imm64, Offset32};
use crate::ir::{ExternalName, GlobalValue, Type}; use crate::ir::{ExternalName, GlobalValue, Type};
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use std::fmt; use core::fmt;
/// Information about a global value declaration. /// Information about a global value declaration.
#[derive(Clone)] #[derive(Clone)]

View File

@@ -2,7 +2,7 @@
use crate::ir::immediates::Uimm64; use crate::ir::immediates::Uimm64;
use crate::ir::{GlobalValue, Type}; use crate::ir::{GlobalValue, Type};
use std::fmt; use core::fmt;
/// Information about a heap declaration. /// Information about a heap declaration.
#[derive(Clone)] #[derive(Clone)]

View File

@@ -4,10 +4,10 @@
//! Each type here should have a corresponding definition in the `cranelift.immediates` Python //! Each type here should have a corresponding definition in the `cranelift.immediates` Python
//! module in the meta language. //! module in the meta language.
use std::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use std::mem; use core::mem;
use std::str::FromStr; use core::str::FromStr;
use std::{i32, u32}; use core::{i32, u32};
/// 64-bit immediate signed integer operand. /// 64-bit immediate signed integer operand.
/// ///
@@ -729,10 +729,10 @@ impl FromStr for Ieee64 {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::fmt::Display; use core::fmt::Display;
use std::str::FromStr; use core::str::FromStr;
use core::{f32, f64};
use std::string::ToString; use std::string::ToString;
use std::{f32, f64};
#[test] #[test]
fn format_imm64() { fn format_imm64() {

View File

@@ -6,9 +6,9 @@
//! A large part of this module is auto-generated from the instruction descriptions in the meta //! A large part of this module is auto-generated from the instruction descriptions in the meta
//! directory. //! directory.
use std::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use std::ops::{Deref, DerefMut}; use core::ops::{Deref, DerefMut};
use std::str::FromStr; use core::str::FromStr;
use std::vec::Vec; use std::vec::Vec;
use crate::ir; use crate::ir;
@@ -561,7 +561,7 @@ mod tests {
#[test] #[test]
fn opcodes() { fn opcodes() {
use std::mem; use core::mem;
let x = Opcode::Iadd; let x = Opcode::Iadd;
let mut y = Opcode::Isub; let mut y = Opcode::Isub;
@@ -590,7 +590,7 @@ mod tests {
#[test] #[test]
fn instruction_data() { fn instruction_data() {
use std::mem; use core::mem;
// The size of the `InstructionData` enum is important for performance. It should not // The size of the `InstructionData` enum is important for performance. It should not
// exceed 16 bytes. Use `Box<FooData>` out-of-line payloads for instruction formats that // exceed 16 bytes. Use `Box<FooData>` out-of-line payloads for instruction formats that
// require more space than that. It would be fine with a data structure smaller than 16 // require more space than that. It would be fine with a data structure smaller than 16

View File

@@ -4,8 +4,8 @@
//! The actual table of destinations is stored in a `JumpTableData` struct defined in this module. //! The actual table of destinations is stored in a `JumpTableData` struct defined in this module.
use crate::ir::entities::Ebb; use crate::ir::entities::Ebb;
use std::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use std::slice::{Iter, IterMut}; use core::slice::{Iter, IterMut};
use std::vec::Vec; use std::vec::Vec;
/// Contents of a jump table. /// Contents of a jump table.

View File

@@ -8,9 +8,9 @@ use crate::ir::progpoint::{ExpandedProgramPoint, ProgramOrder};
use crate::ir::{Ebb, Inst}; use crate::ir::{Ebb, Inst};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
use crate::timing; use crate::timing;
use core::cmp;
use core::iter::{IntoIterator, Iterator};
use log::debug; use log::debug;
use std::cmp;
use std::iter::{IntoIterator, Iterator};
/// The `Layout` struct determines the layout of EBBs and instructions in a function. It does not /// The `Layout` struct determines the layout of EBBs and instructions in a function. It does not
/// contain definitions of instructions or EBBs, but depends on `Inst` and `Ebb` entity references /// contain definitions of instructions or EBBs, but depends on `Inst` and `Ebb` entity references
@@ -745,7 +745,7 @@ mod tests {
use crate::cursor::{Cursor, CursorPosition}; use crate::cursor::{Cursor, CursorPosition};
use crate::entity::EntityRef; use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc}; use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc};
use std::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use std::vec::Vec;
struct LayoutCursor<'f> { struct LayoutCursor<'f> {

View File

@@ -5,8 +5,8 @@ use crate::ir::{
Signature, Type, Signature, Type,
}; };
use crate::isa::{CallConv, RegUnit, TargetIsa}; use crate::isa::{CallConv, RegUnit, TargetIsa};
use std::fmt; use core::fmt;
use std::str::FromStr; use core::str::FromStr;
/// The name of a runtime library routine. /// The name of a runtime library routine.
/// ///

View File

@@ -1,6 +1,6 @@
//! Memory operation flags. //! Memory operation flags.
use std::fmt; use core::fmt;
enum FlagBit { enum FlagBit {
Notrap, Notrap,

View File

@@ -2,9 +2,9 @@
use crate::entity::EntityRef; use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst, ValueDef}; use crate::ir::{Ebb, Inst, ValueDef};
use std::cmp; use core::cmp;
use std::fmt; use core::fmt;
use std::u32; use core::u32;
/// A `ProgramPoint` represents a position in a function where the live range of an SSA value can /// A `ProgramPoint` represents a position in a function where the live range of an SSA value can
/// begin or end. It can be either: /// begin or end. It can be either:

View File

@@ -3,7 +3,7 @@
//! Cranelift tracks the original source location of each instruction, and preserves the source //! Cranelift tracks the original source location of each instruction, and preserves the source
//! location when instructions are transformed. //! location when instructions are transformed.
use std::fmt; use core::fmt;
/// A source location. /// A source location.
/// ///

View File

@@ -6,11 +6,11 @@
use crate::entity::{Iter, IterMut, Keys, PrimaryMap}; use crate::entity::{Iter, IterMut, Keys, PrimaryMap};
use crate::ir::{StackSlot, Type}; use crate::ir::{StackSlot, Type};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
use std::cmp; use core::cmp;
use std::fmt; use core::fmt;
use std::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use std::slice; use core::slice;
use std::str::FromStr; use core::str::FromStr;
use std::vec::Vec; use std::vec::Vec;
/// The size of an object on the stack, or the size of a stack frame. /// The size of an object on the stack, or the size of a stack frame.

View File

@@ -2,7 +2,7 @@
use crate::ir::immediates::Uimm64; use crate::ir::immediates::Uimm64;
use crate::ir::{GlobalValue, Type}; use crate::ir::{GlobalValue, Type};
use std::fmt; use core::fmt;
/// Information about a table declaration. /// Information about a table declaration.
#[derive(Clone)] #[derive(Clone)]

View File

@@ -1,7 +1,7 @@
//! Trap codes describing the reason for a trap. //! Trap codes describing the reason for a trap.
use std::fmt::{self, Display, Formatter}; use core::fmt::{self, Display, Formatter};
use std::str::FromStr; use core::str::FromStr;
/// A trap code describing the reason for a trap. /// A trap code describing the reason for a trap.
/// ///

View File

@@ -1,7 +1,7 @@
//! Common types for the Cranelift code generator. //! Common types for the Cranelift code generator.
use std::default::Default; use core::default::Default;
use std::fmt::{self, Debug, Display, Formatter}; use core::fmt::{self, Debug, Display, Formatter};
use target_lexicon::{PointerWidth, Triple}; use target_lexicon::{PointerWidth, Triple};
/// The type of an SSA value. /// The type of an SSA value.

View File

@@ -5,7 +5,7 @@
use crate::ir::StackSlot; use crate::ir::StackSlot;
use crate::isa::{RegInfo, RegUnit}; use crate::isa::{RegInfo, RegUnit};
use std::fmt; use core::fmt;
/// Value location. /// Value location.
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]

View File

@@ -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::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 std::boxed::Box; use std::boxed::Box;
use std::fmt;
use target_lexicon::{Architecture, Triple}; use target_lexicon::{Architecture, Triple};
#[allow(dead_code)] #[allow(dead_code)]

View File

@@ -1,7 +1,7 @@
//! ARM32 Settings. //! ARM32 Settings.
use crate::settings::{self, detail, Builder}; use crate::settings::{self, detail, Builder};
use std::fmt; use core::fmt;
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public // Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
// `Flags` struct with an impl for all of the settings defined in // `Flags` struct with an impl for all of the settings defined in

View File

@@ -15,8 +15,8 @@ use crate::isa::enc_tables::{lookup_enclist, Encodings};
use crate::isa::Builder as IsaBuilder; 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 std::boxed::Box; use std::boxed::Box;
use std::fmt;
use target_lexicon::Triple; use target_lexicon::Triple;
#[allow(dead_code)] #[allow(dead_code)]

View File

@@ -1,7 +1,7 @@
//! ARM64 Settings. //! ARM64 Settings.
use crate::settings::{self, detail, Builder}; use crate::settings::{self, detail, Builder};
use std::fmt; use core::fmt;
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public // Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
// `Flags` struct with an impl for all of the settings defined in // `Flags` struct with an impl for all of the settings defined in

View File

@@ -1,5 +1,5 @@
use std::fmt; use core::fmt;
use std::str; use core::str;
use target_lexicon::{CallingConvention, Triple}; use target_lexicon::{CallingConvention, Triple};
/// Calling convention identifiers. /// Calling convention identifiers.

View File

@@ -7,7 +7,7 @@ use crate::constant_hash::{probe, Table};
use crate::ir::{Function, InstructionData, Opcode, Type}; use crate::ir::{Function, InstructionData, Opcode, Type};
use crate::isa::{Encoding, Legalize}; use crate::isa::{Encoding, Legalize};
use crate::settings::PredicateView; use crate::settings::PredicateView;
use std::ops::Range; use core::ops::Range;
/// A recipe predicate. /// A recipe predicate.
/// ///

View File

@@ -4,7 +4,7 @@ use crate::binemit::CodeOffset;
use crate::ir::{Function, Inst}; use crate::ir::{Function, Inst};
use crate::isa::constraints::{BranchRange, RecipeConstraints}; use crate::isa::constraints::{BranchRange, RecipeConstraints};
use crate::regalloc::RegDiversions; use crate::regalloc::RegDiversions;
use std::fmt; use core::fmt;
/// Bits needed to encode an instruction as binary machine code. /// Bits needed to encode an instruction as binary machine code.
/// ///

View File

@@ -63,9 +63,9 @@ use crate::result::CodegenResult;
use crate::settings; use crate::settings;
use crate::settings::SetResult; use crate::settings::SetResult;
use crate::timing; use crate::timing;
use core::fmt;
use failure_derive::Fail; use failure_derive::Fail;
use std::boxed::Box; use std::boxed::Box;
use std::fmt;
use target_lexicon::{Architecture, PointerWidth, Triple}; use target_lexicon::{Architecture, PointerWidth, Triple};
#[cfg(build_riscv)] #[cfg(build_riscv)]

View File

@@ -1,7 +1,7 @@
//! Data structures describing the registers in an ISA. //! Data structures describing the registers in an ISA.
use crate::entity::EntityRef; use crate::entity::EntityRef;
use std::fmt; use core::fmt;
/// Register units are the smallest units of register allocation. /// Register units are the smallest units of register allocation.
/// ///

View File

@@ -11,7 +11,7 @@ use crate::abi::{legalize_args, ArgAction, ArgAssigner, ValueConversion};
use crate::ir::{self, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, Type}; use crate::ir::{self, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, Type};
use crate::isa::RegClass; use crate::isa::RegClass;
use crate::regalloc::RegisterSet; use crate::regalloc::RegisterSet;
use std::i32; use core::i32;
use target_lexicon::Triple; use target_lexicon::Triple;
struct Args { struct Args {

View File

@@ -5,7 +5,7 @@ use crate::ir::{Function, Inst, InstructionData};
use crate::isa::{RegUnit, StackBaseMask, StackRef}; use crate::isa::{RegUnit, StackBaseMask, StackRef};
use crate::predicates::is_signed_int; use crate::predicates::is_signed_int;
use crate::regalloc::RegDiversions; use crate::regalloc::RegDiversions;
use std::u32; use core::u32;
include!(concat!(env!("OUT_DIR"), "/binemit-riscv.rs")); include!(concat!(env!("OUT_DIR"), "/binemit-riscv.rs"));

View File

@@ -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::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 std::boxed::Box; use std::boxed::Box;
use std::fmt;
use target_lexicon::{PointerWidth, Triple}; use target_lexicon::{PointerWidth, Triple};
#[allow(dead_code)] #[allow(dead_code)]
@@ -129,7 +129,7 @@ mod tests {
use crate::ir::{Function, InstructionData, Opcode}; use crate::ir::{Function, InstructionData, Opcode};
use crate::isa; use crate::isa;
use crate::settings::{self, Configurable}; use crate::settings::{self, Configurable};
use std::str::FromStr; use core::str::FromStr;
use std::string::{String, ToString}; use std::string::{String, ToString};
use target_lexicon::triple; use target_lexicon::triple;

View File

@@ -1,7 +1,7 @@
//! RISC-V Settings. //! RISC-V Settings.
use crate::settings::{self, detail, Builder}; use crate::settings::{self, detail, Builder};
use std::fmt; use core::fmt;
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public // Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
// `Flags` struct with an impl for all of the settings defined in // `Flags` struct with an impl for all of the settings defined in

View File

@@ -14,7 +14,7 @@ use crate::isa::{CallConv, RegClass, RegUnit, TargetIsa};
use crate::regalloc::RegisterSet; use crate::regalloc::RegisterSet;
use crate::result::CodegenResult; use crate::result::CodegenResult;
use crate::stack_layout::layout_stack; use crate::stack_layout::layout_stack;
use std::i32; use core::i32;
use target_lexicon::{PointerWidth, Triple}; use target_lexicon::{PointerWidth, Triple};
/// Argument registers for x86-64 /// Argument registers for x86-64

View File

@@ -17,8 +17,8 @@ use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use crate::regalloc; use crate::regalloc;
use crate::result::CodegenResult; use crate::result::CodegenResult;
use crate::timing; use crate::timing;
use core::fmt;
use std::boxed::Box; use std::boxed::Box;
use std::fmt;
use target_lexicon::{PointerWidth, Triple}; use target_lexicon::{PointerWidth, Triple};
#[allow(dead_code)] #[allow(dead_code)]

View File

@@ -1,7 +1,7 @@
//! x86 Settings. //! x86 Settings.
use crate::settings::{self, detail, Builder}; use crate::settings::{self, detail, Builder};
use std::fmt; use core::fmt;
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public // Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
// `Flags` struct with an impl for all of the settings defined in // `Flags` struct with an impl for all of the settings defined in

View File

@@ -67,7 +67,7 @@
use crate::cursor::{Cursor, CursorPosition, FuncCursor}; use crate::cursor::{Cursor, CursorPosition, FuncCursor};
use crate::flowgraph::{BasicBlock, ControlFlowGraph}; 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 std::iter; use core::iter;
use std::vec::Vec; use std::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

View File

@@ -40,15 +40,20 @@
clippy::use_self clippy::use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. #![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))] #![cfg_attr(not(feature = "std"), feature(alloc))]
// TODO: Remove this workaround once https://github.com/rust-lang/rust/issues/27747 is done.
#![cfg_attr(not(feature = "std"), feature(slice_concat_ext))]
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
#[macro_use] #[macro_use]
extern crate alloc; extern crate alloc as std;
#[cfg(feature = "std")]
#[macro_use]
extern crate std;
#[cfg(not(feature = "std"))]
use hashmap_core::{map as hash_map, HashMap, HashSet};
#[cfg(feature = "std")]
use std::collections::{hash_map, HashMap, HashSet};
pub use crate::context::Context; pub use crate::context::Context;
pub use crate::legalizer::legalize_function; pub use crate::legalizer::legalize_function;
@@ -101,20 +106,5 @@ mod unreachable_code;
pub use crate::result::{CodegenError, CodegenResult}; pub use crate::result::{CodegenError, CodegenResult};
/// This replaces `std` in builds with `core`.
#[cfg(not(feature = "std"))]
mod std {
pub use alloc::{boxed, slice, string, vec};
pub use core::*;
pub mod collections {
#[allow(unused_extern_crates)]
extern crate hashmap_core;
pub use self::hashmap_core::map as hash_map;
pub use self::hashmap_core::{HashMap, HashSet};
pub use alloc::collections::BTreeSet;
}
}
/// Version number of this crate. /// Version number of this crate.
pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const VERSION: &str = env!("CARGO_PKG_VERSION");

View File

@@ -1,6 +1,6 @@
//! Rearrange the elements in a slice according to a predicate. //! Rearrange the elements in a slice according to a predicate.
use std::mem; use core::mem;
/// Rearrange the elements of the mutable slice `s` such that elements where `p(t)` is true precede /// Rearrange the elements of the mutable slice `s` such that elements where `p(t)` is true precede
/// the elements where `p(t)` is false. /// the elements where `p(t)` is false.

View File

@@ -8,9 +8,9 @@ use crate::isa::TargetIsa;
use crate::result::CodegenError; use crate::result::CodegenError;
use crate::verifier::{VerifierError, VerifierErrors}; 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::Write;
use std::boxed::Box; use std::boxed::Box;
use std::fmt;
use std::fmt::Write;
use std::string::{String, ToString}; use std::string::{String, ToString};
use std::vec::Vec; use std::vec::Vec;

View File

@@ -7,7 +7,7 @@
//! //!
//! Despite their using an unsafe block, these functions are completely safe. //! Despite their using an unsafe block, these functions are completely safe.
use std::slice; use core::slice;
pub fn ref_slice<T>(s: &T) -> &[T] { pub fn ref_slice<T>(s: &T) -> &[T] {
unsafe { slice::from_raw_parts(s, 1) } unsafe { slice::from_raw_parts(s, 1) }

View File

@@ -10,7 +10,7 @@
use crate::ir::{AbiParam, ArgumentLoc}; use crate::ir::{AbiParam, ArgumentLoc};
use crate::isa::{ConstraintKind, OperandConstraint, RegClassIndex, RegInfo, TargetIsa}; use crate::isa::{ConstraintKind, OperandConstraint, RegClassIndex, RegInfo, TargetIsa};
use std::fmt; use core::fmt;
/// Preferred register allocation for an SSA value. /// Preferred register allocation for an SSA value.
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]

View File

@@ -17,11 +17,11 @@ use crate::regalloc::affinity::Affinity;
use crate::regalloc::liveness::Liveness; use crate::regalloc::liveness::Liveness;
use crate::regalloc::virtregs::{VirtReg, VirtRegs}; use crate::regalloc::virtregs::{VirtReg, VirtRegs};
use crate::timing; use crate::timing;
use core::cmp;
use core::fmt;
use core::iter;
use core::slice;
use log::debug; use log::debug;
use std::cmp;
use std::fmt;
use std::iter;
use std::slice;
use std::vec::Vec; use std::vec::Vec;
// # Implementation // # Implementation

View File

@@ -57,8 +57,8 @@ use crate::regalloc::register_set::RegisterSet;
use crate::regalloc::solver::{Solver, SolverError}; use crate::regalloc::solver::{Solver, SolverError};
use crate::regalloc::RegDiversions; use crate::regalloc::RegDiversions;
use crate::timing; use crate::timing;
use core::mem;
use log::debug; use log::debug;
use std::mem;
/// Data structures for the coloring pass. /// Data structures for the coloring pass.
/// ///

View File

@@ -8,11 +8,11 @@
//! EBB. //! EBB.
use crate::fx::FxHashMap; use crate::fx::FxHashMap;
use crate::hash_map::{Entry, Iter};
use crate::ir::{InstructionData, Opcode}; use crate::ir::{InstructionData, Opcode};
use crate::ir::{StackSlot, Value, ValueLoc, ValueLocations}; use crate::ir::{StackSlot, Value, ValueLoc, ValueLocations};
use crate::isa::{RegInfo, RegUnit}; use crate::isa::{RegInfo, RegUnit};
use std::collections::hash_map::{Entry, Iter}; use core::fmt;
use std::fmt;
/// A diversion of a value from its original location to a new register or stack location. /// A diversion of a value from its original location to a new register or stack location.
/// ///

View File

@@ -183,8 +183,8 @@ use crate::isa::{EncInfo, OperandConstraint, TargetIsa};
use crate::regalloc::affinity::Affinity; use crate::regalloc::affinity::Affinity;
use crate::regalloc::liverange::{LiveRange, LiveRangeContext, LiveRangeForest}; use crate::regalloc::liverange::{LiveRange, LiveRangeContext, LiveRangeForest};
use crate::timing; use crate::timing;
use std::mem; use core::mem;
use std::ops::Index; use core::ops::Index;
use std::vec::Vec; use std::vec::Vec;
/// A set of live ranges, indexed by value number. /// A set of live ranges, indexed by value number.

View File

@@ -111,8 +111,8 @@ use crate::bforest;
use crate::entity::SparseMapValue; use crate::entity::SparseMapValue;
use crate::ir::{Ebb, ExpandedProgramPoint, Inst, Layout, ProgramOrder, ProgramPoint, Value}; use crate::ir::{Ebb, ExpandedProgramPoint, Inst, Layout, ProgramOrder, ProgramPoint, Value};
use crate::regalloc::affinity::Affinity; use crate::regalloc::affinity::Affinity;
use std::cmp::Ordering; use core::cmp::Ordering;
use std::marker::PhantomData; use core::marker::PhantomData;
/// Global live range of a single SSA value. /// Global live range of a single SSA value.
/// ///
@@ -461,7 +461,7 @@ mod tests {
use crate::entity::EntityRef; use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst, Value}; use crate::ir::{Ebb, Inst, Value};
use crate::ir::{ExpandedProgramPoint, ProgramOrder}; use crate::ir::{ExpandedProgramPoint, ProgramOrder};
use std::cmp::Ordering; use core::cmp::Ordering;
use std::vec::Vec; use std::vec::Vec;
// Dummy program order which simply compares indexes. // Dummy program order which simply compares indexes.

View File

@@ -38,9 +38,9 @@
use crate::isa::registers::{RegClass, RegClassMask, RegInfo, MAX_TRACKED_TOPRCS}; use crate::isa::registers::{RegClass, RegClassMask, RegInfo, MAX_TRACKED_TOPRCS};
use crate::regalloc::RegisterSet; use crate::regalloc::RegisterSet;
use std::cmp::min; use core::cmp::min;
use std::fmt; use core::fmt;
use std::iter::ExactSizeIterator; use core::iter::ExactSizeIterator;
/// Information per top-level register class. /// Information per top-level register class.
/// ///
@@ -275,9 +275,9 @@ mod tests {
use super::Pressure; use super::Pressure;
use crate::isa::{RegClass, TargetIsa}; use crate::isa::{RegClass, TargetIsa};
use crate::regalloc::RegisterSet; use crate::regalloc::RegisterSet;
use std::borrow::Borrow; use core::borrow::Borrow;
use core::str::FromStr;
use std::boxed::Box; use std::boxed::Box;
use std::str::FromStr;
use target_lexicon::triple; use target_lexicon::triple;
// Make an arm32 `TargetIsa`, if possible. // Make an arm32 `TargetIsa`, if possible.

View File

@@ -6,10 +6,10 @@
//! share a register unit can't be in use at the same time. //! share a register unit can't be in use at the same time.
use crate::isa::registers::{RegClass, RegInfo, RegUnit, RegUnitMask}; use crate::isa::registers::{RegClass, RegInfo, RegUnit, RegUnitMask};
use std::char; use core::char;
use std::fmt; use core::fmt;
use std::iter::ExactSizeIterator; use core::iter::ExactSizeIterator;
use std::mem::size_of_val; use core::mem::size_of_val;
/// Set of registers available for allocation. /// Set of registers available for allocation.
#[derive(Clone)] #[derive(Clone)]

View File

@@ -104,11 +104,11 @@ use crate::entity::{SparseMap, SparseMapValue};
use crate::ir::Value; use crate::ir::Value;
use crate::isa::{RegClass, RegUnit}; use crate::isa::{RegClass, RegUnit};
use crate::regalloc::register_set::RegSetIter; use crate::regalloc::register_set::RegSetIter;
use core::cmp;
use core::fmt;
use core::mem;
use core::u16;
use log::debug; use log::debug;
use std::cmp;
use std::fmt;
use std::mem;
use std::u16;
use std::vec::Vec; use std::vec::Vec;
/// A variable in the constraint problem. /// A variable in the constraint problem.
@@ -1134,8 +1134,8 @@ mod tests {
use crate::ir::Value; use crate::ir::Value;
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 std::boxed::Box; use std::boxed::Box;
use std::str::FromStr;
use target_lexicon::triple; use target_lexicon::triple;
// Make an arm32 `TargetIsa`, if possible. // Make an arm32 `TargetIsa`, if possible.

View File

@@ -27,8 +27,8 @@ use crate::regalloc::pressure::Pressure;
use crate::regalloc::virtregs::VirtRegs; use crate::regalloc::virtregs::VirtRegs;
use crate::timing; use crate::timing;
use crate::topo_order::TopoOrder; use crate::topo_order::TopoOrder;
use core::fmt;
use log::debug; use log::debug;
use std::fmt;
use std::vec::Vec; use std::vec::Vec;
/// Return a top-level register class which contains `unit`. /// Return a top-level register class which contains `unit`.

View File

@@ -19,8 +19,8 @@ use crate::entity::{Keys, PrimaryMap, SecondaryMap};
use crate::ir::{Function, Value}; use crate::ir::{Function, Value};
use crate::packed_option::PackedOption; use crate::packed_option::PackedOption;
use crate::ref_slice::ref_slice; use crate::ref_slice::ref_slice;
use std::cmp::Ordering; use core::cmp::Ordering;
use std::fmt; use core::fmt;
use std::vec::Vec; use std::vec::Vec;
/// A virtual register reference. /// A virtual register reference.

View File

@@ -1,13 +1,12 @@
//! `ScopedHashMap` //! `ScopedHashMap`
//! //!
//! This module defines a struct `ScopedHashMap<K, V>` which defines a `HashMap`-like //! This module defines a struct `ScopedHashMap<K, V>` which defines a `FxHashMap`-like
//! container that has a concept of scopes that can be entered and exited, such that //! container that has a concept of scopes that can be entered and exited, such that
//! values inserted while inside a scope aren't visible outside the scope. //! values inserted while inside a scope aren't visible outside the scope.
use crate::fx::FxHashMap; use crate::fx::FxHashMap;
use std::collections::hash_map; use core::hash::Hash;
use std::hash::Hash; use core::mem;
use std::mem;
struct Val<K, V> { struct Val<K, V> {
value: V, value: V,
@@ -17,7 +16,7 @@ struct Val<K, V> {
/// A view into an occupied entry in a `ScopedHashMap`. It is part of the `Entry` enum. /// A view into an occupied entry in a `ScopedHashMap`. It is part of the `Entry` enum.
pub struct OccupiedEntry<'a, K: 'a, V: 'a> { pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
entry: hash_map::OccupiedEntry<'a, K, Val<K, V>>, entry: super::hash_map::OccupiedEntry<'a, K, Val<K, V>>,
} }
impl<'a, K, V> OccupiedEntry<'a, K, V> { impl<'a, K, V> OccupiedEntry<'a, K, V> {
@@ -29,7 +28,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
/// A view into a vacant entry in a `ScopedHashMap`. It is part of the `Entry` enum. /// A view into a vacant entry in a `ScopedHashMap`. It is part of the `Entry` enum.
pub struct VacantEntry<'a, K: 'a, V: 'a> { pub struct VacantEntry<'a, K: 'a, V: 'a> {
entry: hash_map::VacantEntry<'a, K, Val<K, V>>, entry: super::hash_map::VacantEntry<'a, K, Val<K, V>>,
next_key: Option<K>, next_key: Option<K>,
depth: usize, depth: usize,
} }
@@ -53,7 +52,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
Vacant(VacantEntry<'a, K, V>), Vacant(VacantEntry<'a, K, V>),
} }
/// A wrapper around a `HashMap` which adds the concept of scopes. Items inserted /// A wrapper around a `FxHashMap` which adds the concept of scopes. Items inserted
/// within a scope are removed when the scope is exited. /// within a scope are removed when the scope is exited.
/// ///
/// Shadowing, where one scope has entries with the same keys as a containing scope, /// Shadowing, where one scope has entries with the same keys as a containing scope,
@@ -77,10 +76,10 @@ where
} }
} }
/// Similar to `HashMap::entry`, gets the given key's corresponding entry in the map for /// Similar to `FxHashMap::entry`, gets the given key's corresponding entry in the map for
/// in-place manipulation. /// in-place manipulation.
pub fn entry(&mut self, key: K) -> Entry<K, V> { pub fn entry(&mut self, key: K) -> Entry<K, V> {
use self::hash_map::Entry::*; use super::hash_map::Entry::*;
match self.map.entry(key) { match self.map.entry(key) {
Occupied(entry) => Entry::Occupied(OccupiedEntry { entry }), Occupied(entry) => Entry::Occupied(OccupiedEntry { entry }),
Vacant(entry) => { Vacant(entry) => {
@@ -104,7 +103,7 @@ where
pub fn decrement_depth(&mut self) { pub fn decrement_depth(&mut self) {
// Remove all elements inserted at the current depth. // Remove all elements inserted at the current depth.
while let Some(key) = self.last_insert.clone() { while let Some(key) = self.last_insert.clone() {
use self::hash_map::Entry::*; use crate::hash_map::Entry::*;
match self.map.entry(key) { match self.map.entry(key) {
Occupied(entry) => { Occupied(entry) => {
if entry.get().depth != self.current_depth { if entry.get().depth != self.current_depth {

View File

@@ -22,16 +22,12 @@
use crate::constant_hash::{probe, simple_hash}; use crate::constant_hash::{probe, simple_hash};
use crate::isa::TargetIsa; use crate::isa::TargetIsa;
use core::fmt;
use core::str;
use failure_derive::Fail; use failure_derive::Fail;
use std::boxed::Box; use std::boxed::Box;
use std::fmt;
use std::str;
use std::string::{String, ToString}; use std::string::{String, ToString};
// TODO: Remove this workaround once https://github.com/rust-lang/rust/issues/27747 is done.
#[cfg(not(feature = "std"))]
use std::slice::SliceConcatExt;
/// A string-based configurator for settings groups. /// A string-based configurator for settings groups.
/// ///
/// The `Configurable` protocol allows settings to be modified by name before a finished `Flags` /// The `Configurable` protocol allows settings to be modified by name before a finished `Flags`
@@ -111,10 +107,21 @@ fn parse_bool_value(value: &str) -> SetResult<bool> {
fn parse_enum_value(value: &str, choices: &[&str]) -> SetResult<u8> { fn parse_enum_value(value: &str, choices: &[&str]) -> SetResult<u8> {
match choices.iter().position(|&tag| tag == value) { match choices.iter().position(|&tag| tag == value) {
Some(idx) => Ok(idx as u8), Some(idx) => Ok(idx as u8),
None => Err(SetError::BadValue(format!( None => {
"any among {}", // TODO: Use `join` instead of this code, once
choices.join(", ") // https://github.com/rust-lang/rust/issues/27747 is resolved.
))), let mut all_choices = String::new();
let mut first = true;
for choice in choices {
if first {
first = false
} else {
all_choices += ", ";
}
all_choices += choice;
}
Err(SetError::BadValue(format!("any among {}", all_choices)))
}
} }
} }
@@ -204,7 +211,7 @@ impl<'a> PredicateView<'a> {
/// code in other modules. /// code in other modules.
pub mod detail { pub mod detail {
use crate::constant_hash; use crate::constant_hash;
use std::fmt; use core::fmt;
/// An instruction group template. /// An instruction group template.
pub struct Template { pub struct Template {

View File

@@ -5,8 +5,8 @@ use crate::dominator_tree::DominatorTree;
use crate::ir::{Function, Inst, InstructionData, Opcode, Type}; use crate::ir::{Function, Inst, InstructionData, Opcode, Type};
use crate::scoped_hash_map::ScopedHashMap; use crate::scoped_hash_map::ScopedHashMap;
use crate::timing; use crate::timing;
use std::cell::{Ref, RefCell}; use core::cell::{Ref, RefCell};
use std::hash::{Hash, Hasher}; use core::hash::{Hash, Hasher};
use std::vec::Vec; use std::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.

View File

@@ -3,7 +3,7 @@
use crate::ir::stackslot::{StackOffset, StackSize, StackSlotKind}; use crate::ir::stackslot::{StackOffset, StackSize, StackSlotKind};
use crate::ir::StackSlots; use crate::ir::StackSlots;
use crate::result::{CodegenError, CodegenResult}; use crate::result::{CodegenError, CodegenResult};
use std::cmp::{max, min}; use core::cmp::{max, min};
/// Compute the stack frame layout. /// Compute the stack frame layout.
/// ///

View File

@@ -2,7 +2,7 @@
//! //!
//! This modules provides facilities for timing the execution of individual compilation passes. //! This modules provides facilities for timing the execution of individual compilation passes.
use std::fmt; use core::fmt;
pub use self::details::{add_to_current, take_current, PassTimes, TimingToken}; pub use self::details::{add_to_current, take_current, PassTimes, TimingToken};

View File

@@ -94,7 +94,7 @@ mod tests {
use crate::dominator_tree::DominatorTree; use crate::dominator_tree::DominatorTree;
use crate::flowgraph::ControlFlowGraph; use crate::flowgraph::ControlFlowGraph;
use crate::ir::{Function, InstBuilder}; use crate::ir::{Function, InstBuilder};
use std::iter; use core::iter;
#[test] #[test]
fn empty() { fn empty() {

View File

@@ -8,7 +8,7 @@ use crate::regalloc::liveness::Liveness;
use crate::regalloc::liverange::LiveRange; use crate::regalloc::liverange::LiveRange;
use crate::timing; use crate::timing;
use crate::verifier::{VerifierErrors, VerifierStepResult}; use crate::verifier::{VerifierErrors, VerifierStepResult};
use std::cmp::Ordering; use core::cmp::Ordering;
/// Verify liveness information for `func`. /// Verify liveness information for `func`.
/// ///

View File

@@ -72,10 +72,10 @@ use crate::isa::TargetIsa;
use crate::iterators::IteratorExtras; use crate::iterators::IteratorExtras;
use crate::settings::FlagsOrIsa; use crate::settings::FlagsOrIsa;
use crate::timing; use crate::timing;
use core::cmp::Ordering;
use core::fmt::{self, Display, Formatter, Write};
use failure_derive::Fail; use failure_derive::Fail;
use std::cmp::Ordering;
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::fmt::{self, Display, Formatter, Write};
use std::string::String; use std::string::String;
use std::vec::Vec; use std::vec::Vec;

View File

@@ -8,7 +8,7 @@ use crate::ir::entities::AnyEntity;
use crate::ir::{DataFlowGraph, Ebb, Function, Inst, SigRef, Type, Value, ValueDef}; use crate::ir::{DataFlowGraph, Ebb, Function, Inst, SigRef, Type, Value, ValueDef};
use crate::isa::{RegInfo, TargetIsa}; use crate::isa::{RegInfo, TargetIsa};
use crate::packed_option::ReservedValue; use crate::packed_option::ReservedValue;
use std::fmt::{self, Write}; use core::fmt::{self, Write};
use std::string::String; use std::string::String;
use std::vec::Vec; use std::vec::Vec;

View File

@@ -14,6 +14,7 @@ edition = "2018"
[features] [features]
default = ["std"] default = ["std"]
std = [] std = []
core = []
[badges] [badges]
maintenance = { status = "experimental" } maintenance = { status = "experimental" }

View File

@@ -3,9 +3,10 @@
use crate::iter::{Iter, IterMut}; use crate::iter::{Iter, IterMut};
use crate::keys::Keys; use crate::keys::Keys;
use crate::EntityRef; use crate::EntityRef;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use std::slice; use core::slice;
use std::boxed::Box;
/// A slice mapping `K -> V` allocating dense entity references. /// A slice mapping `K -> V` allocating dense entity references.
/// ///
@@ -140,6 +141,7 @@ where
mod tests { mod tests {
use super::*; use super::*;
use crate::primary::PrimaryMap; use crate::primary::PrimaryMap;
use std::vec::Vec;
// `EntityRef` impl for testing. // `EntityRef` impl for testing.
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]

View File

@@ -1,9 +1,9 @@
//! A double-ended iterator over entity references and entities. //! A double-ended iterator over entity references and entities.
use crate::EntityRef; use crate::EntityRef;
use std::iter::Enumerate; use core::iter::Enumerate;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::slice; use core::slice;
/// Iterate over all keys in order. /// Iterate over all keys in order.
pub struct Iter<'a, K: EntityRef, V> pub struct Iter<'a, K: EntityRef, V>

View File

@@ -1,10 +1,10 @@
//! A double-ended iterator over entity references. //! A double-ended iterator over entity references.
//! //!
//! When `std::iter::Step` is stabilized, `Keys` could be implemented as a wrapper around //! When `core::iter::Step` is stabilized, `Keys` could be implemented as a wrapper around
//! `std::ops::Range`, but for now, we implement it manually. //! `core::ops::Range`, but for now, we implement it manually.
use crate::EntityRef; use crate::EntityRef;
use std::marker::PhantomData; use core::marker::PhantomData;
/// Iterate over all keys in order. /// Iterate over all keys in order.
pub struct Keys<K: EntityRef> { pub struct Keys<K: EntityRef> {

View File

@@ -50,17 +50,15 @@
clippy::use_self clippy::use_self
) )
)] )]
// Turns on no_std and alloc features if std is not available. #![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))] #![cfg_attr(not(feature = "std"), feature(alloc))]
/// This replaces `std` in builds with `core`.
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
mod std { #[macro_use]
extern crate alloc; extern crate alloc as std;
pub use self::alloc::{boxed, string, vec}; #[cfg(feature = "std")]
pub use core::*; #[macro_use]
} extern crate std;
// Re-export core so that the macros works with both std and no_std crates // Re-export core so that the macros works with both std and no_std crates
#[doc(hidden)] #[doc(hidden)]

View File

@@ -1,8 +1,8 @@
//! Small lists of entity references. //! Small lists of entity references.
use crate::packed_option::ReservedValue; use crate::packed_option::ReservedValue;
use crate::EntityRef; use crate::EntityRef;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::mem; use core::mem;
use std::vec::Vec; use std::vec::Vec;
/// A small list of entity references allocated from a pool. /// A small list of entity references allocated from a pool.

View File

@@ -3,9 +3,9 @@
use crate::iter::{Iter, IterMut}; use crate::iter::{Iter, IterMut};
use crate::keys::Keys; use crate::keys::Keys;
use crate::EntityRef; use crate::EntityRef;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use std::slice; use core::slice;
use std::vec::Vec; use std::vec::Vec;
/// A mapping `K -> V` for densely indexed entity references. /// A mapping `K -> V` for densely indexed entity references.

View File

@@ -7,8 +7,8 @@
//! This module provides a `PackedOption<T>` for types that have a reserved value that can be used //! This module provides a `PackedOption<T>` for types that have a reserved value that can be used
//! to represent `None`. //! to represent `None`.
use std::fmt; use core::fmt;
use std::mem; use core::mem;
/// Types that have a reserved value which can't be created any other way. /// Types that have a reserved value which can't be created any other way.
pub trait ReservedValue: Eq { pub trait ReservedValue: Eq {

View File

@@ -3,10 +3,11 @@ use crate::boxed_slice::BoxedSlice;
use crate::iter::{Iter, IterMut}; use crate::iter::{Iter, IterMut};
use crate::keys::Keys; use crate::keys::Keys;
use crate::EntityRef; use crate::EntityRef;
use std::iter::FromIterator; use core::iter::FromIterator;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use std::slice; use core::slice;
use std::boxed::Box;
use std::vec::Vec; use std::vec::Vec;
/// A primary mapping `K -> V` allocating dense entity references. /// A primary mapping `K -> V` allocating dense entity references.

View File

@@ -2,7 +2,7 @@
use crate::keys::Keys; use crate::keys::Keys;
use crate::EntityRef; use crate::EntityRef;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::vec::Vec; use std::vec::Vec;
/// A set of `K` for densely indexed entity references. /// A set of `K` for densely indexed entity references.
@@ -80,7 +80,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::u32; use core::u32;
// `EntityRef` impl for testing. // `EntityRef` impl for testing.
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]

View File

@@ -9,9 +9,9 @@
use crate::map::SecondaryMap; use crate::map::SecondaryMap;
use crate::EntityRef; use crate::EntityRef;
use std::mem; use core::mem;
use std::slice; use core::slice;
use std::u32; use core::u32;
use std::vec::Vec; use std::vec::Vec;
/// Trait for extracting keys from values stored in a `SparseMap`. /// Trait for extracting keys from values stored in a `SparseMap`.

View File

@@ -608,7 +608,7 @@ impl<'a> FunctionBuilder<'a> {
"`size` is not a power of two" "`size` is not a power of two"
); );
assert!( assert!(
access_size >= u64::from(::std::cmp::min(src_align, dest_align)), access_size >= u64::from(::core::cmp::min(src_align, dest_align)),
"`size` is smaller than `dest` and `src`'s alignment value." "`size` is smaller than `dest` and `src`'s alignment value."
); );
@@ -777,7 +777,7 @@ impl<'a> FunctionBuilder<'a> {
"`size` is not a power of two" "`size` is not a power of two"
); );
assert!( assert!(
access_size >= u64::from(::std::cmp::min(src_align, dest_align)), access_size >= u64::from(::core::cmp::min(src_align, dest_align)),
"`size` is smaller than `dest` and `src`'s alignment value." "`size` is smaller than `dest` and `src`'s alignment value."
); );
let load_and_store_amount = size / access_size; let load_and_store_amount = size / access_size;
@@ -962,8 +962,8 @@ mod tests {
#[test] #[test]
fn memcpy() { fn memcpy() {
use core::str::FromStr;
use cranelift_codegen::{isa, settings}; use cranelift_codegen::{isa, settings};
use std::str::FromStr;
let shared_builder = settings::builder(); let shared_builder = settings::builder();
let shared_flags = settings::Flags::new(shared_builder); let shared_flags = settings::Flags::new(shared_builder);
@@ -1023,8 +1023,8 @@ ebb0:
#[test] #[test]
fn small_memcpy() { fn small_memcpy() {
use core::str::FromStr;
use cranelift_codegen::{isa, settings}; use cranelift_codegen::{isa, settings};
use std::str::FromStr;
let shared_builder = settings::builder(); let shared_builder = settings::builder();
let shared_flags = settings::Flags::new(shared_builder); let shared_flags = settings::Flags::new(shared_builder);

View File

@@ -174,12 +174,20 @@
clippy::use_self clippy::use_self
) )
)] )]
#![cfg_attr(not(feature = "std"), no_std)] #![no_std]
#![cfg_attr(not(feature = "std"), feature(alloc))] #![cfg_attr(not(feature = "std"), feature(alloc))]
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
#[macro_use] #[macro_use]
extern crate alloc; extern crate alloc as std;
#[cfg(feature = "std")]
#[macro_use]
extern crate std;
#[cfg(not(feature = "std"))]
use hashmap_core::HashMap;
#[cfg(feature = "std")]
use std::collections::HashMap;
pub use crate::frontend::{FunctionBuilder, FunctionBuilderContext}; pub use crate::frontend::{FunctionBuilder, FunctionBuilderContext};
pub use crate::switch::Switch; pub use crate::switch::Switch;
@@ -190,19 +198,5 @@ mod ssa;
mod switch; mod switch;
mod variable; mod variable;
/// This replaces `std` in builds with `core`.
#[cfg(not(feature = "std"))]
mod std {
pub use alloc::{string, vec};
pub use core::*;
pub mod collections {
#[allow(unused_extern_crates)]
extern crate hashmap_core;
pub use self::hashmap_core::map as hash_map;
pub use self::hashmap_core::{HashMap, HashSet};
}
}
/// Version number of this crate. /// Version number of this crate.
pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const VERSION: &str = env!("CARGO_PKG_VERSION");

View File

@@ -6,6 +6,8 @@
//! Lecture Notes in Computer Science, vol 7791. Springer, Berlin, Heidelberg //! Lecture Notes in Computer Science, vol 7791. Springer, Berlin, Heidelberg
use crate::Variable; use crate::Variable;
use core::mem;
use core::u32;
use cranelift_codegen::cursor::{Cursor, FuncCursor}; use cranelift_codegen::cursor::{Cursor, FuncCursor};
use cranelift_codegen::entity::{EntityRef, PrimaryMap, SecondaryMap}; use cranelift_codegen::entity::{EntityRef, PrimaryMap, SecondaryMap};
use cranelift_codegen::ir::immediates::{Ieee32, Ieee64}; use cranelift_codegen::ir::immediates::{Ieee32, Ieee64};
@@ -14,8 +16,6 @@ use cranelift_codegen::ir::types::{F32, F64};
use cranelift_codegen::ir::{Ebb, Function, Inst, InstBuilder, InstructionData, Type, Value}; use cranelift_codegen::ir::{Ebb, Function, Inst, InstBuilder, InstructionData, Type, Value};
use cranelift_codegen::packed_option::PackedOption; use cranelift_codegen::packed_option::PackedOption;
use cranelift_codegen::packed_option::ReservedValue; use cranelift_codegen::packed_option::ReservedValue;
use std::mem;
use std::u32;
use std::vec::Vec; use std::vec::Vec;
/// Structure containing the data relevant the construction of SSA for a given function. /// Structure containing the data relevant the construction of SSA for a given function.

View File

@@ -1,8 +1,8 @@
use super::HashMap;
use crate::frontend::FunctionBuilder; use crate::frontend::FunctionBuilder;
use cranelift_codegen::ir::condcodes::IntCC; use cranelift_codegen::ir::condcodes::IntCC;
use cranelift_codegen::ir::*; use cranelift_codegen::ir::*;
use log::debug; use log::debug;
use std::collections::HashMap;
use std::vec::Vec; use std::vec::Vec;
type EntryIndex = u64; type EntryIndex = u64;
@@ -334,7 +334,7 @@ ebb10:
#[test] #[test]
fn switch_min_index_value() { fn switch_min_index_value() {
let func = setup!(0, [::std::i64::MIN as u64, 1,]); let func = setup!(0, [::core::i64::MIN as u64, 1,]);
assert_eq!( assert_eq!(
func, func,
"ebb0: "ebb0:
@@ -350,7 +350,7 @@ ebb10:
#[test] #[test]
fn switch_max_index_value() { fn switch_max_index_value() {
let func = setup!(0, [::std::i64::MAX as u64, 1,]); let func = setup!(0, [::core::i64::MAX as u64, 1,]);
assert_eq!( assert_eq!(
func, func,
"ebb0: "ebb0:

View File

@@ -5,8 +5,8 @@
//! their own index types to use them directly. Frontends which don't //! their own index types to use them directly. Frontends which don't
//! can use the `Variable` defined here. //! can use the `Variable` defined here.
use core::u32;
use cranelift_codegen::entity::EntityRef; use cranelift_codegen::entity::EntityRef;
use std::u32;
///! An opaque reference to a variable. ///! An opaque reference to a variable.
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]

View File

@@ -14,7 +14,7 @@ edition = "2018"
cranelift-codegen = { path = "../codegen", version = "0.26.0", default-features = false } cranelift-codegen = { path = "../codegen", version = "0.26.0", default-features = false }
cranelift-entity = { path = "../entity", version = "0.26.0", default-features = false } cranelift-entity = { path = "../entity", version = "0.26.0", default-features = false }
hashmap_core = { version = "0.1.9", optional = true } hashmap_core = { version = "0.1.9", optional = true }
failure = "0.1.1" failure = { version = "0.1.1", default-features = false }
log = { version = "0.4.6", default-features = false } log = { version = "0.4.6", default-features = false }
[features] [features]

Some files were not shown because too many files have changed in this diff Show More