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

#include <NullInstruction.hh>

Inheritance diagram for TTAProgram::NullInstruction:
Inheritance graph
Collaboration diagram for TTAProgram::NullInstruction:
Collaboration graph

Public Member Functions

virtual ~NullInstruction ()
 
Procedureparent () const
 
void setParent (const Procedure &proc)
 
bool isInProcedure () const
 
void addMove (Move &move)
 
int moveCount ()
 
const Movemove (int i) const
 
void addImmediate (Immediate &imm)
 
int immediateCount ()
 
Immediateimmediate (int i)
 
Addressaddress () const
 
int size () const
 
- Public Member Functions inherited from TTAProgram::Instruction
 Instruction (const TTAMachine::InstructionTemplate &instructionTemplate=TTAMachine::NullInstructionTemplate::instance())
 
 Instruction (int size, const TTAMachine::InstructionTemplate &instructionTemplate=TTAMachine::NullInstructionTemplate::instance())
 
 ~Instruction ()
 
CodeSnippetparent () const
 
void setParent (CodeSnippet &proc)
 
bool isInProcedure () const
 
void addMove (std::shared_ptr< Move > move)
 
int moveCount () const
 
Movemove (int i) const
 
std::shared_ptr< MovemovePtr (int i) const
 
void removeMove (Move &move)
 
bool isNOP () const
 
void addImmediate (std::shared_ptr< Immediate > imm)
 
int immediateCount () const
 
Immediateimmediate (int i) const
 
std::shared_ptr< ImmediateimmediatePtr (int i) const
 
void removeImmediate (Immediate &imm)
 
Address address () const
 
bool hasFinalAddress () const
 
short size () const
 
void setSize (short size)
 
bool hasRegisterAccesses () const
 
bool hasConditionalRegisterAccesses () const
 
bool hasJump () const
 
bool hasCall () const
 
bool hasReturn () const
 
bool hasControlFlowMove () const
 
Instructioncopy () const
 
void setInstructionTemplate (const TTAMachine::InstructionTemplate &insTemp)
 
const TTAMachine::InstructionTemplateinstructionTemplate () const
 
std::string toString () const
 
void setFinalAddress (InstructionAddress addr)
 
- Public Member Functions inherited from TTAProgram::AnnotatedInstructionElement
 AnnotatedInstructionElement ()
 
 ~AnnotatedInstructionElement ()
 
void addAnnotation (const ProgramAnnotation &annotation)
 
void setAnnotation (const ProgramAnnotation &annotation)
 
ProgramAnnotation annotation (int index, ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
 
int annotationCount (ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
 
void removeAnnotations (ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID)
 
bool hasAnnotations (ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
 
bool hasAnnotation (ProgramAnnotation::Id id, const TCEString &data) const
 
void copyAnnotationsFrom (const AnnotatedInstructionElement &other)
 

Static Public Member Functions

static NullInstructioninstance ()
 

Protected Member Functions

 NullInstruction ()
 

Private Member Functions

 NullInstruction (const NullInstruction &)
 Copying not allowed. More...
 
NullInstructionoperator= (const NullInstruction &)
 Assignment not allowed. More...
 

Static Private Attributes

static NullInstruction instance_
 Unique instance of NullInstruction. More...
 

Detailed Description

A singleton class that represents a null instruction.

Calling any method causes the program to abort.

Definition at line 45 of file NullInstruction.hh.

Constructor & Destructor Documentation

◆ ~NullInstruction()

TTAProgram::NullInstruction::~NullInstruction ( )
virtual

The destructor.

Definition at line 56 of file NullInstruction.cc.

56  {
57 }

◆ NullInstruction() [1/2]

TTAProgram::NullInstruction::NullInstruction ( )
protected

The constructor.

Definition at line 49 of file NullInstruction.cc.

◆ NullInstruction() [2/2]

TTAProgram::NullInstruction::NullInstruction ( const NullInstruction )
private

Copying not allowed.

Member Function Documentation

◆ addImmediate()

void TTAProgram::NullInstruction::addImmediate ( Immediate imm)

Aborts program with error log message.

Definition at line 134 of file NullInstruction.cc.

134  {
135  abortWithError("addMove()");
136 }

References abortWithError.

◆ addMove()

void TTAProgram::NullInstruction::addMove ( Move move)

Aborts program with error log message.

Definition at line 105 of file NullInstruction.cc.

105  {
106  abortWithError("addMove()");
107 }

References abortWithError.

◆ address()

Address & TTAProgram::NullInstruction::address ( ) const

Aborts program with error log message.

Returns
A null address.

Definition at line 166 of file NullInstruction.cc.

166  {
167  abortWithError("address()");
168  return NullAddress::instance();
169 }

References abortWithError, and TTAProgram::NullAddress::instance().

Here is the call graph for this function:

◆ immediate()

Immediate & TTAProgram::NullInstruction::immediate ( int  i)

Aborts program with error log message.

Returns
A null immediate.

Definition at line 154 of file NullInstruction.cc.

154  {
155  abortWithError("addMove()");
156  // to avoid warning:
157  throw new OutOfRange(__FILE__,__LINE__,__func__,"");
158 }

References __func__, and abortWithError.

◆ immediateCount()

int TTAProgram::NullInstruction::immediateCount ( )

Aborts program with error log message.

Returns
-1.

Definition at line 143 of file NullInstruction.cc.

143  {
144  abortWithError("addMove()");
145  return -1;
146 }

References abortWithError.

◆ instance()

NullInstruction & TTAProgram::NullInstruction::instance ( )
static

◆ isInProcedure()

bool TTAProgram::NullInstruction::isInProcedure ( ) const

Aborts program with error log message.

Returns
False.

Definition at line 96 of file NullInstruction.cc.

96  {
97  abortWithError("isInProcedure()");
98  return false;
99 }

References abortWithError.

◆ move()

const Move & TTAProgram::NullInstruction::move ( int  i) const

Aborts program with error log message.

Returns
A null move.

Definition at line 125 of file NullInstruction.cc.

125  {
126  abortWithError("addMove()");
127  throw OutOfRange(__FILE__,__LINE__,__func__, "Null intruction is empty.");
128 }

References __func__, and abortWithError.

◆ moveCount()

int TTAProgram::NullInstruction::moveCount ( )

Aborts program with error log message.

Returns
-1.

Definition at line 114 of file NullInstruction.cc.

114  {
115  abortWithError("addMove()");
116  return -1;
117 }

References abortWithError.

◆ operator=()

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

Assignment not allowed.

◆ parent()

Procedure & TTAProgram::NullInstruction::parent ( ) const

Aborts program with error log message.

Returns
A null procedure.
Exceptions
IllegalRegistrationnever.

Definition at line 77 of file NullInstruction.cc.

77  {
78  abortWithError("parent()");
79  return NullProcedure::instance();
80 }

References abortWithError, and TTAProgram::NullProcedure::instance().

Here is the call graph for this function:

◆ setParent()

void TTAProgram::NullInstruction::setParent ( const Procedure proc)

Aborts program with error log message.

Definition at line 86 of file NullInstruction.cc.

86  {
87  abortWithError("setParent()");
88 }

References abortWithError.

◆ size()

int TTAProgram::NullInstruction::size ( ) const

Aborts program with error log message.

Returns
-1.

Definition at line 177 of file NullInstruction.cc.

177  {
178  abortWithError("size()");
179  return -1;
180 }

References abortWithError.

Member Data Documentation

◆ instance_

NullInstruction TTAProgram::NullInstruction::instance_
staticprivate

Unique instance of NullInstruction.

Definition at line 76 of file NullInstruction.hh.

Referenced by instance().


The documentation for this class was generated from the following files:
OutOfRange
Definition: Exception.hh:320
TTAProgram::NullProcedure::instance
static NullProcedure & instance()
Definition: NullProcedure.cc:68
TTAProgram::NullInstruction::instance_
static NullInstruction instance_
Unique instance of NullInstruction.
Definition: NullInstruction.hh:76
TTAProgram::NullAddress::instance
static NullAddress & instance()
Definition: NullAddress.cc:65
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
__func__
#define __func__
Definition: Application.hh:67
TTAMachine::NullInstructionTemplate::instance
static NullInstructionTemplate & instance()
Definition: NullInstructionTemplate.cc:62
TTAProgram::Instruction::Instruction
Instruction(const TTAMachine::InstructionTemplate &instructionTemplate=TTAMachine::NullInstructionTemplate::instance())
Definition: Instruction.cc:63