OpenASIP  2.0
Public Types | Public Member Functions | Public Attributes | List of all members
ParserMove Class Reference

#include <ParserStructs.hh>

Collaboration diagram for ParserMove:
Collaboration graph

Public Types

enum  MoveType { EMPTY, LONG_IMMEDIATE, TRANSPORT }
 Types of instruction slots. More...
 

Public Member Functions

 ParserMove ()
 
 ParserMove (MoveType aType, bool begin)
 
std::string toString () const
 

Public Attributes

MoveType type
 Type of move. More...
 
bool isBegin
 Tells whether the slot is the first of the instruction. More...
 
ParserGuard guard
 Guard field. More...
 
ParserSource source
 Source field. More...
 
RegisterTerm destination
 Destination field. More...
 
UValue asmLineNumber
 Line number of source code for errors. More...
 
std::vector< Annotationannotationes
 

Detailed Description

All info of one parsed instruction slot.

Instruction slot defines a move or long immediate. An instruction slot can also be empty (unused).

Definition at line 391 of file ParserStructs.hh.

Member Enumeration Documentation

◆ MoveType

Types of instruction slots.

Enumerator
EMPTY 

Empty move slot.

LONG_IMMEDIATE 

Encoding of one long immediate slot.

TRANSPORT 

Data transport (move).

Definition at line 394 of file ParserStructs.hh.

394  {
395  EMPTY, ///< Empty move slot.
396  LONG_IMMEDIATE, ///< Encoding of one long immediate slot.
397  TRANSPORT ///< Data transport (move).
398  };

Constructor & Destructor Documentation

◆ ParserMove() [1/2]

ParserMove::ParserMove ( )
inline

Empty constructor.

All values are set by hand.

Definition at line 422 of file ParserStructs.hh.

422  {
423  }

◆ ParserMove() [2/2]

ParserMove::ParserMove ( MoveType  aType,
bool  begin 
)
inline

Constructor.

Parameters
aTypeType of created move.
beginIs first move of an instruction.

Definition at line 431 of file ParserStructs.hh.

431  :
432  type(aType), isBegin(begin) {
433  }

Member Function Documentation

◆ toString()

std::string ParserMove::toString ( ) const
inline

String representation of term for error message generation.

Definition at line 438 of file ParserStructs.hh.

438  {
439  std::stringstream retVal;
440  switch (type) {
441  case EMPTY:
442  retVal << "...";
443  break;
444 
445  case LONG_IMMEDIATE:
446  retVal << "[" << destination.toString()
447  << "=" << source.toString()
448  << "]";
449 
450  for (unsigned int i = 0;i < annotationes.size();i++) {
451  retVal << annotationes[i].toString();
452  }
453 
454  break;
455 
456  case TRANSPORT:
457  retVal << guard.toString() << " "
458  << source.toString() << " -> "
459  << destination.toString();
460 
461  for (unsigned int i = 0;i < annotationes.size();i++) {
462  retVal << annotationes[i].toString();
463  }
464 
465  break;
466 
467  default:
468  retVal << "Unknown move type!\n";
469  }
470  return retVal.str();
471  }

References annotationes, destination, EMPTY, guard, LONG_IMMEDIATE, source, RegisterTerm::toString(), ParserSource::toString(), ParserGuard::toString(), TRANSPORT, and type.

Here is the call graph for this function:

Member Data Documentation

◆ annotationes

std::vector<Annotation> ParserMove::annotationes

Definition at line 415 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove(), and toString().

◆ asmLineNumber

UValue ParserMove::asmLineNumber

Line number of source code for errors.

Definition at line 413 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove().

◆ destination

RegisterTerm ParserMove::destination

Destination field.

Definition at line 411 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove(), and toString().

◆ guard

ParserGuard ParserMove::guard

Guard field.

Definition at line 407 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove(), and toString().

◆ isBegin

bool ParserMove::isBegin

Tells whether the slot is the first of the instruction.

Definition at line 404 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove().

◆ source

ParserSource ParserMove::source

Source field.

Definition at line 409 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove(), and toString().

◆ type

MoveType ParserMove::type

Type of move.

Definition at line 401 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addMove(), and toString().


The documentation for this class was generated from the following file:
ParserSource::toString
std::string toString() const
Definition: ParserStructs.hh:291
ParserMove::isBegin
bool isBegin
Tells whether the slot is the first of the instruction.
Definition: ParserStructs.hh:404
ParserMove::type
MoveType type
Type of move.
Definition: ParserStructs.hh:401
ParserMove::LONG_IMMEDIATE
@ LONG_IMMEDIATE
Encoding of one long immediate slot.
Definition: ParserStructs.hh:396
RegisterTerm::toString
std::string toString() const
Definition: ParserStructs.hh:161
ParserMove::EMPTY
@ EMPTY
Empty move slot.
Definition: ParserStructs.hh:395
ParserMove::annotationes
std::vector< Annotation > annotationes
Definition: ParserStructs.hh:415
ParserMove::TRANSPORT
@ TRANSPORT
Data transport (move).
Definition: ParserStructs.hh:397
ParserMove::destination
RegisterTerm destination
Destination field.
Definition: ParserStructs.hh:411
ParserMove::source
ParserSource source
Source field.
Definition: ParserStructs.hh:409
ParserMove::guard
ParserGuard guard
Guard field.
Definition: ParserStructs.hh:407
ParserGuard::toString
std::string toString() const
Definition: ParserStructs.hh:317