OpenASIP
2.0
|
#include <Instruction.hh>
Private Types | |
typedef std::vector< std::shared_ptr< Move > > | MoveList |
List for moves. More... | |
typedef std::vector< std::shared_ptr< Immediate > > | ImmList |
List for immediates. More... | |
Private Member Functions | |
Instruction (const Instruction &) | |
Copying not allowed. More... | |
Instruction & | operator= (const Instruction &) |
Assignment not allowed. More... | |
Private Attributes | |
MoveList | moves_ |
Moves contained in this instruction. More... | |
ImmList | immediates_ |
Immediates contained in this instruction. More... | |
CodeSnippet * | parent_ |
Parent procedure. More... | |
const TTAMachine::InstructionTemplate * | insTemplate_ |
Instruction template that is used for this instruction. More... | |
InstructionAddress | positionInProcedure_ |
Cache the instruction's index in the its procedure for faster address(). More... | |
InstructionAddress | finalAddress_ |
In case the final instruction address is known (due to program not modified anymore), the final instruction address is stored here. -1 in case not known. More... | |
short | size_ |
Size of instruction in MAU's. More... | |
bool | hasRegisterAccesses_ |
Set to true in case this instruction has moves that access registers. More... | |
bool | hasConditionalRegisterAccesses_ |
Set to true in case this instruction has moves that access registers and are conditional. More... | |
Represents a TTA instruction.
Definition at line 57 of file Instruction.hh.
|
private |
List for immediates.
Definition at line 127 of file Instruction.hh.
|
private |
List for moves.
Definition at line 125 of file Instruction.hh.
TTAProgram::Instruction::Instruction | ( | const TTAMachine::InstructionTemplate & | instructionTemplate = TTAMachine::NullInstructionTemplate::instance() | ) |
The constructor.
The default size of an instruction is 1 MAU.
Definition at line 63 of file Instruction.cc.
Referenced by copy().
|
explicit |
Constructor.
Alternative constructor that takes the instruction size as a parameter.
size | The size of the instruction in MAU's. |
Definition at line 78 of file Instruction.cc.
References assert, and size().
TTAProgram::Instruction::~Instruction | ( | ) |
The destructor.
Definition at line 93 of file Instruction.cc.
References immediates_, TTAProgram::NullInstruction::instance(), and moves_.
|
private |
Copying not allowed.
void TTAProgram::Instruction::addImmediate | ( | std::shared_ptr< Immediate > | imm | ) |
Adds an immediate to the instruction.
The ownership of the immediate will be passed to the instruction.
imm | The immediate to add. |
Definition at line 234 of file Instruction.cc.
References __func__, assert, ContainerTools::containsValue(), immediates_, TTAMachine::NullInstructionTemplate::instance(), insTemplate_, MathTools::requiredBits(), and TTAMachine::InstructionTemplate::supportedWidth().
Referenced by ITemplateBroker::assign(), ITemplateBroker::assignImmediate(), LoopPrologAndEpilogBuilder::build(), copy(), TTAProgram::TPEFProgramFactory::createInstruction(), and ITemplateBroker::unassign().
void TTAProgram::Instruction::addMove | ( | std::shared_ptr< Move > | move | ) |
Adds a move to the instruction.
The ownership of the move will be passed to the instruction.
move | The move to add. |
Definition at line 147 of file Instruction.cc.
References __func__, assert, TTAProgram::Move::bus(), ContainerTools::containsValue(), TTAProgram::Move::destination(), hasConditionalRegisterAccesses_, hasRegisterAccesses_, TTAMachine::NullInstructionTemplate::instance(), insTemplate_, TTAProgram::Terminal::isGPR(), TTAProgram::Move::isUnconditional(), move(), moves_, TTAMachine::Component::name(), TTAProgram::Move::setParent(), TTAProgram::Move::source(), and TTAMachine::InstructionTemplate::usesSlot().
Referenced by TTAProgram::CodeGenerator::addAnnotatedMoveToProcedure(), ProgrammabilityValidator::addConnectionToProgram(), SimpleIfConverter::addJump(), TTAProgram::CodeGenerator::addMoveToProcedure(), Peel2BBLoops::appendBB(), SimpleIfConverter::appendBB(), ITemplateBroker::assign(), LoopPrologAndEpilogBuilder::build(), ProGe::RV32MicroCodeGenerator::constructBInstructions(), ProGe::RV32MicroCodeGenerator::constructIInstructions(), ProGe::RV32MicroCodeGenerator::constructRInstructions(), ProGe::RV32MicroCodeGenerator::constructSInstructions(), ProGe::RV32MicroCodeGenerator::constructUJInstructions(), copy(), TTAProgram::TPEFProgramFactory::createInstruction(), ProgramDependenceGraph::createJump(), llvm::LLVMTCEBuilder::emitComparisonForBranch(), llvm::LLVMTCEBuilder::emitGlobalXXtructorCalls(), llvm::LLVMTCEBuilder::emitInstruction(), llvm::LLVMTCEPOMBuilder::emitMove(), llvm::LLVMTCEBuilder::emitMove(), llvm::LLVMTCEBuilder::emitOperationMacro(), llvm::LLVMTCEBuilder::emitRemaingingBrach(), llvm::LLVMTCEBuilder::emitReturn(), llvm::LLVMTCEBuilder::emitSelect(), llvm::LLVMTCEBuilder::emitSPInitialization(), CallsToJumps::handleControlFlowGraph(), ProgramDependenceGraph::processPredicate(), ProgramDependenceGraph::processRegion(), PreOptimizer::tryToRemoveGuardInversingOp(), and ITemplateBroker::unassign().
Address TTAProgram::Instruction::address | ( | ) | const |
Returns the address of the instruction.
IllegalRegistration | if the instruction does not belong to a procedure. |
Definition at line 327 of file Instruction.cc.
References __func__, TTAProgram::CodeSnippet::address(), POMDisassembler::disassemble(), finalAddress_, isInProcedure(), TTAProgram::Address::location(), parent(), positionInProcedure_, and TTAProgram::CodeSnippet::startAddress().
Referenced by TTAProgram::TerminalInstructionReference::address(), TTAProgram::CodeLabel::address(), TTAProgram::Procedure::address(), TTAProgram::CodeSnippet::address(), SimProgramBuilder::build(), CompiledSimUtilizationStats::calculate(), SimulationStatistics::calculate(), POMValidator::checkCompiledSimulatability(), POMValidator::checkConnectivity(), POMValidator::checkLongImmediates(), POMValidator::checkSimulatability(), TTAProgram::CodeLabel::CodeLabel(), ControlFlowGraph::computeLeadersFromJumpSuccessors(), ControlFlowGraph::computeLeadersFromRefManager(), ProcedurePass::copyCfgToProcedure(), SequentialScheduler::createBasicBlocks(), ControlFlowGraph::createBBEdges(), ControlFlowGraph::createBlock(), TTAProgram::ProgramWriter::createCodeSection(), ControlFlowGraph::createControlFlowEdge(), ControlFlowGraph::createJumps(), SimulatorFrontend::currentProcedure(), TTAProgram::DataInstructionAddressDef::destinationAddress(), ControlFlowGraph::directJump(), POMDisassembler::disassemble(), DisassembleCommand::execute(), TTAProgram::Program::finalize(), ControlFlowGraph::findNextIndex(), TTASimulationController::findProgramExitPoints(), SimulatorFrontend::finishSimulation(), TTAProgram::Program::fixInstructionReferences(), CompiledSimCodeGenerator::generateInstruction(), DisassemblyGridTable::GetNumberRows(), ProcedureTransferTracker::handleEvent(), RFAccessTracker::handleEvent(), TTAProgram::CodeSnippet::instructionAt(), TTAProgram::CodeSnippet::nextInstruction(), TTAProgram::Program::nextInstruction(), TTAProgram::CodeSnippet::previousInstruction(), POMDisassembler::printAddress(), CompiledSimController::reset(), DisasmTopCountAttrProvider::updateTopCountTable(), and TTAProgram::InstructionReferenceManager::validate().
Instruction * TTAProgram::Instruction::copy | ( | ) | const |
Make a complete copy of the instruction.
The copy is identical, except that it is not registered to the procedure of the original instruction (and therefore, any address it refers to is not meaningful).
Definition at line 379 of file Instruction.cc.
References addImmediate(), addMove(), TTAProgram::Immediate::copy(), TTAProgram::Move::copy(), TTAProgram::AnnotatedInstructionElement::copyAnnotationsFrom(), hasConditionalRegisterAccesses_, hasRegisterAccesses_, immediate(), immediateCount(), insTemplate_, Instruction(), move(), moveCount(), and size_.
Referenced by TTAProgram::CodeSnippet::append(), TTAProgram::Procedure::copy(), TTAProgram::BasicBlock::copy(), TTAProgram::CodeSnippet::copy(), SequentialScheduler::copyBasicBlocksToProcedure(), ProcedurePass::copyCfgToProcedure(), TTAProgram::Program::copyFrom(), ControlFlowGraph::copyToProcedure(), SequentialScheduler::createBasicBlocks(), ControlFlowGraph::createBlock(), TTAProgram::CodeSnippet::insertAfter(), TTAProgram::CodeSnippet::insertBefore(), and TTAProgram::CodeSnippet::prepend().
bool TTAProgram::Instruction::hasCall | ( | ) | const |
Returns whether this instruction contains moves that are calls.
Definition at line 438 of file Instruction.cc.
References TTAProgram::Move::isCall(), move(), and moveCount().
Referenced by CopyingDelaySlotFiller::collectMoves(), CopyingDelaySlotFiller::findJump(), CallsToJumps::handleControlFlowGraph(), and ControlFlowGraph::splitBasicBlocksWithCallsAndRefs().
bool TTAProgram::Instruction::hasConditionalRegisterAccesses | ( | ) | const |
Returns true in case this Instruction contains moves that access registers and are conditional.
This method can be used to optimize register utilization analysis.
Definition at line 412 of file Instruction.cc.
References hasConditionalRegisterAccesses_.
Referenced by RFAccessTracker::handleEvent().
bool TTAProgram::Instruction::hasControlFlowMove | ( | ) | const |
Returns whether this instruction contains moves that affect the control flow (branches or calls).
Definition at line 471 of file Instruction.cc.
References TTAProgram::Move::isControlFlowMove(), move(), and moveCount().
Referenced by llvm::LLVMTCEIRBuilder::buildTCECFG(), BasicBlockPass::copyRMToBB(), SequentialScheduler::createBasicBlocks(), ProgramDependenceGraph::createJump(), and ControlFlowGraph::findNextIndex().
|
inline |
Definition at line 100 of file Instruction.hh.
References finalAddress_.
Referenced by TTAProgram::Procedure::address(), and TTAProgram::CodeSnippet::address().
bool TTAProgram::Instruction::hasJump | ( | ) | const |
Returns whether this instruction contains moves that are jumps.
Definition at line 422 of file Instruction.cc.
References TTAProgram::Move::isJump(), move(), and moveCount().
Referenced by BBSchedulerController::handleBasicBlock(), and SimpleIfConverter::removeJump().
bool TTAProgram::Instruction::hasRegisterAccesses | ( | ) | const |
Returns true in case this Instruction contains moves that access registers.
This method can be used to optimize register utilization analysis.
Definition at line 399 of file Instruction.cc.
References hasRegisterAccesses_.
Referenced by RFAccessTracker::handleEvent().
bool TTAProgram::Instruction::hasReturn | ( | ) | const |
Returns whether this instruction contains a procedure return move.
Definition at line 452 of file Instruction.cc.
References TTAProgram::Move::isReturn(), move(), and moveCount().
Immediate & TTAProgram::Instruction::immediate | ( | int | i | ) | const |
Return the immediate write action at the given index in this instruction.
The order of immediates is arbitrary, no assumption should be made by clients.
i | The index of the immediate. |
OutOfRange | if the index is negative or greater than the number of immediates in the instruction. |
Definition at line 285 of file Instruction.cc.
References __func__, immediates_, and Conversion::toString().
Referenced by CodeCompressorPlugin::addBitsForDstRegisterField(), ITemplateBroker::assign(), LoopPrologAndEpilogBuilder::build(), CopyingDelaySlotFiller::checkImmediatesAfter(), POMValidator::checkLongImmediates(), CopyingDelaySlotFiller::collectMoves(), ControlFlowGraph::convertBBRefsToInstRefs(), TTAProgram::Program::convertSymbolRefsToInsRefs(), copy(), TTAProgram::ProgramWriter::createCodeSection(), POMDisassembler::createInstruction(), ControlFlowGraph::createJumps(), POMDisassembler::disassemble(), CodeCompressorPlugin::encodeLongImmediate(), ControlFlowGraph::findLimmWrite(), TTAProgram::Program::fixInstructionReferences(), CompiledSimCodeGenerator::generateInstruction(), ProgramImageGenerator::generateProgramImage(), getInstructionReferenceTerminals(), ITemplateBroker::isImmediateInTemplate(), main(), LoopPrologAndEpilogBuilder::optimizeProlog(), SimProgramBuilder::processInstruction(), CodeCompressorPlugin::programImmediate(), setInstructionTemplate(), CopyingDelaySlotFiller::tryToAssignNodes(), ITemplateBroker::unassignImmediate(), CopyingDelaySlotFiller::updateFTBBAndCfg(), and CopyingDelaySlotFiller::updateJumpsAndCfg().
int TTAProgram::Instruction::immediateCount | ( | ) | const |
Returns the number of immediate registers written by the instruction template of this instruction.
Definition at line 267 of file Instruction.cc.
References immediates_.
Referenced by CodeCompressorPlugin::addBitsForDstRegisterField(), ITemplateBroker::assign(), LoopPrologAndEpilogBuilder::build(), CopyingDelaySlotFiller::checkImmediatesAfter(), POMValidator::checkLongImmediates(), CopyingDelaySlotFiller::collectMoves(), ControlFlowGraph::convertBBRefsToInstRefs(), TTAProgram::Program::convertSymbolRefsToInsRefs(), copy(), TTAProgram::ProgramWriter::createCodeSection(), POMDisassembler::createInstruction(), ControlFlowGraph::createJumps(), POMDisassembler::disassemble(), CodeCompressorPlugin::encodeLongImmediate(), ITemplateBroker::findITemplates(), CopyingDelaySlotFiller::findJumpImmediate(), ControlFlowGraph::findLimmWrite(), TTAProgram::Program::fixInstructionReferences(), CompiledSimCodeGenerator::generateInstruction(), ProgramImageGenerator::generateProgramImage(), getInstructionReferenceTerminals(), CodeCompressorPlugin::instructionTemplate(), ITemplateBroker::isImmediateInTemplate(), isNOP(), main(), LoopPrologAndEpilogBuilder::optimizeProlog(), SimProgramBuilder::processInstruction(), CodeCompressorPlugin::programImmediate(), ControlFlowGraph::removeJumpToTarget(), BFUnscheduleFromBody::returnOriginal(), BFUnscheduleMove::returnOriginal(), setInstructionTemplate(), TTAProgram::BasicBlock::statistics(), CopyingDelaySlotFiller::tryToAssignNodes(), SimpleBrokerDirector::unassign(), ITemplateBroker::unassignImmediate(), CopyingDelaySlotFiller::updateFTBBAndCfg(), and CopyingDelaySlotFiller::updateJumpsAndCfg().
std::shared_ptr< Immediate > TTAProgram::Instruction::immediatePtr | ( | int | i | ) | const |
Return the immediate write action at the given index in this instruction.
The order of immediates is arbitrary, no assumption should be made by clients.
i | The index of the immediate. |
OutOfRange | if the index is negative or greater than the number of immediates in the instruction. |
Definition at line 309 of file Instruction.cc.
References __func__, immediates_, and Conversion::toString().
Referenced by ITemplateBroker::findITemplates(), CopyingDelaySlotFiller::findJumpImmediate(), and AbsoluteToRelativeJumps::handleProcedure().
const TTAMachine::InstructionTemplate & TTAProgram::Instruction::instructionTemplate | ( | ) | const |
Returns the instruction template of instruction.
Definition at line 523 of file Instruction.cc.
References insTemplate_.
Referenced by ITemplateBroker::assign(), ITemplateBroker::assignImmediate(), POMValidator::checkLongImmediates(), BasicBlockPass::copyRMToBB(), POMDisassembler::disassemble(), CodeCompressorPlugin::encodeLongImmediate(), CodeCompressorPlugin::instructionTemplate(), ITemplateBroker::isAlreadyAssigned(), MoveNode::isAssigned(), and ITemplateBroker::unassignImmediate().
bool TTAProgram::Instruction::isInProcedure | ( | ) | const |
Tells whether the instruction belongs to a procedure.
Definition at line 135 of file Instruction.cc.
References TTAProgram::NullProcedure::instance(), and parent_.
Referenced by TTAProgram::Procedure::add(), TTAProgram::CodeSnippet::add(), TTAProgram::CodeSnippet::addFront(), TTAProgram::Program::addInstruction(), address(), POMDisassembler::createMove(), DataDependenceGraph::createSubgraph(), POMDisassembler::disassemble(), ProcedureTransferTracker::handleEvent(), TTAProgram::Procedure::insertAfter(), TTAProgram::CodeSnippet::insertAfter(), TTAProgram::Procedure::insertBefore(), TTAProgram::CodeSnippet::insertBefore(), TTAProgram::Program::nextInstruction(), TTAProgram::Procedure::remove(), TTAProgram::CodeSnippet::remove(), and TTAProgram::InstructionReferenceManager::validate().
|
inline |
Definition at line 90 of file Instruction.hh.
References immediateCount(), and moveCount().
Referenced by ControlFlowGraph::buildMBBFromBB(), and ProgramImageGenerator::generateProgramImage().
Move & TTAProgram::Instruction::move | ( | int | i | ) | const |
Return the move at the given index in this instruction.
The order of moves is arbitrary, no assumption should be made by clients. Anyways, order of moves in instruction does not change between calls to this method.
i | The index of the move. |
OutOfRange | if the given index is negative or greater than the number of moves in the instruction. |
Definition at line 193 of file Instruction.cc.
References __func__, moves_, and Conversion::toString().
Referenced by SimpleICOptimizer::addConnections(), InlineAsmParser::addDebugInfoToInlineAsmBB(), TTAProgram::Program::addInstruction(), addMove(), ProximMachineStateWindow::addMoves(), StaticProgramAnalyzer::addProgram(), LoopAnalyzer::analyze(), ResourceConstraintAnalyzer::analyzeMoveNode(), Peel2BBLoops::appendBB(), SimpleIfConverter::appendBB(), ControlFlowGraph::buildMBBFromBB(), llvm::LLVMTCEIRBuilder::buildTCECFG(), UtilizationStats::calculateForInstruction(), SimpleIfConverter::canConvert(), POMValidator::checkCompiledSimulatability(), POMValidator::checkConnectivity(), CopyingDelaySlotFiller::checkImmediatesAfter(), POMValidator::checkSimulatability(), CopyingDelaySlotFiller::collectMoves(), SimpleIfConverter::combineBlocks(), ControlFlowGraph::computeLeadersFromJumpSuccessors(), ControlFlowGraph::convertBBRefsToInstRefs(), TTAProgram::Program::convertSymbolRefsToInsRefs(), copy(), ProcedurePass::copyCfgToProcedure(), ControlFlowGraph::createBBEdges(), TTAProgram::ProgramWriter::createCodeSection(), POMDisassembler::createInstruction(), ControlFlowGraph::createJumps(), ControlFlowGraph::directJump(), POMDisassembler::disassemble(), llvm::LLVMTCEBuilder::emitInstruction(), CodeCompressorPlugin::encodeMove(), FindWindow::find(), CopyingDelaySlotFiller::findJump(), CopyingDelaySlotFiller::findJumpImmediate(), BasicBlockNode::findJumps(), ControlFlowGraph::findNextIndex(), TTASimulationController::findProgramExitPoints(), DataDependenceGraphBuilder::findStaticRegisters(), TTAProgram::Program::fixInstructionReferences(), DataDependenceGraph::fixInterBBAntiEdges(), CompiledSimCodeGenerator::generateAddFUResult(), CompiledSimCodeGenerator::generateInstruction(), getInstructionReferenceTerminals(), PostpassOperandSharer::handleBasicBlock(), CallsToJumps::handleControlFlowGraph(), ProcedureTransferTracker::handleEvent(), RFAccessTracker::handleEvent(), llvm::LLVMTCEBuilder::hasAmbiguousASpaceRefs(), hasCall(), SimpleIfConverter::hasConditionals(), hasControlFlowMove(), ControlFlowGraph::hasInstructionAnotherJump(), hasJump(), hasReturn(), CodeCompressorPlugin::immediateTerminal(), ControlFlowGraph::indirectJump(), main(), ControlFlowGraph::mergeNodes(), DisasmExecPercentageAttrProvider::moveCellAttr(), BFShareOperandsLate::operator()(), LoopPrologAndEpilogBuilder::optimizeProlog(), SimProgramBuilder::processInstruction(), SimpleIfConverter::removeJump(), ControlFlowGraph::removeJumpToTarget(), removeMove(), ControlFlowGraph::removeUnreachableNodes(), TTAProgram::Program::replaceUniversalAddressSpaces(), BFUnscheduleFromBody::returnOriginal(), BFUnscheduleMove::returnOriginal(), BFShareOperandLate::revert(), setInstructionTemplate(), TTAProgram::BasicBlock::statistics(), SimpleIfConverter::successors(), BasicBlockNode::toString(), PostpassOperandSharer::tryRemoveOperandWrite(), SimpleBrokerDirector::unassign(), ProximDebuggerWindow::updateAnnotations(), CopyingDelaySlotFiller::updateFTBBAndCfg(), BasicBlockNode::updateHWloopLength(), CopyingDelaySlotFiller::updateJumpsAndCfg(), and SimpleIfConverter::writesRegister().
int TTAProgram::Instruction::moveCount | ( | ) | const |
Returns the number of moves contained in this instruction.
Definition at line 176 of file Instruction.cc.
References moves_.
Referenced by SimpleICOptimizer::addConnections(), InlineAsmParser::addDebugInfoToInlineAsmBB(), TTAProgram::Program::addInstruction(), ProximMachineStateWindow::addMoves(), StaticProgramAnalyzer::addProgram(), LoopAnalyzer::analyze(), ResourceConstraintAnalyzer::analyzeMoveNode(), Peel2BBLoops::appendBB(), SimpleIfConverter::appendBB(), MoveNodeGroupBuilder::build(), ControlFlowGraph::buildMBBFromBB(), CompiledSimUtilizationStats::calculate(), UtilizationStats::calculateForInstruction(), SimpleIfConverter::canConvert(), POMValidator::checkCompiledSimulatability(), POMValidator::checkConnectivity(), POMValidator::checkSimulatability(), CopyingDelaySlotFiller::collectMoves(), SimpleIfConverter::combineBlocks(), ControlFlowGraph::computeLeadersFromJumpSuccessors(), DataDependenceGraphBuilder::constructIndividualBB(), DataDependenceGraphBuilder::constructIndividualFromInlineAsmBB(), ControlFlowGraph::convertBBRefsToInstRefs(), TTAProgram::Program::convertSymbolRefsToInsRefs(), copy(), ProcedurePass::copyCfgToProcedure(), BasicBlockPass::copyRMToBB(), ControlFlowGraph::createBBEdges(), TTAProgram::ProgramWriter::createCodeSection(), POMDisassembler::createInstruction(), ProgramDependenceGraph::createJump(), ControlFlowGraph::createJumps(), POMDisassembler::disassemble(), llvm::LLVMTCEBuilder::emitInstruction(), CodeCompressorPlugin::encodeMove(), FindWindow::find(), ITemplateBroker::findITemplates(), CopyingDelaySlotFiller::findJump(), CopyingDelaySlotFiller::findJumpImmediate(), BasicBlockNode::findJumps(), TTASimulationController::findProgramExitPoints(), DataDependenceGraphBuilder::findStaticRegisters(), TTAProgram::Program::fixInstructionReferences(), DataDependenceGraph::fixInterBBAntiEdges(), CompiledSimCodeGenerator::generateAddFUResult(), CompiledSimCodeGenerator::generateInstruction(), getInstructionReferenceTerminals(), PostpassOperandSharer::handleBasicBlock(), CallsToJumps::handleControlFlowGraph(), ProcedureTransferTracker::handleEvent(), RFAccessTracker::handleEvent(), hasCall(), SimpleIfConverter::hasConditionals(), hasControlFlowMove(), ControlFlowGraph::hasInstructionAnotherJump(), hasJump(), hasReturn(), CodeCompressorPlugin::immediateTerminal(), isNOP(), main(), ControlFlowGraph::mergeNodes(), DisasmExecPercentageAttrProvider::moveCellAttr(), BFShareOperandsLate::operator()(), LoopPrologAndEpilogBuilder::optimizeEpilog(), LoopPrologAndEpilogBuilder::optimizeProlog(), SimProgramBuilder::processInstruction(), SimpleIfConverter::removeJump(), ControlFlowGraph::removeJumpToTarget(), ControlFlowGraph::removeUnreachableNodes(), TTAProgram::Program::replaceUniversalAddressSpaces(), BFUnscheduleFromBody::returnOriginal(), BFUnscheduleMove::returnOriginal(), BFShareOperandLate::revert(), setInstructionTemplate(), TTAProgram::BasicBlock::statistics(), BasicBlockNode::toString(), PostpassOperandSharer::tryRemoveOperandWrite(), PreOptimizer::tryToPrecalcConstantAdd(), PreOptimizer::tryToRemoveGuardInversingOp(), SimpleBrokerDirector::unassign(), ProximDebuggerWindow::updateAnnotations(), CopyingDelaySlotFiller::updateFTBBAndCfg(), BasicBlockNode::updateHWloopLength(), CopyingDelaySlotFiller::updateJumpsAndCfg(), and SimpleIfConverter::writesRegister().
std::shared_ptr< Move > TTAProgram::Instruction::movePtr | ( | int | i | ) | const |
Return the move at the given index in this instruction.
The order of moves is arbitrary, no assumption should be made by clients. Anyways, order of moves in instruction does not change between calls to this method.
i | The index of the move. |
OutOfRange | if the given index is negative or greater than the number of moves in the instruction. |
Definition at line 216 of file Instruction.cc.
References __func__, moves_, and Conversion::toString().
Referenced by MoveNodeGroupBuilder::build(), DataDependenceGraphBuilder::constructIndividualBB(), DataDependenceGraphBuilder::constructIndividualFromInlineAsmBB(), llvm::LLVMTCEBuilder::emitInstruction(), and ITemplateBroker::findITemplates().
|
private |
Assignment not allowed.
CodeSnippet & TTAProgram::Instruction::parent | ( | ) | const |
Return the parent that contains the instruction.
IllegalRegistration | If the instruction is not registered anywhere. |
Definition at line 109 of file Instruction.cc.
References __func__, and parent_.
Referenced by TTAProgram::Procedure::add(), TTAProgram::CodeSnippet::add(), address(), PreOptimizer::cfgAllowsJumpReversal(), TTAProgram::CodeLabel::CodeLabel(), SimulatorFrontend::compareState(), ControlFlowGraph::computeLeadersFromRefManager(), ControlFlowGraph::createBlock(), POMDisassembler::createMove(), DataDependenceGraph::createSubgraph(), SimulatorFrontend::currentProcedure(), POMDisassembler::disassemble(), SimulatorFrontend::disassembleInstruction(), llvm::LLVMTCEBuilder::emitSPInitialization(), DisassembleCommand::execute(), CopyingDelaySlotFiller::findJumpImmediate(), TTAProgram::Program::fixInstructionReferences(), ProcedureTransferTracker::handleEvent(), SimulationController::next(), TTAProgram::CodeSnippet::nextInstruction(), TTAProgram::Program::nextInstruction(), TTAProgram::CodeSnippet::previousInstruction(), TTAProgram::CodeLabel::procedure(), SimulatorFrontend::programLocationDescription(), TTAProgram::Procedure::remove(), TTAProgram::CodeSnippet::remove(), PreOptimizer::tryToPrecalcConstantAdd(), PreOptimizer::tryToRemoveGuardInversingOp(), and TTAProgram::InstructionReferenceManager::validate().
void TTAProgram::Instruction::removeImmediate | ( | Immediate & | imm | ) |
Remove immediate from instruction.
Immediate may get deleted if use-count of smart pointer goes to zero.
immediate | Immediate to remove. |
IllegalRegistration | If immediate doesn't belong to instruction. |
Definition at line 560 of file Instruction.cc.
References immediates_, and TTAProgram::Immediate::setParent().
Referenced by ITemplateBroker::assign(), LoopPrologAndEpilogBuilder::optimizeProlog(), ITemplateBroker::unassign(), ITemplateBroker::unassignImmediate(), CopyingDelaySlotFiller::updateFTBBAndCfg(), and CopyingDelaySlotFiller::updateJumpsAndCfg().
void TTAProgram::Instruction::removeMove | ( | Move & | move | ) |
Remove move from instruction.
Move may become deleted if last smart pointer to it gets removed.
move | Move to remove. |
IllegalRegistration | If move doesn't belong to instruction. |
Definition at line 536 of file Instruction.cc.
References TTAProgram::NullInstruction::instance(), move(), moves_, TTAProgram::Move::parent(), and TTAProgram::Move::setParent().
Referenced by ITemplateBroker::assign(), ProcedurePass::copyCfgToProcedure(), PostpassOperandSharer::handleBasicBlock(), SimpleIfConverter::removeJump(), ControlFlowGraph::removeJumpToTarget(), ITemplateBroker::unassign(), CopyingDelaySlotFiller::updateFTBBAndCfg(), and CopyingDelaySlotFiller::updateJumpsAndCfg().
|
inline |
Definition at line 121 of file Instruction.hh.
References finalAddress_.
Referenced by TTAProgram::Program::finalize().
void TTAProgram::Instruction::setInstructionTemplate | ( | const TTAMachine::InstructionTemplate & | insTemp | ) |
Sets instruction template.
insTemp | Instruction template for the instruction. |
Definition at line 488 of file Instruction.cc.
References assert, immediate(), immediateCount(), insTemplate_, move(), moveCount(), MathTools::requiredBits(), TTAMachine::InstructionTemplate::supportedWidth(), and TTAMachine::InstructionTemplate::usesSlot().
Referenced by ITemplateBroker::assign(), ITemplateBroker::assignImmediate(), TTAProgram::TPEFProgramFactory::createInstruction(), ITemplateBroker::instruction(), and ITemplateBroker::reselectTemplate().
void TTAProgram::Instruction::setParent | ( | CodeSnippet & | proc | ) |
Sets the parent procedure of the instruction.
proc | The new parent procedure. |
Definition at line 124 of file Instruction.cc.
References parent_.
Referenced by TTAProgram::Procedure::add(), TTAProgram::CodeSnippet::add(), TTAProgram::CodeSnippet::addFront(), TTAProgram::Procedure::insertAfter(), TTAProgram::CodeSnippet::insertAfter(), TTAProgram::Procedure::insertBefore(), TTAProgram::CodeSnippet::insertBefore(), TTAProgram::Procedure::remove(), and TTAProgram::CodeSnippet::remove().
|
inline |
Definition at line 104 of file Instruction.hh.
Referenced by TTAProgram::Program::finalize().
short TTAProgram::Instruction::size | ( | ) | const |
Returns the size of the instruction in MAU's.
Definition at line 365 of file Instruction.cc.
References size_.
Referenced by SimProgramBuilder::build(), SimulationStatistics::calculate(), POMDisassembler::disassembleProcedure(), DisassembleCommand::execute(), TTAProgram::Program::finalize(), Instruction(), TTAProgram::CodeSnippet::instructionAt(), and setSize().
std::string TTAProgram::Instruction::toString | ( | ) | const |
Returns the disassembly of the instruction.
Definition at line 576 of file Instruction.cc.
References POMDisassembler::disassemble().
Referenced by ResourceConstraintAnalyzer::analyzeMoveNode(), BFOptimization::assignCopyToPrologEpilog(), BasicBlockPass::copyRMToBB(), ProgramDependenceGraph::createJump(), CallsToJumps::handleControlFlowGraph(), BasicBlockScheduler::handleRemovedResultMoves(), BasicBlockNode::toString(), and llvm::LLVMTCEBuilder::writeMachineFunction().
|
mutableprivate |
In case the final instruction address is known (due to program not modified anymore), the final instruction address is stored here. -1 in case not known.
Definition at line 149 of file Instruction.hh.
Referenced by address(), hasFinalAddress(), and setFinalAddress().
|
private |
Set to true in case this instruction has moves that access registers and are conditional.
Definition at line 157 of file Instruction.hh.
Referenced by addMove(), copy(), and hasConditionalRegisterAccesses().
|
private |
Set to true in case this instruction has moves that access registers.
Definition at line 154 of file Instruction.hh.
Referenced by addMove(), copy(), and hasRegisterAccesses().
|
private |
Immediates contained in this instruction.
Definition at line 137 of file Instruction.hh.
Referenced by addImmediate(), immediate(), immediateCount(), immediatePtr(), removeImmediate(), and ~Instruction().
|
private |
Instruction template that is used for this instruction.
Definition at line 142 of file Instruction.hh.
Referenced by addImmediate(), addMove(), copy(), instructionTemplate(), and setInstructionTemplate().
|
private |
Moves contained in this instruction.
Definition at line 135 of file Instruction.hh.
Referenced by addMove(), move(), moveCount(), movePtr(), removeMove(), and ~Instruction().
|
private |
Parent procedure.
Definition at line 139 of file Instruction.hh.
Referenced by isInProcedure(), parent(), and setParent().
|
mutableprivate |
Cache the instruction's index in the its procedure for faster address().
Definition at line 145 of file Instruction.hh.
Referenced by address().
|
mutableprivate |
Size of instruction in MAU's.
Definition at line 152 of file Instruction.hh.