Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/cranelift/codegen/src/ir/mod.rs
1693 views
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 exception_table;
11
mod extfunc;
12
mod extname;
13
pub mod function;
14
mod globalvalue;
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 memtype;
23
pub mod pcc;
24
mod progpoint;
25
mod sourceloc;
26
pub mod stackslot;
27
mod trapcode;
28
pub mod types;
29
mod user_stack_maps;
30
31
#[cfg(feature = "enable-serde")]
32
use serde_derive::{Deserialize, Serialize};
33
34
pub use crate::ir::atomic_rmw_op::AtomicRmwOp;
35
pub use crate::ir::builder::{
36
InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase, ReplaceBuilder,
37
};
38
pub use crate::ir::constant::{ConstantData, ConstantPool};
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, MemoryType, SigRef, StackSlot, UserExternalNameRef,
44
Value,
45
};
46
pub use crate::ir::exception_table::{ExceptionTableData, ExceptionTableItem};
47
pub use crate::ir::extfunc::{
48
AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature,
49
};
50
pub use crate::ir::extname::{ExternalName, UserExternalName, UserFuncName};
51
pub use crate::ir::function::Function;
52
pub use crate::ir::globalvalue::GlobalValueData;
53
pub use crate::ir::instructions::{
54
BlockArg, BlockCall, InstructionData, Opcode, ValueList, ValueListPool, VariableArgs,
55
};
56
pub use crate::ir::jumptable::JumpTableData;
57
pub use crate::ir::known_symbol::KnownSymbol;
58
pub use crate::ir::layout::Layout;
59
pub use crate::ir::libcall::{LibCall, get_probestack_funcref};
60
pub use crate::ir::memflags::{AliasRegion, Endianness, MemFlags};
61
pub use crate::ir::memtype::{MemoryTypeData, MemoryTypeField};
62
pub use crate::ir::pcc::{BaseExpr, Expr, Fact, FactContext, PccError, PccResult};
63
pub use crate::ir::progpoint::ProgramPoint;
64
pub use crate::ir::sourceloc::RelSourceLoc;
65
pub use crate::ir::sourceloc::SourceLoc;
66
pub use crate::ir::stackslot::{
67
DynamicStackSlotData, DynamicStackSlots, StackSlotData, StackSlotKind, StackSlots,
68
};
69
pub use crate::ir::trapcode::TrapCode;
70
pub use crate::ir::types::Type;
71
pub(crate) use crate::ir::user_stack_maps::UserStackMapEntryVec;
72
pub use crate::ir::user_stack_maps::{UserStackMap, UserStackMapEntry};
73
74
use crate::entity::{PrimaryMap, SecondaryMap, entity_impl};
75
76
/// Map of jump tables.
77
pub type JumpTables = PrimaryMap<JumpTable, JumpTableData>;
78
79
/// Map of exception tables.
80
pub type ExceptionTables = PrimaryMap<ExceptionTable, ExceptionTableData>;
81
82
/// Source locations for instructions.
83
pub(crate) type SourceLocs = SecondaryMap<Inst, RelSourceLoc>;
84
85
/// Marked with a label value.
86
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
87
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
88
pub struct ValueLabel(u32);
89
entity_impl!(ValueLabel, "VL");
90
91
/// A label of a Value.
92
#[derive(Debug, Clone, PartialEq, Hash)]
93
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
94
pub struct ValueLabelStart {
95
/// Source location when it is in effect
96
pub from: RelSourceLoc,
97
98
/// The label index.
99
pub label: ValueLabel,
100
}
101
102
/// Value label assignments: label starts or value aliases.
103
#[derive(Debug, Clone, PartialEq, Hash)]
104
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
105
pub enum ValueLabelAssignments {
106
/// Original value labels assigned at transform.
107
Starts(alloc::vec::Vec<ValueLabelStart>),
108
109
/// A value alias to original value.
110
Alias {
111
/// Source location when it is in effect
112
from: RelSourceLoc,
113
114
/// The label index.
115
value: Value,
116
},
117
}
118
119