1 //! Cranelift code generation library. 2 #![deny(missing_docs)] 3 #![no_std] 4 // Various bits and pieces of this crate might only be used for one platform or 5 // another, but it's not really too useful to learn about that all the time. On 6 // CI we build at least one version of this crate with `--features all-arch` 7 // which means we'll always detect truly dead code, otherwise if this is only 8 // built for one platform we don't have to worry too much about trimming 9 // everything down. 10 #![cfg_attr(not(feature = "all-arch"), allow(dead_code))] 11 12 #[allow(unused_imports)] // #[macro_use] is required for no_std 13 #[macro_use] 14 extern crate alloc; 15 16 #[cfg(feature = "std")] 17 #[macro_use] 18 extern crate std; 19 20 #[cfg(not(feature = "std"))] 21 use hashbrown::{hash_map, HashMap, HashSet}; 22 #[cfg(feature = "std")] 23 use std::collections::{hash_map, HashMap, HashSet}; 24 25 pub use crate::context::Context; 26 pub use crate::value_label::{LabelValueLoc, ValueLabelsRanges, ValueLocRange}; 27 pub use crate::verifier::verify_function; 28 pub use crate::write::write_function; 29 30 pub use cranelift_bforest as bforest; 31 pub use cranelift_control as control; 32 pub use cranelift_entity as entity; 33 #[cfg(feature = "unwind")] 34 pub use gimli; 35 36 #[macro_use] 37 mod machinst; 38 39 pub mod binemit; 40 pub mod cfg_printer; 41 pub mod cursor; 42 pub mod data_value; 43 pub mod dbg; 44 pub mod dominator_tree; 45 pub mod flowgraph; 46 pub mod ir; 47 pub mod isa; 48 pub mod loop_analysis; 49 pub mod print_errors; 50 pub mod settings; 51 pub mod timing; 52 pub mod verifier; 53 pub mod write; 54 55 pub use crate::entity::packed_option; 56 pub use crate::machinst::buffer::{ 57 FinalizedMachReloc, FinalizedRelocTarget, MachCallSite, MachSrcLoc, MachStackMap, 58 MachTextSectionBuilder, MachTrap, 59 }; 60 pub use crate::machinst::{ 61 CompiledCode, Final, MachBuffer, MachBufferFinalized, MachInst, MachInstEmit, 62 MachInstEmitState, MachLabel, Reg, TextSectionBuilder, VCodeConstantData, VCodeConstants, 63 Writable, 64 }; 65 66 mod alias_analysis; 67 mod bitset; 68 mod constant_hash; 69 mod context; 70 mod ctxhash; 71 mod dce; 72 mod egraph; 73 mod fx; 74 mod inst_predicates; 75 mod isle_prelude; 76 mod iterators; 77 mod legalizer; 78 mod nan_canonicalization; 79 mod opts; 80 mod remove_constant_phis; 81 mod result; 82 mod scoped_hash_map; 83 mod unionfind; 84 mod unreachable_code; 85 mod value_label; 86 87 #[cfg(feature = "souper-harvest")] 88 mod souper_harvest; 89 90 pub use crate::result::{CodegenError, CodegenResult, CompileError}; 91 92 #[cfg(feature = "incremental-cache")] 93 pub mod incremental_cache; 94 95 /// Even when trace logging is disabled, the trace macro has a significant performance cost so we 96 /// disable it by default. 97 #[macro_export] 98 macro_rules! trace { 99 ($($tt:tt)*) => { 100 if cfg!(feature = "trace-log") { 101 ::log::trace!($($tt)*); 102 } 103 }; 104 } 105 106 include!(concat!(env!("OUT_DIR"), "/version.rs")); 107