1 //! Cranelift code generation library. 2 3 #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] 4 #![warn(unused_import_braces)] 5 #![cfg_attr(feature = "std", deny(unstable_features))] 6 #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] 7 #![cfg_attr(feature="cargo-clippy", allow( 8 // Produces only a false positive: 9 clippy::while_let_loop, 10 // Produces many false positives, but did produce some valid lints, now fixed: 11 clippy::needless_lifetimes, 12 // Generated code makes some style transgressions, but readability doesn't suffer much: 13 clippy::many_single_char_names, 14 clippy::identity_op, 15 clippy::needless_borrow, 16 clippy::cast_lossless, 17 clippy::unreadable_literal, 18 clippy::assign_op_pattern, 19 clippy::empty_line_after_outer_attr, 20 // Hard to avoid in generated code: 21 clippy::cognitive_complexity, 22 clippy::too_many_arguments, 23 // Code generator doesn't have a way to collapse identical arms: 24 clippy::match_same_arms, 25 // These are relatively minor style issues, but would be easy to fix: 26 clippy::new_without_default, 27 clippy::should_implement_trait, 28 clippy::len_without_is_empty))] 29 #![cfg_attr( 30 feature = "cargo-clippy", 31 warn( 32 clippy::float_arithmetic, 33 clippy::mut_mut, 34 clippy::nonminimal_bool, 35 clippy::option_map_unwrap_or, 36 clippy::option_map_unwrap_or_else, 37 clippy::unicode_not_nfc, 38 clippy::use_self 39 ) 40 )] 41 #![no_std] 42 // Various bits and pieces of this crate might only be used for one platform or 43 // another, but it's not really too useful to learn about that all the time. On 44 // CI we build at least one version of this crate with `--features all-arch` 45 // which means we'll always detect truly dead code, otherwise if this is only 46 // built for one platform we don't have to worry too much about trimming 47 // everything down. 48 #![cfg_attr(not(feature = "all-arch"), allow(dead_code))] 49 50 #[allow(unused_imports)] // #[macro_use] is required for no_std 51 #[macro_use] 52 extern crate alloc; 53 54 #[cfg(feature = "std")] 55 #[macro_use] 56 extern crate std; 57 58 #[cfg(not(feature = "std"))] 59 use hashbrown::{hash_map, HashMap, HashSet}; 60 #[cfg(feature = "std")] 61 use std::collections::{hash_map, HashMap, HashSet}; 62 63 pub use crate::context::Context; 64 pub use crate::legalizer::legalize_function; 65 pub use crate::value_label::{ValueLabelsRanges, ValueLocRange}; 66 pub use crate::verifier::verify_function; 67 pub use crate::write::write_function; 68 69 pub use cranelift_bforest as bforest; 70 pub use cranelift_entity as entity; 71 72 pub mod binemit; 73 pub mod cfg_printer; 74 pub mod cursor; 75 pub mod dbg; 76 pub mod dominator_tree; 77 pub mod flowgraph; 78 pub mod ir; 79 pub mod isa; 80 pub mod loop_analysis; 81 pub mod machinst; 82 pub mod print_errors; 83 pub mod settings; 84 pub mod timing; 85 pub mod verifier; 86 pub mod write; 87 88 pub use crate::entity::packed_option; 89 90 mod abi; 91 mod bitset; 92 mod constant_hash; 93 mod context; 94 mod dce; 95 mod divconst_magic_numbers; 96 mod fx; 97 mod inst_predicates; 98 mod iterators; 99 mod legalizer; 100 mod licm; 101 mod nan_canonicalization; 102 mod num_uses; 103 mod partition_slice; 104 mod postopt; 105 mod predicates; 106 mod redundant_reload_remover; 107 mod regalloc; 108 mod result; 109 mod scoped_hash_map; 110 mod simple_gvn; 111 mod simple_preopt; 112 mod stack_layout; 113 mod topo_order; 114 mod unreachable_code; 115 mod value_label; 116 117 pub use crate::result::{CodegenError, CodegenResult}; 118 119 /// Version number of this crate. 120 pub const VERSION: &str = env!("CARGO_PKG_VERSION"); 121