OpenASIP
2.0
|
#include <Procedure.hh>
Public Member Functions | |
Procedure (const TCEString &name, const TTAMachine::AddressSpace &space) | |
Procedure (const TCEString &name, const TTAMachine::AddressSpace &space, UIntWord startLocation) | |
virtual | ~Procedure () |
TCEString | name () const |
int | alignment () const |
Address | address (const Instruction &ins) const |
void | addFront (Instruction *) |
void | add (Instruction *ins) |
void | insertAfter (const Instruction &pos, Instruction *ins) |
void | insertBefore (const Instruction &pos, Instruction *ins) |
void | clear () |
void | remove (Instruction &ins) |
CodeSnippet * | copy () const |
virtual void | insertAfter (const Instruction &pos, Instruction *ins) |
virtual void | insertAfter (const Instruction &pos, const CodeSnippet &cs) |
virtual void | insertAfter (const Instruction &pos, CodeSnippet *cs) |
virtual void | insertBefore (const Instruction &pos, Instruction *ins) |
virtual void | insertBefore (const Instruction &pos, const CodeSnippet &cs) |
virtual void | insertBefore (const Instruction &pos, CodeSnippet *cs) |
Public Member Functions inherited from TTAProgram::CodeSnippet | |
CodeSnippet () | |
CodeSnippet (const TTAProgram::Address &start) | |
virtual | ~CodeSnippet () |
virtual void | removeLastInstruction () |
virtual int | instructionCount () const |
virtual Program & | parent () const |
virtual void | setParent (Program &prog) |
virtual bool | isInProgram () const |
virtual Address | startAddress () const |
virtual void | setStartAddress (Address start) |
virtual Address | endAddress () const |
virtual void | setEndAddress (Address end) |
virtual Instruction & | firstInstruction () const |
virtual Instruction & | instructionAt (UIntWord address) const |
virtual Instruction & | instructionAtIndex (int index) const |
virtual Instruction & | operator[] (size_t index) const |
virtual bool | hasNextInstruction (const Instruction &ins) const |
virtual Instruction & | nextInstruction (const Instruction &ins) const |
virtual Instruction & | previousInstruction (const Instruction &ins) const |
virtual Instruction & | lastInstruction () const |
virtual void | deleteInstructionAt (InstructionAddress address) |
virtual void | prepend (const CodeSnippet &cs) |
virtual void | prepend (CodeSnippet *cs) |
virtual void | append (const CodeSnippet &cs) |
virtual void | append (CodeSnippet *cs) |
virtual void | insertBefore (const Instruction &pos, const CodeSnippet &cs) |
virtual void | insertBefore (const Instruction &pos, CodeSnippet *cs) |
virtual void | insertAfter (const Instruction &pos, const CodeSnippet &cs) |
virtual void | insertAfter (const Instruction &pos, CodeSnippet *cs) |
bool | hasReturn () const |
virtual std::string | disassembly () const |
virtual std::string | toString () const |
Private Member Functions | |
Procedure (const Procedure &) | |
Copying not allowed. More... | |
Procedure & | operator= (const Procedure &) |
Assignment not allowed. More... | |
Private Attributes | |
const TCEString | name_ |
The name of the procedure. More... | |
int | alignment_ |
The alignment of instructions. More... | |
Static Private Attributes | |
static const int | INSTRUCTION_INDEX_ALIGNMENT = 1 |
The default alignment of instructions. More... | |
Additional Inherited Members | |
Protected Types inherited from TTAProgram::CodeSnippet | |
typedef std::vector< Instruction * > | InsList |
List of instructions. More... | |
typedef InsList::iterator | InsIter |
Iterator for the instruction list. More... | |
Protected Attributes inherited from TTAProgram::CodeSnippet | |
InsList | instructions_ |
The instructions in this procedure. More... | |
Program * | parent_ |
The parent program of the procedure. More... | |
Address | startAddr_ |
The start (lowest) address of the procedure. More... | |
Address | endAddr_ |
The highest address of the procedure. More... | |
Represents a TTA procedure.
Definition at line 55 of file Procedure.hh.
TTAProgram::Procedure::Procedure | ( | const TCEString & | name, |
const TTAMachine::AddressSpace & | space | ||
) |
Constructor.
Create an empty procedure in given address space. Automatically create an empty procedure scope to store all program symbols that are local to this procedure. The default value zero will be used for the start location. Alignment is 1 MAU.
name | Name of the procedure. |
space | The address space of the procedure. |
Definition at line 59 of file Procedure.cc.
Referenced by copy().
TTAProgram::Procedure::Procedure | ( | const TCEString & | name, |
const TTAMachine::AddressSpace & | space, | ||
UIntWord | startLocation | ||
) |
Alternative constructor that takes the start location of the procedure.
name | Name of the procedure. |
space | The address space of the procedure. |
startLocation | The start location of the procedure. |
Definition at line 71 of file Procedure.cc.
|
virtual |
|
private |
Copying not allowed.
|
virtual |
Adds an instruction as the last instruction in the procedure.
Remaining procedures in the parent program will be relocated as needed. The ownership of the instruction will be passed to the procedure.
ins | The instruction to add. |
IllegalRegistration | if the instruction is already registered in another procedure. |
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 160 of file Procedure.cc.
References TTAProgram::CodeSnippet::instructions_, TTAProgram::Instruction::isInProcedure(), TTAProgram::Program::lastProcedure(), TTAProgram::Program::moveProcedure(), TTAProgram::Program::nextProcedure(), TTAProgram::Instruction::parent(), TTAProgram::CodeSnippet::parent_, and TTAProgram::Instruction::setParent().
Referenced by ProgrammabilityValidator::addConnectionToProgram(), copy(), TTAProgram::Program::copyFrom(), TTAProgram::CodeGenerator::createSchedYieldProcedure(), insertAfter(), and llvm::LLVMTCEBuilder::writeMachineFunction().
|
inlinevirtual |
Adds an instruction as the first instruction in the code snippet.
The ownership of the instruction will be passed to the code snippet.
ins | The instruction to add. |
IllegalRegistration | if the instruction is already registered in another code snippet. |
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 73 of file Procedure.hh.
References abortWithError.
|
virtual |
Returns the address of the given instruction.
IllegalRegistration | if the instruction does not belong to this procedure. |
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 101 of file Procedure.cc.
References TTAProgram::Instruction::address(), assert, TTAProgram::Instruction::hasFinalAddress(), TTAProgram::CodeSnippet::instructions_, TTAProgram::CodeSnippet::isInProgram(), TTAProgram::Address::location(), TTAProgram::CodeSnippet::parent(), TTAProgram::Address::space(), and TTAProgram::CodeSnippet::startAddr_.
Referenced by AbsoluteToRelativeJumps::handleProcedure().
int TTAProgram::Procedure::alignment | ( | ) | const |
Returns the alignment.
Definition at line 89 of file Procedure.cc.
References alignment_.
Referenced by ControlFlowGraph::buildFrom().
|
virtual |
Clears a procedure, updates addresses of following addresses.
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 345 of file Procedure.cc.
References TTAProgram::CodeSnippet::clear(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Program::lastProcedure(), TTAProgram::Program::moveProcedure(), TTAProgram::Program::nextProcedure(), and TTAProgram::CodeSnippet::parent_.
Referenced by SequentialScheduler::copyBasicBlocksToProcedure(), ControlFlowGraph::copyToProcedure(), and BBSchedulerController::handleProcedure().
|
virtual |
Make a complete copy of the procedure.
The copy is identical, except that it is not registered to the program of the original procedure.
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 137 of file Procedure.cc.
References add(), TTAProgram::Instruction::copy(), TTAProgram::CodeSnippet::instructionAtIndex(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Address::location(), name_, Procedure(), TTAProgram::Address::space(), and TTAProgram::CodeSnippet::startAddr_.
Referenced by TTAProgram::Program::link().
void TTAProgram::CodeSnippet::insertAfter |
Inserts a whole code snippet into this code snippet just after specified instruction.
This function moves the ownership of the moves and deletes the another code snippet.
ins | The succeeding the place where to insert he instructions. |
cs | CodeSnippet containing the instructions being inserted. |
Definition at line 690 of file CodeSnippet.cc.
void TTAProgram::CodeSnippet::insertAfter |
Inserts a whole code snippet into this code snippet just after specified instruction.
This function does not remove the instruction references from the code snippet.
ins | The succeeding the place where to insert he instructions. |
cs | CodeSnippet containing the instructions being inserted. |
Definition at line 671 of file CodeSnippet.cc.
|
virtual |
Insert the given instruction after the given position.
Instructions from pos are relocated to make room for the new instruction.
pos | The position. |
ins | The instruction to insert. |
IllegalRegistration | if pos does not belong to the procedure or ins already belongs to a procedure. |
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 193 of file Procedure.cc.
References __func__, add(), TTAProgram::CodeSnippet::instructions_, TTAProgram::Instruction::isInProcedure(), TTAProgram::Program::lastProcedure(), TTAProgram::Program::moveProcedure(), TTAProgram::Program::nextProcedure(), TTAProgram::CodeSnippet::parent_, and TTAProgram::Instruction::setParent().
Referenced by ProcedurePass::copyCfgToProcedure().
void TTAProgram::CodeSnippet::insertAfter |
Insert the given instruction after the given position.
Instructions from pos are relocated to make room for the new instruction.
pos | The position. |
ins | The instruction to insert. |
IllegalRegistration | if pos does not belong to the code snippet or ins already belongs to a code snippet. |
Definition at line 462 of file CodeSnippet.cc.
void TTAProgram::CodeSnippet::insertBefore |
Inserts a whole code snippet into this code snippet just before specified instruction. This function moves the ownership of the moves and deletes the another code snippet.
ins | The succeeding the place where to insert he instructions. |
cs | CodeSnippet containing the instructions being inserted. |
Definition at line 650 of file CodeSnippet.cc.
void TTAProgram::CodeSnippet::insertBefore |
Inserts a whole code snippet into this code snippet just before specified instruction.
This function does not remove the instruction references from the code snippet.
ins | The succeeding the place where to insert he instructions. |
cs | CodeSnippet containing the instructions being inserted. |
Definition at line 632 of file CodeSnippet.cc.
|
virtual |
Insert the given instruction before the given position.
Instructions from and including pos are relocated to make room for the new instruction.
pos | The position. |
ins | The instruction to insert. |
IllegalRegistration | if pos does not belong to the procedure or ins already belongs to a procedure. |
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 242 of file Procedure.cc.
References assert, TTAProgram::CodeSnippet::instructions_, TTAProgram::Instruction::isInProcedure(), TTAProgram::Program::lastProcedure(), TTAProgram::Program::moveProcedure(), TTAProgram::Program::nextProcedure(), TTAProgram::CodeSnippet::parent_, and TTAProgram::Instruction::setParent().
void TTAProgram::CodeSnippet::insertBefore |
Insert the given instruction before the given position.
Instructions from and including pos are relocated to make room for the new instruction.
pos | The position. |
ins | The instruction to insert. |
IllegalRegistration | if pos does not belong to the code snippet or ins already belongs to a code snippet. |
Definition at line 514 of file CodeSnippet.cc.
|
inline |
Definition at line 66 of file Procedure.hh.
References name_.
Referenced by ControlFlowGraph::buildFrom(), TTAProgram::CodeLabel::CodeLabel(), TTAProgram::Program::copyFrom(), ControlFlowGraph::copyToProcedure(), TTAProgram::ProgramWriter::createBinary(), TTAProgram::ProgramWriter::createCodeSection(), BBSchedulerController::createDDGFromBB(), POMDisassembler::disassemble(), SimulatorFrontend::disassembleInstruction(), llvm::LLVMTCEIRBuilder::doFinalization(), ProgramPass::executeProcedurePass(), TTASimulationController::findProgramExitPoints(), SimulatorFrontend::finishSimulation(), TTAProgram::Program::fixInstructionReferences(), CompiledSimCodeGenerator::generateInstruction(), BBSchedulerController::handleProcedure(), main(), POMDisassembler::procedureDescription(), SimulatorFrontend::programLocationDescription(), and TTAProgram::InstructionReferenceManager::validate().
|
virtual |
Remove instruction from the procedure.
The instruction becomes independent (it is not deleted). All instructions following the removed procedure are relocated appropriately. All code labels attached to the removed instruction are deleted from the Program.
ins | Instruction to remove. |
IllegalRegistration | If instruction does not belong to the procedure. |
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 297 of file Procedure.cc.
References __func__, TTAProgram::CodeSnippet::firstInstruction(), TTAProgram::Program::globalScope(), TTAProgram::InstructionReferenceManager::hasReference(), TTAProgram::NullProcedure::instance(), TTAProgram::Program::instructionReferenceManager(), TTAProgram::CodeSnippet::instructions_, TTAProgram::Instruction::isInProcedure(), TTAProgram::Program::lastProcedure(), TTAProgram::Address::location(), TTAProgram::Program::moveProcedure(), TTAProgram::Program::nextProcedure(), TTAProgram::CodeSnippet::parent(), TTAProgram::Instruction::parent(), TTAProgram::CodeSnippet::parent_, TTAProgram::GlobalScope::removeCodeLabels(), TTAProgram::Instruction::setParent(), and TTAProgram::CodeSnippet::startAddr_.
Referenced by ProcedurePass::copyCfgToProcedure(), and TTAProgram::CodeGenerator::createSchedYieldProcedure().
|
private |
The alignment of instructions.
Definition at line 99 of file Procedure.hh.
Referenced by alignment().
|
staticprivate |
The default alignment of instructions.
Definition at line 101 of file Procedure.hh.
|
private |
The name of the procedure.
Definition at line 97 of file Procedure.hh.