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 mod heap; 15 pub mod immediates; 16 pub mod instructions; 17 pub mod jumptable; 18 pub(crate) mod known_symbol; 19 pub mod layout; 20 pub(crate) mod libcall; 21 mod memflags; 22 mod progpoint; 23 mod sourceloc; 24 pub mod stackslot; 25 mod table; 26 mod trapcode; 27 pub mod types; 28 29 #[cfg(feature = "enable-serde")] 30 use serde::{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::{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, Heap, Immediate, Inst, 41 JumpTable, SigRef, StackSlot, Table, 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::{DisplayFunctionAnnotations, Function}; 48 pub use crate::ir::globalvalue::GlobalValueData; 49 pub use crate::ir::heap::{HeapData, HeapStyle}; 50 pub use crate::ir::instructions::{ 51 InstructionData, Opcode, ValueList, ValueListPool, VariableArgs, 52 }; 53 pub use crate::ir::jumptable::JumpTableData; 54 pub use crate::ir::known_symbol::KnownSymbol; 55 pub use crate::ir::layout::Layout; 56 pub use crate::ir::libcall::{get_probestack_funcref, LibCall}; 57 pub use crate::ir::memflags::{Endianness, MemFlags}; 58 pub use crate::ir::progpoint::{ExpandedProgramPoint, ProgramOrder, ProgramPoint}; 59 pub use crate::ir::sourceloc::RelSourceLoc; 60 pub use crate::ir::sourceloc::SourceLoc; 61 pub use crate::ir::stackslot::{ 62 DynamicStackSlotData, DynamicStackSlots, StackSlotData, StackSlotKind, StackSlots, 63 }; 64 pub use crate::ir::table::TableData; 65 pub use crate::ir::trapcode::TrapCode; 66 pub use crate::ir::types::Type; 67 pub use crate::value_label::LabelValueLoc; 68 69 use crate::entity::{entity_impl, PrimaryMap, SecondaryMap}; 70 71 /// Map of jump tables. 72 pub type JumpTables = PrimaryMap<JumpTable, JumpTableData>; 73 74 /// Source locations for instructions. 75 pub(crate) type SourceLocs = SecondaryMap<Inst, RelSourceLoc>; 76 77 /// Marked with a label value. 78 #[derive(Copy, Clone, PartialEq, Eq, Hash)] 79 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 80 pub struct ValueLabel(u32); 81 entity_impl!(ValueLabel, "val"); 82 83 /// A label of a Value. 84 #[derive(Debug, Clone, PartialEq, Hash)] 85 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 86 pub struct ValueLabelStart { 87 /// Source location when it is in effect 88 pub from: RelSourceLoc, 89 90 /// The label index. 91 pub label: ValueLabel, 92 } 93 94 /// Value label assignements: label starts or value aliases. 95 #[derive(Debug, Clone, PartialEq, Hash)] 96 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 97 pub enum ValueLabelAssignments { 98 /// Original value labels assigned at transform. 99 Starts(alloc::vec::Vec<ValueLabelStart>), 100 101 /// A value alias to original value. 102 Alias { 103 /// Source location when it is in effect 104 from: RelSourceLoc, 105 106 /// The label index. 107 value: Value, 108 }, 109 } 110