LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
canon::Traces Class Reference

Object function to linearize canonicalized tree::Tree code. More...

#include <traces.hh>

Public Member Functions

 Traces (bool trace_p=false)
tree::rStm operator() (const tree::rStm &tree)
 Linearize a canonicalized LIR fragment.

Private Types

typedef std::map< temp::Label,
BasicBlock * > 
block_map
 Mapping a Label to the BasicBlock it starts.

Private Member Functions

block_map make_basic_blocks (const tree::rStm &tree, const temp::Label &entry_label, const temp::Label &epilogue_label)
 Split a low level tree into BasicBlocks.
tree::tree_list_type make_trace (block_map &blocks, const temp::Label &entry_label, const temp::Label &epilogue_label)
bool useless_jump_p (tree::tree_list_type::iterator begin, tree::tree_list_type::iterator end)
 Is the destination of the jump (pointed to by begin) one of the next labels?
void strip_useless_jumps (tree::tree_list_type &trace)
 Remove the useless jumps from trace.

Private Attributes

bool trace_p_

Detailed Description

Object function to linearize canonicalized tree::Tree code.

Member Typedef Documentation

typedef std::map<temp::Label, BasicBlock*> canon::Traces::block_map
private

Mapping a Label to the BasicBlock it starts.

Constructor & Destructor Documentation

canon::Traces::Traces ( bool  trace_p = false)

Member Function Documentation

Traces::block_map canon::Traces::make_basic_blocks ( const tree::rStm &  tree,
const temp::Label entry_label,
const temp::Label epilogue_label 
)
private

Split a low level tree into BasicBlocks.

Parameters
treethe tree to split, a function's body
entry_labelthe entry label of this function's body
epilogue_labelthe label to branch to at the end of the function.

Referenced by operator()().

tree::tree_list_type canon::Traces::make_trace ( block_map blocks,
const temp::Label entry_label,
const temp::Label epilogue_label 
)
private

Sewing all the basic blocks into a single trace. Empties blocks.

Referenced by operator()().

tree::rStm canon::Traces::operator() ( const tree::rStm &  tree)

Linearize a canonicalized LIR fragment.

References misc::decendl(), misc::incendl(), make_basic_blocks(), make_trace(), strip_useless_jumps(), and trace_p_.

void canon::Traces::strip_useless_jumps ( tree::tree_list_type trace)
private

Remove the useless jumps from trace.

If the destination of a jump is one of the labels that follows, then it is useless. Don't bother removing Labels: that requires checking they're not used elsewhere, and anyway Labels cost nothing.

Referenced by operator()().

bool canon::Traces::useless_jump_p ( tree::tree_list_type::iterator  begin,
tree::tree_list_type::iterator  end 
)
private

Is the destination of the jump (pointed to by begin) one of the next labels?

Member Data Documentation

bool canon::Traces::trace_p_
private

Referenced by operator()().


The documentation for this class was generated from the following files: