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