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.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 565fdc2b authored by qinsoon's avatar qinsoon
Browse files

we need to keep track of original block during instruction selection (so

we can get control flow info for it)
parent 33a88450
......@@ -106,6 +106,7 @@ pub struct InstructionSelection {
current_callsite_id: usize,
current_frame: Option<Frame>,
current_block: Option<MuName>,
current_block_in_ir: Option<MuName>,
current_func_start: Option<ValueLocation>,
// key: block id, val: callsite that names the block as exception block
current_exn_callsites: HashMap<MuID, Vec<ValueLocation>>,
......@@ -126,7 +127,13 @@ impl <'a> InstructionSelection {
current_fv_id: 0,
current_callsite_id: 0,
current_frame: None,
current_block: None,
current_block: None, // which block we are generating code for
current_block_in_ir: None, // it is possible the block is newly created in instruction selection
// but sometimes we want to know its control flow
// so we need to track what block it is from the IR
// FIXME: ideally we should not create new blocks in instruction selection
// see Issue #6
current_func_start: None,
// key: block id, val: callsite that names the block as exception block
current_exn_callsites: HashMap::new(),
......@@ -158,7 +165,7 @@ impl <'a> InstructionSelection {
// 'branch_if_true' == false, we emit opposite cjmp as CmpOp (jne for EQ, je for NE)
let (fallthrough_dest, branch_dest, branch_if_true) = {
// get current block and next block in trace (fallthrough block)
let cur_block = f_content.get_block_by_name(self.current_block.as_ref().unwrap().clone());
let cur_block = f_content.get_block_by_name(self.current_block_in_ir.as_ref().unwrap().clone());
let next_block_in_trace = cur_block.control_flow.get_hottest_succ().unwrap();
if next_block_in_trace == true_dest.target {
......@@ -4746,7 +4753,7 @@ impl CompilerPass for InstructionSelection {
let block = f_content.get_block(*block_id);
let block_label = block.name().unwrap();
self.current_block = Some(block_label.clone());
self.current_block_in_ir = Some(block_label.clone());
let block_content = block.content.as_ref().unwrap();
if is_exception_block {
......@@ -4794,6 +4801,7 @@ impl CompilerPass for InstructionSelection {
self.current_block = None;
self.current_block_in_ir = None;
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