OpenASIP
2.0
|
#include <InstructionReferenceManager.hh>
Classes | |
class | Iterator |
Public Types | |
typedef std::map< Instruction *, InstructionReferenceImpl * > | RefMap |
Map for instruction references. faster to search than list. More... | |
Public Member Functions | |
InstructionReferenceManager () | |
virtual | ~InstructionReferenceManager () |
InstructionReference | createReference (Instruction &ins) |
void | replace (Instruction &insA, Instruction &insB) |
void | clearReferences () |
bool | hasReference (Instruction &ins) const |
unsigned int | referenceCount (Instruction &ins) const |
void | referenceDied (Instruction *ins) |
void | validate () |
Iterator | begin () |
Iterator | end () |
Private Member Functions | |
InstructionReferenceManager (const InstructionReferenceManager &) | |
InstructionReferenceManager & | operator= (const InstructionReferenceManager &) |
Private Attributes | |
RefMap | references_ |
Instruction references to maintain. More... | |
Helps in keeping instructions referenced in POM up-to-date.
Instructions are not referenced directly, but through an InstructionReference instance. The actual Instruction instance referred can be changed as needed.
Definition at line 82 of file InstructionReferenceManager.hh.
typedef std::map<Instruction*, InstructionReferenceImpl*> TTAProgram::InstructionReferenceManager::RefMap |
Map for instruction references. faster to search than list.
Definition at line 85 of file InstructionReferenceManager.hh.
TTAProgram::InstructionReferenceManager::InstructionReferenceManager | ( | ) |
Constructor.
Definition at line 54 of file InstructionReferenceManager.cc.
|
virtual |
Destructor. Clears all instruction references.
Definition at line 60 of file InstructionReferenceManager.cc.
References clearReferences().
|
private |
|
inline |
Referenced by ControlFlowGraph::computeLeadersFromRefManager(), and validate().
void TTAProgram::InstructionReferenceManager::clearReferences | ( | ) |
Clears all instruction references.
The result is a totally empty instruction reference manager. This nullifies all instructionreferences handled by this reference manager.
Definition at line 125 of file InstructionReferenceManager.cc.
References assert, and references_.
Referenced by ~InstructionReferenceManager().
InstructionReference TTAProgram::InstructionReferenceManager::createReference | ( | Instruction & | ins | ) |
Creates a new reference to an instruction.
ins | Referred instruction. |
Definition at line 73 of file InstructionReferenceManager.cc.
References references_.
Referenced by SimpleIfConverter::addJump(), TTAProgram::TPEFProgramFactory::build(), TTAProgram::Program::convertSymbolRef(), TTAProgram::Program::copyDataMemoriesFrom(), InlineAsmParser::copyInstructions(), llvm::LLVMTCEBuilder::createGlobalValueDataDefinition(), ProgramDependenceGraph::createJump(), TTAProgram::TPEFProgramFactory::createLabels(), TTAProgram::CodeGenerator::createSchedYieldProcedure(), llvm::LLVMTCEBuilder::doFinalization(), llvm::LLVMTCEBuilder::emitSetjmp(), TTAProgram::Program::fixInstructionReferences(), CallsToJumps::handleControlFlowGraph(), TTAProgram::CodeLabel::instructionReference(), LoopPrologAndEpilogBuilder::moveJumpDestination(), ControlFlowGraph::sanitize(), and CopyingDelaySlotFiller::updateJumpsAndCfg().
|
inline |
Referenced by ControlFlowGraph::computeLeadersFromRefManager(), and validate().
bool TTAProgram::InstructionReferenceManager::hasReference | ( | Instruction & | ins | ) | const |
Tells whether the manager has created a reference to the given instruction.
Definition at line 143 of file InstructionReferenceManager.cc.
References references_.
Referenced by SequentialScheduler::copyBasicBlocksToProcedure(), ProcedurePass::copyCfgToProcedure(), BasicBlockPass::copyRMToBB(), ControlFlowGraph::copyToLLVMMachineFunction(), ControlFlowGraph::copyToProcedure(), SequentialScheduler::createBasicBlocks(), llvm::LLVMTCEBuilder::emitSPInitialization(), CopyingDelaySlotFiller::fillDelaySlots(), CopyingDelaySlotFiller::findJumpImmediate(), CallsToJumps::handleControlFlowGraph(), ControlFlowGraph::optimizeBBOrdering(), TTAProgram::Procedure::remove(), ControlFlowGraph::splitBasicBlocksWithCallsAndRefs(), PostpassOperandSharer::tryRemoveOperandWrite(), PreOptimizer::tryToRemoveGuardInversingOp(), CopyingDelaySlotFiller::updateFTBBAndCfg(), CopyingDelaySlotFiller::updateJumpsAndCfg(), BasicBlockNode::updateReferencesFromProcToCfg(), and ControlFlowGraph::updateReferencesFromProcToCfg().
|
private |
unsigned int TTAProgram::InstructionReferenceManager::referenceCount | ( | Instruction & | ins | ) | const |
Tells how many alive references there are to an instruction.
Definition at line 151 of file InstructionReferenceManager.cc.
References references_.
void TTAProgram::InstructionReferenceManager::referenceDied | ( | Instruction * | ins | ) |
Notifies instructionreferencemanager that a reference has completely died.
This causes the reference manager to remove the reference impl object.
Definition at line 165 of file InstructionReferenceManager.cc.
References assert, and references_.
Referenced by TTAProgram::InstructionReferenceImpl::removeRef().
void TTAProgram::InstructionReferenceManager::replace | ( | Instruction & | insA, |
Instruction & | insB | ||
) |
Replaces a referred instruction with another. This replaces ALL references that point into the same instruction.
insA | Instruction to be replaced. |
insB | The new referred instruction. |
InstanceNotFound | if the instruction to be replaced is not found. |
Definition at line 96 of file InstructionReferenceManager.cc.
References TTAProgram::InstructionReferenceImpl::merge(), references_, and TTAProgram::InstructionReferenceImpl::setInstruction().
Referenced by SequentialScheduler::copyBasicBlocksToProcedure(), ProcedurePass::copyCfgToProcedure(), BasicBlockPass::copyRMToBB(), ControlFlowGraph::copyToLLVMMachineFunction(), ControlFlowGraph::copyToProcedure(), TTAProgram::CodeGenerator::createSchedYieldProcedure(), llvm::LLVMTCEBuilder::emitSPInitialization(), CallsToJumps::handleControlFlowGraph(), ControlFlowGraph::optimizeBBOrdering(), and BasicBlockNode::updateReferencesFromProcToCfg().
void TTAProgram::InstructionReferenceManager::validate | ( | ) |
Performs sanity checks to the instruction references.
Asserts in case of illegal irefs found. Before calling this method, all instruction references must have been "stabilized", i.e., pointing to valid instructions inside the Program.
Definition at line 181 of file InstructionReferenceManager.cc.
References TTAProgram::Instruction::address(), begin(), end(), TTAProgram::CodeSnippet::firstInstruction(), TTAProgram::Instruction::isInProcedure(), TTAProgram::CodeSnippet::isInProgram(), TTAProgram::Address::location(), Application::logStream(), TTAProgram::Procedure::name(), TTAProgram::Instruction::parent(), and PRINT_VAR.
|
private |
Instruction references to maintain.
Definition at line 120 of file InstructionReferenceManager.hh.
Referenced by clearReferences(), createReference(), hasReference(), referenceCount(), referenceDied(), and replace().