1#![deny(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
5#![no_std]
6#![cfg_attr(
13 not(feature = "all-arch"),
14 allow(dead_code, reason = "see comment above")
15)]
16
17#[cfg_attr(not(feature = "std"), macro_use)]
18extern crate alloc;
19
20#[cfg(feature = "std")]
21#[macro_use]
22extern crate std;
23
24#[cfg(not(feature = "std"))]
25use hashbrown::{HashMap, HashSet, hash_map};
26#[cfg(feature = "std")]
27use std::collections::{HashMap, HashSet, hash_map};
28
29pub type FxHashMap<K, V> = HashMap<K, V, rustc_hash::FxBuildHasher>;
31pub type FxHashSet<V> = HashSet<V, rustc_hash::FxBuildHasher>;
33
34pub use crate::context::Context;
35pub use crate::value_label::{LabelValueLoc, ValueLabelsRanges, ValueLocRange};
36pub use crate::verifier::verify_function;
37pub use crate::write::write_function;
38
39pub use cranelift_bforest as bforest;
40pub use cranelift_bitset as bitset;
41pub use cranelift_control as control;
42pub use cranelift_entity as entity;
43#[cfg(feature = "unwind")]
44pub use gimli;
45
46include!(concat!(env!("ISLE_DIR"), "/isle_numerics.rs"));
48
49#[macro_use]
50mod machinst;
51
52pub mod binemit;
53pub mod cfg_printer;
54pub mod cursor;
55pub mod data_value;
56pub mod dbg;
57pub mod dominator_tree;
58pub mod flowgraph;
59pub mod inline;
60pub mod ir;
61pub mod isa;
62pub mod loop_analysis;
63pub mod print_errors;
64pub mod settings;
65pub mod timing;
66pub mod traversals;
67pub mod verifier;
68pub mod write;
69
70pub use crate::entity::packed_option;
71pub use crate::machinst::buffer::{
72 ExceptionContextLoc, FinalizedMachCallSite, FinalizedMachExceptionHandler, FinalizedMachReloc,
73 FinalizedRelocTarget, MachCallSite, MachSrcLoc, MachTextSectionBuilder, MachTrap,
74 OpenPatchRegion, PatchRegion,
75};
76pub use crate::machinst::{
77 CallInfo, CompiledCode, Final, MachBuffer, MachBufferDebugTagList, MachBufferFinalized,
78 MachBufferFrameLayout, MachDebugTagPos, MachInst, MachInstEmit, MachInstEmitState, MachLabel,
79 RealReg, Reg, RelocDistance, TextSectionBuilder, VCodeConstant, VCodeConstantData,
80 VCodeConstants, VCodeInst, Writable,
81};
82
83mod alias_analysis;
84mod constant_hash;
85mod context;
86mod ctxhash;
87mod egraph;
88mod inst_predicates;
89mod isle_prelude;
90mod legalizer;
91mod nan_canonicalization;
92mod opts;
93mod ranges;
94mod remove_constant_phis;
95mod result;
96mod scoped_hash_map;
97mod take_and_replace;
98mod unreachable_code;
99mod value_label;
100
101#[cfg(feature = "souper-harvest")]
102mod souper_harvest;
103
104pub use crate::result::{CodegenError, CodegenResult, CompileError};
105pub use crate::take_and_replace::TakeAndReplace;
106
107#[cfg(feature = "incremental-cache")]
108pub mod incremental_cache;
109
110#[macro_export]
113macro_rules! trace {
114 ($($tt:tt)*) => {
115 if cfg!(any(feature = "trace-log", debug_assertions)) {
116 ::log::trace!($($tt)*);
117 }
118 };
119}
120
121#[macro_export]
123macro_rules! trace_log_enabled {
124 () => {
125 cfg!(any(feature = "trace-log", debug_assertions))
126 && ::log::log_enabled!(::log::Level::Trace)
127 };
128}
129
130include!(concat!(env!("OUT_DIR"), "/version.rs"));