WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit c15fcff7 authored by qinsoon's avatar qinsoon
Browse files

[wip] set_inst_nop also sets related info

parent 855383c3
......@@ -113,9 +113,44 @@ impl MachineCode for ASMCode {
}
fn set_inst_nop(&mut self, index: usize) {
// FIXME: need to make sure it is fine that
// we do not update any information about this instruction
// e.g. uses, defines, etc.
// FIXME: changing these info is inefficient - plus we probably do not need to
// remove any reg use of this instruction
// clone the vec otherwise since we need to borrow 'self' again
for reg in self.get_inst_reg_uses(index).to_vec() {
let mut locs = self.reg_uses.get_mut(&reg).unwrap();
let mut new_locs : Vec<ASMLocation> = vec![];
while !locs.is_empty() {
let loc = locs.pop().unwrap();
if loc.line != index {
new_locs.push(loc);
}
}
debug_assert!(locs.is_empty());
locs.append(&mut new_locs);
}
// remove any reg define of this instruction
for reg in self.get_inst_reg_defines(index).to_vec() {
let mut locs = self.reg_defines.get_mut(&reg).unwrap();
let mut new_locs : Vec<ASMLocation> = vec![];
while !locs.is_empty() {
let loc = locs.pop().unwrap();
if loc.line != index {
new_locs.push(loc);
}
}
debug_assert!(locs.is_empty());
locs.append(&mut new_locs);
}
// nop doesnt use memop
self.mem_op_used.insert(index, false);
self.code.remove(index);
self.code.insert(index, ASM::nop());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment