OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TTAProgram::Immediate Class Reference

#include <Immediate.hh>

Collaboration diagram for TTAProgram::Immediate:
Collaboration graph

Public Member Functions

 Immediate (TerminalImmediate *value, Terminal *dst)
 
virtual ~Immediate ()
 
const Terminaldestination () const
 
TerminalImmediatevalue () const
 
void setValue (TerminalImmediate *value)
 
std::shared_ptr< Immediatecopy () const
 
Instructionparent () const
 
void setParent (Instruction *ins)
 

Private Member Functions

 Immediate (const Immediate &)
 Copying not allowed. More...
 
Immediateoperator= (const Immediate &)
 Assignment not allowed. More...
 

Private Attributes

TerminalImmediatevalue_
 Value of the immediate. More...
 
Terminaldst_
 The destination register. More...
 
Instructionparent_
 Instruction which contains this immediate. More...
 

Detailed Description

Represents the long immediate value and its transport into a dedicated register

Definition at line 54 of file Immediate.hh.

Constructor & Destructor Documentation

◆ Immediate() [1/2]

TTAProgram::Immediate::Immediate ( TerminalImmediate value,
Terminal dst 
)

The constructor.

Creates a long immediate with the given value. The value specifies, implicitly, also the width of the instruction field(s) where the immediate bits are encoded). The destination register and the set of instruction slots where the immediate bits are encoded are also given as parameters.

The ownership of the destination terminal object will be passed to the immediate.

Parameters
valueValue of the immediate.
dstDestination register.

Definition at line 68 of file Immediate.cc.

69  : value_(value), dst_(dst), parent_(nullptr) {}

◆ ~Immediate()

TTAProgram::Immediate::~Immediate ( )
virtual

The destructor.

Definition at line 74 of file Immediate.cc.

74  {
75  if (dst_ != NULL) {
76  delete dst_;
77  dst_ = NULL;
78  }
79 
80  if (value_ != NULL) {
81  delete value_;
82  value_ = NULL;
83  }
84 }

References dst_, and value_.

◆ Immediate() [2/2]

TTAProgram::Immediate::Immediate ( const Immediate )
private

Copying not allowed.

Member Function Documentation

◆ copy()

std::shared_ptr< Immediate > TTAProgram::Immediate::copy ( ) const

Makes a copy of the immediate.

The copy is identical, except that it is not registered to the instruction of the original immediate (and therefore, any address it refers to is not meaningful).

Returns
A copy of the immediate.

Definition at line 131 of file Immediate.cc.

131  {
132  return std::make_shared<Immediate>(
133  dynamic_cast<TerminalImmediate*>(value_->copy()), dst_->copy());
134 }

References TTAProgram::TerminalImmediate::copy(), TTAProgram::Terminal::copy(), dst_, and value_.

Referenced by LoopPrologAndEpilogBuilder::build(), and TTAProgram::Instruction::copy().

Here is the call graph for this function:

◆ destination()

const Terminal & TTAProgram::Immediate::destination ( ) const

◆ operator=()

Immediate& TTAProgram::Immediate::operator= ( const Immediate )
private

Assignment not allowed.

◆ parent()

Instruction* TTAProgram::Immediate::parent ( ) const
inline

Definition at line 67 of file Immediate.hh.

67 { return parent_; }

References parent_.

Referenced by ITemplateBroker::assign(), ITemplateBroker::isAlreadyAssigned(), and ITemplateBroker::unassign().

◆ setParent()

void TTAProgram::Immediate::setParent ( Instruction ins)
inline

Definition at line 68 of file Immediate.hh.

68 { parent_ = ins; }

References parent_.

Referenced by TTAProgram::Instruction::removeImmediate().

◆ setValue()

void TTAProgram::Immediate::setValue ( TerminalImmediate value)

Sets the value of immediate.

Parameters
Valueto set for immediate.

Definition at line 114 of file Immediate.cc.

114  {
115  if (value_ != NULL) {
116  delete value_;
117  }
118  value_ = value;
119 }

References value(), and value_.

Referenced by ITemplateBroker::assign(), ITemplateBroker::assignImmediate(), ControlFlowGraph::convertBBRefsToInstRefs(), TTAProgram::Program::convertSymbolRefsToInsRefs(), and CopyingDelaySlotFiller::updateJumpsAndCfg().

Here is the call graph for this function:

◆ value()

TerminalImmediate & TTAProgram::Immediate::value ( ) const

Member Data Documentation

◆ dst_

Terminal* TTAProgram::Immediate::dst_
private

The destination register.

Definition at line 79 of file Immediate.hh.

Referenced by copy(), destination(), and ~Immediate().

◆ parent_

Instruction* TTAProgram::Immediate::parent_
private

Instruction which contains this immediate.

Definition at line 82 of file Immediate.hh.

Referenced by parent(), and setParent().

◆ value_

TerminalImmediate* TTAProgram::Immediate::value_
private

Value of the immediate.

Definition at line 76 of file Immediate.hh.

Referenced by copy(), setValue(), value(), and ~Immediate().


The documentation for this class was generated from the following files:
TTAProgram::Immediate::value
TerminalImmediate & value() const
Definition: Immediate.cc:103
TTAProgram::Immediate::parent_
Instruction * parent_
Instruction which contains this immediate.
Definition: Immediate.hh:82
assert
#define assert(condition)
Definition: Application.hh:86
TTAProgram::Immediate::dst_
Terminal * dst_
The destination register.
Definition: Immediate.hh:79
TTAProgram::TerminalImmediate::copy
virtual Terminal * copy() const
Definition: TerminalImmediate.cc:85
TTAProgram::Immediate::value_
TerminalImmediate * value_
Value of the immediate.
Definition: Immediate.hh:76
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0