Update no_std support in cranelift-frontend.
This commit is contained in:
@@ -13,11 +13,12 @@ readme = "README.md"
|
|||||||
cranelift-codegen = { path = "../codegen", version = "0.22.0", default-features = false }
|
cranelift-codegen = { path = "../codegen", version = "0.22.0", default-features = false }
|
||||||
target-lexicon = { version = "0.0.3", default-features = false }
|
target-lexicon = { version = "0.0.3", default-features = false }
|
||||||
log = { version = "0.4.4", default-features = false, features = ["release_max_level_warn"] }
|
log = { version = "0.4.4", default-features = false, features = ["release_max_level_warn"] }
|
||||||
|
hashmap_core = { version = "0.1.9", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["cranelift-codegen/std"]
|
std = ["cranelift-codegen/std"]
|
||||||
core = ["cranelift-codegen/core"]
|
core = ["hashmap_core", "cranelift-codegen/core"]
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "experimental" }
|
maintenance = { status = "experimental" }
|
||||||
|
|||||||
@@ -653,7 +653,6 @@ impl<'a> FunctionBuilder<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use cranelift_codegen::entity::EntityRef;
|
use cranelift_codegen::entity::EntityRef;
|
||||||
use cranelift_codegen::ir::types::*;
|
use cranelift_codegen::ir::types::*;
|
||||||
use cranelift_codegen::ir::{AbiParam, ExternalName, Function, InstBuilder, Signature};
|
use cranelift_codegen::ir::{AbiParam, ExternalName, Function, InstBuilder, Signature};
|
||||||
@@ -661,6 +660,7 @@ mod tests {
|
|||||||
use cranelift_codegen::settings::CallConv;
|
use cranelift_codegen::settings::CallConv;
|
||||||
use cranelift_codegen::verifier::verify_function;
|
use cranelift_codegen::verifier::verify_function;
|
||||||
use frontend::{FunctionBuilder, FunctionBuilderContext};
|
use frontend::{FunctionBuilder, FunctionBuilderContext};
|
||||||
|
use std::string::ToString;
|
||||||
use Variable;
|
use Variable;
|
||||||
|
|
||||||
fn sample_function(lazy_seal: bool) {
|
fn sample_function(lazy_seal: bool) {
|
||||||
|
|||||||
@@ -176,6 +176,9 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate alloc;
|
||||||
extern crate cranelift_codegen;
|
extern crate cranelift_codegen;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate target_lexicon;
|
extern crate target_lexicon;
|
||||||
@@ -191,10 +194,16 @@ mod ssa;
|
|||||||
mod switch;
|
mod switch;
|
||||||
mod variable;
|
mod variable;
|
||||||
|
|
||||||
|
/// This replaces `std` in builds with `core`.
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
mod std {
|
mod std {
|
||||||
extern crate alloc;
|
pub use alloc::{string, vec};
|
||||||
|
|
||||||
pub use self::alloc::vec;
|
|
||||||
pub use core::*;
|
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};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use cranelift_codegen::ir::condcodes::IntCC;
|
|||||||
use cranelift_codegen::ir::*;
|
use cranelift_codegen::ir::*;
|
||||||
use frontend::FunctionBuilder;
|
use frontend::FunctionBuilder;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
type EntryIndex = u64;
|
type EntryIndex = u64;
|
||||||
|
|
||||||
@@ -185,6 +186,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use cranelift_codegen::ir::Function;
|
use cranelift_codegen::ir::Function;
|
||||||
use frontend::FunctionBuilderContext;
|
use frontend::FunctionBuilderContext;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
macro_rules! setup {
|
macro_rules! setup {
|
||||||
($default:expr, [$($index:expr,)*]) => {{
|
($default:expr, [$($index:expr,)*]) => {{
|
||||||
|
|||||||
Reference in New Issue
Block a user