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

Natural representation for conditionals. More...

#include <exp.hh>

Inheritance diagram for translate::Cx:
Collaboration diagram for translate::Cx:

Public Member Functions

 Cx (tree::Cjump::Relop op, const tree::rExp &left, const tree::rExp &right)
virtual tree::rExp un_ex () override
 To convert a conditional into an expression means return 0 or 1.
virtual tree::rStm un_nx () override
 Pretend THIS was an Nx: return the statement part.
virtual tree::rStm un_cx (const temp::Label &t, const temp::Label &f) override
 Pretend THIS was a Cx: return the branching such that the resulting code jump to t if the conditional is satisfied, f otherwise.
virtual std::ostream & dump (std::ostream &ostr) const override

Private Attributes

tree::Cjump::Relop op_
tree::rExp left_
tree::rExp right_

Detailed Description

Natural representation for conditionals.

Constructor & Destructor Documentation

translate::Cx::Cx ( tree::Cjump::Relop  op,
const tree::rExp &  left,
const tree::rExp &  right 
)
inline

Member Function Documentation

std::ostream & translate::Cx::dump ( std::ostream &  ostr) const
overridevirtual

Implements translate::Exp.

References left_, op_, and right_.

tree::rStm translate::Cx::un_cx ( const temp::Label t,
const temp::Label f 
)
overridevirtual

Pretend THIS was a Cx: return the branching such that the resulting code jump to t if the conditional is satisfied, f otherwise.

Implements translate::Exp.

References left_, op_, and right_.

Referenced by translate::Ex::un_cx().

tree::rExp translate::Cx::un_ex ( )
overridevirtual

To convert a conditional into an expression means return 0 or 1.

Implements translate::Exp.

tree::rStm translate::Cx::un_nx ( )
overridevirtual

Pretend THIS was an Nx: return the statement part.

Implements translate::Exp.

Member Data Documentation

tree::rExp translate::Cx::left_
private

Referenced by dump(), and un_cx().

tree::Cjump::Relop translate::Cx::op_
private

Referenced by dump(), and un_cx().

tree::rExp translate::Cx::right_
private

Referenced by dump(), and un_cx().


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