GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit 698c71fb authored by qinsoon's avatar qinsoon

instruction selection for branch2 pick fallthrough block based on trace

scheduling result (instead of probability)
parent 5d248afd
......@@ -358,6 +358,16 @@ impl FunctionContent {
None => panic!("cannot find block #{}", id)
}
}
pub fn get_block_by_name(&self, name: String) -> &Block {
for block in self.blocks.values() {
if block.name().unwrap() == name {
return block;
}
}
panic!("cannot find block {}", name)
}
}
#[derive(Default, Debug, RustcEncodable, RustcDecodable)]
......
......@@ -157,7 +157,11 @@ impl <'a> InstructionSelection {
// 'branch_if_true' == true, we emit cjmp the same as CmpOp (je for EQ, jne for NE)
// 'branch_if_true' == false, we emit opposite cjmp as CmpOp (jne for EQ, je for NE)
let (fallthrough_dest, branch_dest, branch_if_true) = {
if true_prob >= 0.5f32 {
// 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 next_block_in_trace = cur_block.control_flow.get_hottest_succ().unwrap();
if next_block_in_trace == true_dest.target {
(true_dest, false_dest, false)
} else {
(false_dest, true_dest, true)
......
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