1 //! Representation of Cranelift IR functions. 2 3 mod atomic_rmw_op; 4 mod builder; 5 pub mod condcodes; 6 pub mod constant; 7 pub mod dfg; 8 pub mod dynamic_type; 9 pub mod entities; 10 mod extfunc; 11 mod extname; 12 pub mod function; 13 mod globalvalue; 14 pub mod immediates; 15 pub mod instructions; 16 pub mod jumptable; 17 pub(crate) mod known_symbol; 18 pub mod layout; 19 pub(crate) mod libcall; 20 mod memflags; 21 mod memtype; 22 pub mod pcc; 23 mod progpoint; 24 mod sourceloc; 25 pub mod stackslot; 26 mod trapcode; 27 pub mod types; 28 29 #[cfg(feature = "enable-serde")] 30 use serde_derive::{Deserialize, Serialize}; 31 32 pub use crate::ir::atomic_rmw_op::AtomicRmwOp; 33 pub use crate::ir::builder::{ 34 InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase, ReplaceBuilder, 35 }; 36 pub use crate::ir::constant::{ConstantData, ConstantPool}; 37 pub use crate::ir::dfg::{BlockData, DataFlowGraph, ValueDef}; 38 pub use crate::ir::dynamic_type::{dynamic_to_fixed, DynamicTypeData, DynamicTypes}; 39 pub use crate::ir::entities::{ 40 Block, Constant, DynamicStackSlot, DynamicType, FuncRef, GlobalValue, Immediate, Inst, 41 JumpTable, MemoryType, SigRef, StackSlot, UserExternalNameRef, Value, 42 }; 43 pub use crate::ir::extfunc::{ 44 AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature, 45 }; 46 pub use crate::ir::extname::{ExternalName, UserExternalName, UserFuncName}; 47 pub use crate::ir::function::Function; 48 pub use crate::ir::globalvalue::GlobalValueData; 49 pub use crate::ir::instructions::{ 50 BlockCall, InstructionData, Opcode, ValueList, ValueListPool, VariableArgs, 51 }; 52 pub use crate::ir::jumptable::JumpTableData; 53 pub use crate::ir::known_symbol::KnownSymbol; 54 pub use crate::ir::layout::Layout; 55 pub use crate::ir::libcall::{get_probestack_funcref, LibCall}; 56 pub use crate::ir::memflags::{AliasRegion, Endianness, MemFlags}; 57 pub use crate::ir::memtype::{MemoryTypeData, MemoryTypeField}; 58 pub use crate::ir::pcc::{BaseExpr, Expr, Fact, FactContext, PccError, PccResult}; 59 pub use crate::ir::progpoint::ProgramPoint; 60 pub use crate::ir::sourceloc::RelSourceLoc; 61 pub use crate::ir::sourceloc::SourceLoc; 62 pub use crate::ir::stackslot::{ 63 DynamicStackSlotData, DynamicStackSlots, StackSlotData, StackSlotKind, StackSlots, 64 }; 65 pub use crate::ir::trapcode::TrapCode; 66 pub use crate::ir::types::Type; 67 68 use crate::entity::{entity_impl, PrimaryMap, SecondaryMap}; 69 70 /// Map of jump tables. 71 pub type JumpTables = PrimaryMap<JumpTable, JumpTableData>; 72 73 /// Source locations for instructions. 74 pub(crate) type SourceLocs = SecondaryMap<Inst, RelSourceLoc>; 75 76 /// Marked with a label value. 77 #[derive(Copy, Clone, PartialEq, Eq, Hash)] 78 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 79 pub struct ValueLabel(u32); 80 entity_impl!(ValueLabel, "val"); 81 82 /// A label of a Value. 83 #[derive(Debug, Clone, PartialEq, Hash)] 84 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 85 pub struct ValueLabelStart { 86 /// Source location when it is in effect 87 pub from: RelSourceLoc, 88 89 /// The label index. 90 pub label: ValueLabel, 91 } 92 93 /// Value label assignments: label starts or value aliases. 94 #[derive(Debug, Clone, PartialEq, Hash)] 95 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 96 pub enum ValueLabelAssignments { 97 /// Original value labels assigned at transform. 98 Starts(alloc::vec::Vec<ValueLabelStart>), 99 100 /// A value alias to original value. 101 Alias { 102 /// Source location when it is in effect 103 from: RelSourceLoc, 104 105 /// The label index. 106 value: Value, 107 }, 108 } 109