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