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

#include <DisassemblyImmediateAssignment.hh>

Inheritance diagram for DisassemblyImmediateAssignment:
Inheritance graph
Collaboration diagram for DisassemblyImmediateAssignment:
Collaboration graph

Public Member Functions

 DisassemblyImmediateAssignment (SimValue value, bool sign, DisassemblyElement *destination)
 
virtual ~DisassemblyImmediateAssignment ()
 
virtual std::string toString () const
 
- Public Member Functions inherited from DisassemblyInstructionSlot
virtual ~DisassemblyInstructionSlot ()
 
DisassemblyAnnotationannotation (int index) const
 
void addAnnotation (DisassemblyAnnotation *annotation)
 
int annotationCount () const
 

Private Member Functions

 DisassemblyImmediateAssignment (const DisassemblyImmediateAssignment &)
 Coying not allowed. More...
 
DisassemblyImmediateAssignmentoperator= (const DisassemblyImmediateAssignment &)
 Assignment not allowed. More...
 

Private Attributes

SimValue value_
 Value of the immediate. More...
 
DisassemblyElementdestination_
 The destination register. More...
 
bool hasValue_
 True, if the immediate has value set. More...
 
bool signed_
 True, if the imm unit is signed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from DisassemblyInstructionSlot
 DisassemblyInstructionSlot ()
 

Detailed Description

Represents piece of long immediate assignment in the disassembler.

If the long immediate value is given using the constructor with value parameter, disassembly string displays the value.

Definition at line 46 of file DisassemblyImmediateAssignment.hh.

Constructor & Destructor Documentation

◆ DisassemblyImmediateAssignment() [1/2]

DisassemblyImmediateAssignment::DisassemblyImmediateAssignment ( SimValue  value,
bool  sign,
DisassemblyElement destination 
)

The Constructor.

Creates disassembly of an immediate assignment.

Parameters
valueValue of the immediate to assign.
destinationThe destination register.

Definition at line 44 of file DisassemblyImmediateAssignment.cc.

47  :
49  value_(value), destination_(destination), hasValue_(true), signed_(sign) {
50 
51 }

◆ ~DisassemblyImmediateAssignment()

DisassemblyImmediateAssignment::~DisassemblyImmediateAssignment ( )
virtual

The destructor.

Definition at line 56 of file DisassemblyImmediateAssignment.cc.

56  {
57  delete destination_;
58 }

References destination_.

◆ DisassemblyImmediateAssignment() [2/2]

DisassemblyImmediateAssignment::DisassemblyImmediateAssignment ( const DisassemblyImmediateAssignment )
private

Coying not allowed.

Member Function Documentation

◆ operator=()

DisassemblyImmediateAssignment& DisassemblyImmediateAssignment::operator= ( const DisassemblyImmediateAssignment )
private

Assignment not allowed.

◆ toString()

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

Disassembles the immediate assignment.

Returns
Disassembled immediate assignment as a string.

Implements DisassemblyInstructionSlot.

Definition at line 67 of file DisassemblyImmediateAssignment.cc.

67  {
68  std::string disassembly = "[" + destination_->toString();
69  if (hasValue_) {
70  if (signed_) {
71  disassembly =
72  disassembly + "=" + Conversion::toString(value_.sLongWordValue());
73  } else {
74  disassembly =
75  disassembly + "=" + Conversion::toString(value_.uLongWordValue());
76  }
77  }
78  disassembly = disassembly + "]";
79 
80  for (int i = 0; i < annotationCount(); i++) {
81  disassembly += annotation(i).toString();
82  }
83 
84  return disassembly;
85 }

References DisassemblyInstructionSlot::annotation(), DisassemblyInstructionSlot::annotationCount(), destination_, hasValue_, signed_, SimValue::sLongWordValue(), DisassemblyElement::toString(), DisassemblyAnnotation::toString(), Conversion::toString(), SimValue::uLongWordValue(), and value_.

Referenced by DisassemblyGridTable::GetValue(), and DisassemblyInstruction::toString().

Here is the call graph for this function:

Member Data Documentation

◆ destination_

DisassemblyElement* DisassemblyImmediateAssignment::destination_
private

The destination register.

Definition at line 66 of file DisassemblyImmediateAssignment.hh.

Referenced by toString(), and ~DisassemblyImmediateAssignment().

◆ hasValue_

bool DisassemblyImmediateAssignment::hasValue_
private

True, if the immediate has value set.

Definition at line 68 of file DisassemblyImmediateAssignment.hh.

Referenced by toString().

◆ signed_

bool DisassemblyImmediateAssignment::signed_
private

True, if the imm unit is signed.

Definition at line 70 of file DisassemblyImmediateAssignment.hh.

Referenced by toString().

◆ value_

SimValue DisassemblyImmediateAssignment::value_
private

Value of the immediate.

Definition at line 64 of file DisassemblyImmediateAssignment.hh.

Referenced by toString().


The documentation for this class was generated from the following files:
DisassemblyInstructionSlot::annotationCount
int annotationCount() const
Definition: DisassemblyInstructionSlot.cc:80
DisassemblyInstructionSlot::annotation
DisassemblyAnnotation & annotation(int index) const
Definition: DisassemblyInstructionSlot.cc:60
SimValue::sLongWordValue
SLongWord sLongWordValue() const
Definition: SimValue.cc:997
DisassemblyImmediateAssignment::value_
SimValue value_
Value of the immediate.
Definition: DisassemblyImmediateAssignment.hh:64
Conversion::toString
static std::string toString(const T &source)
DisassemblyImmediateAssignment::destination_
DisassemblyElement * destination_
The destination register.
Definition: DisassemblyImmediateAssignment.hh:66
DisassemblyImmediateAssignment::hasValue_
bool hasValue_
True, if the immediate has value set.
Definition: DisassemblyImmediateAssignment.hh:68
DisassemblyAnnotation::toString
virtual std::string toString() const
Definition: DisassemblyAnnotation.cc:61
SimValue::uLongWordValue
ULongWord uLongWordValue() const
Definition: SimValue.cc:1027
DisassemblyImmediateAssignment::signed_
bool signed_
True, if the imm unit is signed.
Definition: DisassemblyImmediateAssignment.hh:70
DisassemblyElement::toString
virtual std::string toString() const =0
DisassemblyInstructionSlot::DisassemblyInstructionSlot
DisassemblyInstructionSlot()
Definition: DisassemblyInstructionSlot.cc:39