Skip to content
Snippets Groups Projects

Support selection for inlining

Merged rarbore2 requested to merge directed_inlining into main
5 files
+ 85
43
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 37
2
@@ -108,8 +108,8 @@ impl<'a: 'b, 'b> FunctionEditor<'a> {
}
}
// Constructs an editor but only makes the nodes with at least one of the set of labels as
// mutable
// Constructs an editor but only makes the nodes with at least one of the
// set of labels as mutable.
pub fn new_labeled(
function: &'a mut Function,
function_id: FunctionID,
@@ -151,6 +151,41 @@ impl<'a: 'b, 'b> FunctionEditor<'a> {
}
}
// Constructs an editor but makes every node immutable.
pub fn new_immutable(
function: &'a mut Function,
function_id: FunctionID,
constants: &'a RefCell<Vec<Constant>>,
dynamic_constants: &'a RefCell<Vec<DynamicConstant>>,
types: &'a RefCell<Vec<Type>>,
labels: &'a RefCell<Vec<String>>,
def_use: &ImmutableDefUseMap,
) -> Self {
let mut_def_use = (0..function.nodes.len())
.map(|idx| {
def_use
.get_users(NodeID::new(idx))
.into_iter()
.map(|x| *x)
.collect()
})
.collect();
let mutable_nodes = bitvec![u8, Lsb0; 0; function.nodes.len()];
FunctionEditor {
function,
function_id,
constants,
dynamic_constants,
types,
labels,
mut_def_use,
mutable_nodes,
modified: false,
}
}
pub fn modified(&self) -> bool {
self.modified
}
Loading