The MergeFunctionsPass in LLVM merges identical functions (https://rust.godbolt.org/z/3nnr9nMne), resulting in the same function addresses.
26 lines
657 B
Rust
26 lines
657 B
Rust
use crate::{AtomId, AtomRoot, Readable, Writable};
|
|
use im_rc::HashMap as ImMap;
|
|
|
|
pub struct AtomFamilyBuilder;
|
|
pub struct AtomFamily<K, V>(pub fn(AtomFamilyBuilder) -> ImMap<K, V>);
|
|
|
|
impl<K, V> Readable<ImMap<K, V>> for &'static AtomFamily<K, V> {
|
|
fn read(&self, _root: AtomRoot) -> Option<ImMap<K, V>> {
|
|
todo!()
|
|
}
|
|
|
|
fn init(&self) -> ImMap<K, V> {
|
|
self.0(AtomFamilyBuilder)
|
|
}
|
|
|
|
fn unique_id(&self) -> AtomId {
|
|
*self as *const AtomFamily<K, V> as *const ()
|
|
}
|
|
}
|
|
|
|
impl<K, V> Writable<ImMap<K, V>> for &'static AtomFamily<K, V> {
|
|
fn write(&self, _root: AtomRoot, _value: ImMap<K, V>) {
|
|
todo!()
|
|
}
|
|
}
|