OpenASIP  2.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
DisassemblyRegister Class Reference

#include <DisassemblyRegister.hh>

Inheritance diagram for DisassemblyRegister:
Inheritance graph
Collaboration diagram for DisassemblyRegister:
Collaboration graph

Public Member Functions

 DisassemblyRegister (std::string rfName, Word index)
 
virtual ~DisassemblyRegister ()
 
std::string toString () const
 
- Public Member Functions inherited from DisassemblyElement
virtual ~DisassemblyElement ()
 

Static Public Member Functions

static TCEString registerName (const TTAMachine::RegisterFile &rf, int index, char delim='.')
 
static TCEString registerName (const TTAProgram::Terminal &term)
 
static TCEString registerName (const TCEString &registerFileName, int index, char delim='.')
 

Private Attributes

std::string rfName_
 Name of the register file. More...
 
Word index_
 Index of the register in the register file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from DisassemblyElement
 DisassemblyElement ()
 

Detailed Description

Represents a register in the disassembler.

Definition at line 51 of file DisassemblyRegister.hh.

Constructor & Destructor Documentation

◆ DisassemblyRegister()

DisassemblyRegister::DisassemblyRegister ( std::string  rfName,
Word  index 
)

The constructor.

Parameters
rfNameName of the register file.
indexIndex of the register in the register file.

Definition at line 45 of file DisassemblyRegister.cc.

45  :
47  rfName_(rfName),
48  index_(index) {
49 }

◆ ~DisassemblyRegister()

DisassemblyRegister::~DisassemblyRegister ( )
virtual

The destructor.

Definition at line 55 of file DisassemblyRegister.cc.

55  {
56 }

Member Function Documentation

◆ registerName() [1/3]

TCEString DisassemblyRegister::registerName ( const TCEString rfName,
int  index,
char  delim = '.' 
)
static

Returns a name of the register.

Does the int -> string conversion itself, because Conversion::toString() uses stringstream which is slow.

Definition at line 77 of file DisassemblyRegister.cc.

78  {
79  char buf[12];
80  char *ptr = buf + sizeof(buf);
81  *--ptr = 0; // last to terminating zero.
82  // conversion from 2 to 10 base
83  do {
84  *--ptr = (index%10) + 48; // 48 is conversion to ascii.
85  index /= 10;
86  } while (index);
87  *--ptr = delim;
88  return rfName + ptr;
89 }

◆ registerName() [2/3]

TCEString DisassemblyRegister::registerName ( const TTAMachine::RegisterFile rf,
int  index,
char  delim = '.' 
)
static

◆ registerName() [3/3]

TCEString DisassemblyRegister::registerName ( const TTAProgram::Terminal term)
static

Returns name of a register which is in a terminalregister.

Definition at line 104 of file DisassemblyRegister.cc.

105  {
106  return registerName(term.registerFile(), term.index());
107 }

References TTAProgram::Terminal::index(), TTAProgram::Terminal::registerFile(), and registerName().

Here is the call graph for this function:

◆ toString()

std::string DisassemblyRegister::toString ( ) const
virtual

Returns disassembly of the register file.

Returns
Disassembly of the register as a string.

Implements DisassemblyElement.

Definition at line 66 of file DisassemblyRegister.cc.

66  {
67  return registerName(rfName_, index_);
68 }

References index_, registerName(), and rfName_.

Referenced by ProximRegisterWindow::loadImmediateUnit(), ProximRegisterWindow::loadRegisterFile(), and TTAProgram::TerminalRegister::toString().

Here is the call graph for this function:

Member Data Documentation

◆ index_

Word DisassemblyRegister::index_
private

Index of the register in the register file.

Definition at line 74 of file DisassemblyRegister.hh.

Referenced by toString().

◆ rfName_

std::string DisassemblyRegister::rfName_
private

Name of the register file.

Definition at line 72 of file DisassemblyRegister.hh.

Referenced by toString().


The documentation for this class was generated from the following files:
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
TTAProgram::Terminal::registerFile
virtual const TTAMachine::RegisterFile & registerFile() const
Definition: Terminal.cc:225
DisassemblyRegister::index_
Word index_
Index of the register in the register file.
Definition: DisassemblyRegister.hh:74
DisassemblyRegister::rfName_
std::string rfName_
Name of the register file.
Definition: DisassemblyRegister.hh:72
DisassemblyElement::DisassemblyElement
DisassemblyElement()
Definition: DisassemblyElement.cc:38
DisassemblyRegister::registerName
static TCEString registerName(const TTAMachine::RegisterFile &rf, int index, char delim='.')
Definition: DisassemblyRegister.cc:95