sail::Branch Class Reference

A branch instruction is of the form s1!=0 : l1, s2!=0 : l_2 , ... s_k!=0:l_k. More...

#include <Branch.h>

Inheritance diagram for sail::Branch:
sail::Instruction

List of all members.

Public Member Functions

 Branch (Symbol *if_var, Symbol *else_var, Label *then_label, Label *else_label, il::node *original)
 Branch (vector< pair< Symbol *, Label * > > *targets, il::node *original)
virtual string to_string () const
virtual string to_string (bool pretty_print) const
bool is_if_statement ()
vector< pair< Symbol *, Label * > > * get_targets ()
Labelget_then_label ()
Labelget_else_label ()
Symbolget_if_condition ()
Symbolget_else_condition ()
virtual bool is_removable ()

Friends

class boost::serialization::access

Detailed Description

A branch instruction is of the form s1!=0 : l1, s2!=0 : l_2 , ... s_k!=0:l_k.

Any s_i !=0 and s_j !=0 are mutually exclusive, and the disjunction s_1!=0 | ....|s_k!=0 is always true. The (s_i, l_i) pairs are represented by the vector called targets, i.e. the result of get_targets().


Member Function Documentation

Symbol * sail::Branch::get_else_condition (  ) 

Convenience method for branches corresponding to if statements

Returns:
the condition for the false branch
Label * sail::Branch::get_else_label (  ) 

Convenience method for branches corresponding to if statements

Returns:
the label associated with the false branch.
Symbol * sail::Branch::get_if_condition (  ) 

Convenience method for branches corresponding to if statements

Returns:
the condition for the true branch
vector< pair< Symbol *, Label * > > * sail::Branch::get_targets (  ) 
Returns:
a vector of (s_i, l_i) pairs representing the condition and the label to jump to if the condition s_i != 0 holds.
Label * sail::Branch::get_then_label (  ) 

Convenience method for branches corresponding to if statements

Returns:
the label associated with the true branch.
bool sail::Branch::is_if_statement (  ) 
Returns:
Is this branch associated with an if rather than a switch statement? If so, the convenience methods provided below for if statements can be called.
bool sail::Branch::is_removable (  )  [virtual]

An instruction is removable if it's not present in the original source code, but introduced in the translation from the high-level language to the low-level language. For instance, if **x is an expression used in the original code, the low-level language will introduce a temporary t=*x; such instructions are "removable" for printing purposes.

Implements sail::Instruction.


The documentation for this class was generated from the following files:
Generated on Sun Oct 17 14:01:31 2010 by  doxygen 1.6.3