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