Move bforest into a separate crate

This commit is contained in:
Amanieu d'Antras
2018-07-10 23:24:33 +01:00
parent ad184ff9aa
commit ae3a3c368b
12 changed files with 63 additions and 5 deletions

View File

@@ -79,6 +79,7 @@ Building with no\_std
The following crates support \`no\_std\`:
- cranelift-entity
- cranelift-bforest
- cranelift-codegen
- cranelift-frontend
- cranelift-native

View File

@@ -36,7 +36,7 @@ cargo update
echo git commit -a -m "\"Bump version to $version"\"
echo git push
for crate in \
entity codegen/meta codegen frontend native \
entity bforest codegen/meta codegen frontend native \
reader wasm module simplejit \
faerie umbrella
do

21
lib/bforest/Cargo.toml Normal file
View File

@@ -0,0 +1,21 @@
[package]
authors = ["The Cranelift Project Developers"]
name = "cranelift-bforest"
version = "0.18.1"
description = "A forest of B+-trees"
license = "Apache-2.0"
documentation = "https://cranelift.readthedocs.io/"
repository = "https://github.com/CraneStation/cranelift"
readme = "README.md"
keywords = ["btree", "forest", "set", "map"]
[dependencies]
cranelift-entity = { path = "../entity", version = "0.18.1", default-features = false }
[features]
default = ["std"]
std = ["cranelift-entity/std"]
[badges]
maintenance = { status = "experimental" }
travis-ci = { repository = "CraneStation/cranelift" }

2
lib/bforest/README.md Normal file
View File

@@ -0,0 +1,2 @@
This crate contains array-based data structures used by the core Cranelift code
generator which represent a set of small ordered sets or maps.

View File

@@ -1,6 +1,6 @@
//! A forest of B+-trees.
//!
//! This module provides a data structures representing a set of small ordered sets or maps.
//! This crate provides a data structures representing a set of small ordered sets or maps.
//! It is implemented as a forest of B+-trees all allocating nodes out of the same pool.
//!
//! **These are not general purpose data structures that are somehow magically faster that the
@@ -13,6 +13,34 @@
//! - Empty trees have a very small 32-bit footprint.
//! - All the trees in a forest can be cleared in constant time.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", warn(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(feature = "cargo-clippy", allow(new_without_default, new_without_default_derive))]
#![cfg_attr(
feature = "cargo-clippy",
warn(
float_arithmetic, mut_mut, nonminimal_bool, option_map_unwrap_or, option_map_unwrap_or_else,
print_stdout, unicode_not_nfc, use_self
)
)]
// Turns on no_std and alloc features if std is not available.
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
/// This replaces `std` in builds with `core`.
#[cfg(not(feature = "std"))]
mod std {
extern crate alloc;
pub use self::alloc::{boxed, string, vec};
pub use core::*;
}
#[macro_use]
extern crate cranelift_entity as entity;
use entity::packed_option;
use std::borrow::BorrowMut;
use std::cmp::Ordering;
@@ -124,7 +152,11 @@ fn slice_shift<T: Copy>(s: &mut [T], n: usize) {
mod test {
use super::*;
use entity::EntityRef;
use ir::Ebb;
/// An opaque reference to an extended basic block in a function.
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Ebb(u32);
entity_impl!(Ebb, "ebb");
#[test]
fn comparator() {

View File

@@ -12,6 +12,7 @@ build = "build.rs"
[dependencies]
cranelift-entity = { path = "../entity", version = "0.18.1", default-features = false }
cranelift-bforest = { path = "../bforest", version = "0.18.1", default-features = false }
failure = { version = "0.1.1", default-features = false, features = ["derive"] }
failure_derive = { version = "0.1.1", default-features = false }
hashmap_core = { version = "0.1.9", optional = true }
@@ -29,7 +30,7 @@ cranelift-codegen-meta = { path = "meta", version = "0.18.1" }
# of some minimal std-like replacement libraries. At least one of these two
# features need to be enabled.
default = ["std"]
std = ["cranelift-entity/std", "target-lexicon/std"]
std = ["cranelift-entity/std", "cranelift-bforest/std", "target-lexicon/std"]
core = ["hashmap_core"]
[badges]

View File

@@ -60,10 +60,11 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[macro_use]
pub extern crate cranelift_entity as entity;
pub extern crate cranelift_bforest as bforest;
#[macro_use]
pub mod dbg;
pub mod bforest;
pub mod binemit;
pub mod cfg_printer;
pub mod cursor;