RegisterState Class Reference

#include <instruction.h>

List of all members.

Public Member Functions

 RegisterState ()
void merge (const RegisterState &state)
void reset ()
uchar definiteZeros () const
uchar definiteOnes () const
uchar unknown () const
uchar maxValue () const
uchar minValue () const
bool operator== (const RegisterState &state) const
bool operator!= (const RegisterState &state) const
void print ()

Public Attributes

uchar known
 Whether or not the value is known (for each bit).
uchar value
 The value of the register.


Detailed Description

Contains information on the state of a register before an instruction is executed.

Note that all the "uchar" values in this class should be considered as the 8 bits of a register. So for example, if known=0x2, then only the second bit of the register is known, and its value is given in the second bit of value.

Author:
David Saxton

Definition at line 241 of file instruction.h.


Member Function Documentation

void RegisterState::merge ( const RegisterState state  ) 

Merges the known and values together, (possibly) reducing what is known.

Definition at line 505 of file instruction.cpp.

References known, and value.

Referenced by ProcessorState::merge().

void RegisterState::reset (  ) 

Sets known to unknown and value to zero.

Definition at line 498 of file instruction.cpp.

References known, and value.

Referenced by RegisterState(), and ProcessorState::reset().

uchar RegisterState::definiteZeros (  )  const [inline]

Returns the bits that are definitely zero.

Definition at line 258 of file instruction.h.

References known, and value.

Referenced by Instr_andwf::generateLinksAndStates().

uchar RegisterState::definiteOnes (  )  const [inline]

Returns the bits that are definitely one.

Definition at line 262 of file instruction.h.

References known, and value.

Referenced by Instr_andwf::generateLinksAndStates(), and Optimizer::optimizeInstructions().

uchar RegisterState::unknown (  )  const [inline]

Returns the bits that are unknown.

Definition at line 266 of file instruction.h.

References known.

Referenced by Optimizer::canRemove().

uchar RegisterState::maxValue (  )  const [inline]

Returns:
the largest possible value that this register might be storing, based on which bits are known and the value of those bits.

Definition at line 271 of file instruction.h.

References known, and value.

Referenced by Instr_sublw::generateLinksAndStates(), Instr_subwf::generateLinksAndStates(), and Instr_addwf::generateLinksAndStates().

uchar RegisterState::minValue (  )  const [inline]

Returns:
the smallest possible value that this register might be storing, based on which bits are known and the value of those bits.

Definition at line 276 of file instruction.h.

References known, and value.

Referenced by Instr_sublw::generateLinksAndStates(), and Instr_subwf::generateLinksAndStates().

bool RegisterState::operator== ( const RegisterState state  )  const

Returns:
whether the known and value uchars are equal

Definition at line 512 of file instruction.cpp.

References known, and value.

bool RegisterState::operator!= ( const RegisterState state  )  const [inline]

Returns:
whether either of the known and value uchars are not equal.

Definition at line 284 of file instruction.h.

void RegisterState::print (  ) 

Prints known and value.

Definition at line 518 of file instruction.cpp.

References known, and value.

Referenced by ProcessorState::print().


The documentation for this class was generated from the following files:
Generated on Tue May 8 17:05:57 2007 for KTechLab by  doxygen 1.5.1