pub struct ValueRegistry<'str> {
pub literals: LiteralInterner,
pub bytes: Interner<BytesId, Bytes>,
pub poisons: Interner<PoisonId, Poison>,
pub varnodes: Registry<VarnodeId, Varnode<'str>>,
/* private fields */
}Expand description
Central storage arena for all IR values in a Context.
Each field is a typed arena (Registry) keyed by the corresponding ID
type. Values are append-only: once pushed, their ID is stable for the
lifetime of the registry and their data is never moved.
§Invariants
-
push_insnis final. Instructions are immutable after insertion. The owning function’susersmap is populated at push time from the instruction’s operands and is not updated if operands are later altered via interior mutation. UseContext::replace_all_uses_withto rewrite operands while keepingusersconsistent. -
usersis managed internally. The reverse use-def map now lives in eachFunctionBody(function-scoped; seeFunctionBody::users_of). Do not mutate it directly. Read it throughFunctionRef::users_of/Context::users, and remove dead instructions viaContext::remove_instructions.
Fields§
§literals: LiteralInternerLiteral (constant) interner. Behind an RwLock (see
LiteralInterner) so constants can be minted through a shared &; the
dedup cache lives inside it.
bytes: Interner<BytesId, Bytes>Opaque byte-blob constant interner (constants wider than a u64).
poisons: Interner<PoisonId, Poison>Poison-value interner (argpromote v2). Each poison is a distinct interned value (never deduped), so two poisons are never congruent.
varnodes: Registry<VarnodeId, Varnode<'str>>Varnode storage.
Implementations§
Source§impl<'str> ValueRegistry<'str>
impl<'str> ValueRegistry<'str>
Sourcepub fn get_or_make_typed_literal(
&self,
value: u64,
type_id: TypeId,
size: usize,
) -> LiteralId
pub fn get_or_make_typed_literal( &self, value: u64, type_id: TypeId, size: usize, ) -> LiteralId
Returns a canonical LiteralId for the given typed constant.
The value is masked to type_id’s size before lookup. Symbolic literals
(created via push_literal) are not included in
the intern cache and will not alias with constants produced here.
Call Context::get_const for the common Int(size) case; use this
method directly when you need to preserve a non-Int type (e.g.
StackAddress) through folding.
Sourcepub fn push_literal(&self, literal: Literal) -> LiteralId
pub fn push_literal(&self, literal: Literal) -> LiteralId
Pushes a Literal with arbitrary fields (e.g. with a symbolic ref)
without interning. Use get_or_make_typed_literal
for plain integer constants.
Sourcepub fn add_synthetic_callee(
&mut self,
caller: FunctionId,
callee_addr: u64,
) -> bool
pub fn add_synthetic_callee( &mut self, caller: FunctionId, callee_addr: u64, ) -> bool
Records a synthetic forward call-graph edge caller → callee_addr (see
synthetic_callees). Returns true if the
edge was newly added, so callers can drive a fixpoint without spinning.
Sourcepub fn synthetic_callees_of(
&self,
caller: FunctionId,
) -> impl Iterator<Item = u64> + '_
pub fn synthetic_callees_of( &self, caller: FunctionId, ) -> impl Iterator<Item = u64> + '_
Returns the synthetic callee entry addresses recorded for caller.
pub fn push_varnode(&mut self, varnode: Varnode<'str>) -> VarnodeId
Sourcepub fn push_poison(&self, type_id: TypeId) -> PoisonId
pub fn push_poison(&self, type_id: TypeId) -> PoisonId
Mints a fresh typed poison value. Never deduped: each call yields a
distinct PoisonId so GVN keeps every poison in
its own congruence class.
Trait Implementations§
Source§impl<'str> Clone for ValueRegistry<'str>
impl<'str> Clone for ValueRegistry<'str>
Source§fn clone(&self) -> ValueRegistry<'str>
fn clone(&self) -> ValueRegistry<'str>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more