To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit a5943a79 authored by qinsoon's avatar qinsoon
Browse files

add TraceHint for each block for better trace scheduling

parent 1b6f904a
......@@ -453,11 +453,16 @@ impl FunctionContext {
/// Block contains BlockContent, which includes all the instructions for the block
// FIXME: control_flow field should be moved out of ast crate (Issue #18)
// FIXME: control_flow field should be moved out of ast crate (Issue #18)
// FIXME: trace_hint should also be moved
pub struct Block {
pub hdr: MuEntityHeader,
/// the actual content of this block
pub content: Option<BlockContent>,
/// a trace scheduling hint about where to layout this block
pub trace_hint: TraceHint,
/// control flow info about this block (predecessors, successors, etc)
pub control_flow: ControlFlow
......@@ -477,7 +482,7 @@ impl fmt::Debug for Block {
impl Block {
pub fn new(entity: MuEntityHeader) -> Block {
Block{hdr: entity, content: None, control_flow: ControlFlow::default()}
Block{hdr: entity, content: None, trace_hint: TraceHint::None, control_flow: ControlFlow::default()}
/// does this block have an exception arguments?
......@@ -497,6 +502,19 @@ impl Block {
/// TraceHint is a hint for the compiler to generate better trace for this block
pub enum TraceHint {
/// no hint provided. Trace scheduler should use its own heuristics to decide
/// this block is fast path, and should be put in straightline code where possible
/// this block is slow path, and should be kept out of hot loops
/// this block is return sink, and should be put at the end of a function
/// ControlFlow stores compilation info about control flows of a block
// FIXME: Issue #18
......@@ -365,6 +365,7 @@ fn copy_inline_blocks(caller: &mut Vec<Block>, ret_block: MuID, callee: &Functio
let mut block = Block {
hdr: MuEntityHeader::named(new_id, format!("{}:inlinedblock.#{}",, new_id)),
content: block.content.clone(),
trace_hint: TraceHint::None,
control_flow: ControlFlow::default()
......@@ -54,6 +54,8 @@ impl CompilerPass for RetSink {
trace!("created return sink {}", block_name);
let mut block = Block::new(MuEntityHeader::named(vm.next_id(), block_name));
// tell the compiler this is the return sink
block.trace_hint = TraceHint::ReturnSink;
let sig = func.sig.clone();
......@@ -1521,6 +1521,7 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> {
Block {
hdr: hdr,
content: Some(ctn),
trace_hint: TraceHint::None,
control_flow: Default::default(),
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