OpenASIP
2.0
|
#include <BasicBlock.hh>
Public Member Functions | |
BasicBlock (int startAddress=0) | |
virtual | ~BasicBlock () |
BasicBlock * | copy () const |
virtual void | clear () |
int | skippedFirstInstructions () const |
void | skipFirstInstructions (int count) |
const BasicBlockStatistics & | statistics () |
bool | isEmpty () |
bool | isInInnerLoop () const |
returns true in case the BB is known to be inside an inner loop More... | |
void | setInInnerLoop (bool inner=true) |
unsigned | tripCount () const |
in case the BB is inside a loop and trip count is known, returns it, otherwise returns 0 More... | |
void | setTripCount (unsigned count) |
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 | address (const Instruction &ins) 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 | addFront (Instruction *ins) |
virtual void | add (Instruction *ins) |
virtual void | insertAfter (const Instruction &pos, Instruction *ins) |
virtual void | insertBefore (const Instruction &pos, Instruction *ins) |
virtual void | remove (Instruction &ins) |
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 |
Public Attributes | |
LiveRangeData * | liveRangeData_ |
Private Attributes | |
int | skippedFirstInstructions_ |
bool | statisticsValid_ |
BasicBlockStatistics | statistics_ |
bool | innerLoop_ |
unsigned | tripCount_ |
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 contents and information of one basic block.
A basic block is defined as an ordered sequence of adjacent instructions in which only the first can be target of jump and only the last one (save jump delay slots) can contain jumps.
Definition at line 85 of file BasicBlock.hh.
BasicBlock::BasicBlock | ( | int | startAddress = 0 | ) |
|
virtual |
To prevent compiler warning of virtual destructor.
Definition at line 60 of file BasicBlock.cc.
|
virtual |
Trigger recorded statistics about BB invalid and calls clear of code snippet.
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 152 of file BasicBlock.cc.
References TTAProgram::CodeSnippet::clear(), and statisticsValid_.
Referenced by BasicBlockPass::copyRMToBB().
|
virtual |
Creates a deep copy of the basic block.
Reimplemented from TTAProgram::CodeSnippet.
Definition at line 67 of file BasicBlock.cc.
References TTAProgram::CodeSnippet::add(), BasicBlock(), TTAProgram::Instruction::copy(), TTAProgram::CodeSnippet::instructionAtIndex(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Address::location(), skippedFirstInstructions(), and TTAProgram::CodeSnippet::startAddr_.
|
inline |
Definition at line 98 of file BasicBlock.hh.
References TTAProgram::CodeSnippet::instructionCount(), and skippedFirstInstructions().
Referenced by ControlFlowGraph::optimizeBBOrdering().
|
inline |
returns true in case the BB is known to be inside an inner loop
Definition at line 103 of file BasicBlock.hh.
References innerLoop_.
Referenced by BasicBlockPass::copyRMToBB(), and BBSchedulerController::executeDDGPass().
|
inline |
Definition at line 104 of file BasicBlock.hh.
References innerLoop_.
Referenced by llvm::LLVMTCEIRBuilder::buildTCECFG(), and ControlFlowGraph::createBlock().
|
inline |
Definition at line 109 of file BasicBlock.hh.
References tripCount_.
Referenced by llvm::LLVMTCEIRBuilder::buildTCECFG(), ControlFlowGraph::createBlock(), and BBSchedulerController::handleBasicBlock().
void BasicBlock::skipFirstInstructions | ( | int | count | ) |
Sets n first instructions of this BB to be skipped instructions, ie. instructions that do not logically belong here but are here because cannot have been removed without messing soem data structures (liek RM bookkeeping)
count | number of instructions to mark as skipped instructions |
Definition at line 98 of file BasicBlock.cc.
References skippedFirstInstructions_.
Referenced by ControlFlowGraph::optimizeBBOrdering(), and CopyingDelaySlotFiller::updateFTBBAndCfg().
int BasicBlock::skippedFirstInstructions | ( | ) | const |
Returns the count of instructions in the beginning of this BB that should not be copied out from this BB, ie. logically don't belong here but are here because they cannot have been removed without messing some data structures (like RM bookkeeping)
Definition at line 88 of file BasicBlock.cc.
References skippedFirstInstructions_.
Referenced by ControlFlowGraph::buildMBBFromBB(), copy(), ProcedurePass::copyCfgToProcedure(), ControlFlowGraph::copyToProcedure(), CopyingDelaySlotFiller::fillDelaySlots(), CopyingDelaySlotFiller::findJumpImmediate(), isEmpty(), BasicBlockNode::maximumSize(), ControlFlowGraph::mergeNodes(), LoopPrologAndEpilogBuilder::moveJumpDestination(), ControlFlowGraph::splitBB(), PostpassOperandSharer::tryRemoveOperandWrite(), and CopyingDelaySlotFiller::updateJumpsAndCfg().
const BasicBlockStatistics & BasicBlock::statistics | ( | ) |
Updates and returns the statistics about Basic Block
Definition at line 111 of file BasicBlock.cc.
References TTAProgram::BasicBlockStatistics::bypassedCount(), TTAProgram::Move::destination(), TTAProgram::BasicBlockStatistics::immediateCount(), TTAProgram::Instruction::immediateCount(), TTAProgram::CodeSnippet::instructionAtIndex(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Terminal::isFUPort(), TTAProgram::Instruction::move(), TTAProgram::BasicBlockStatistics::moveCount(), TTAProgram::Instruction::moveCount(), TTAProgram::BasicBlockStatistics::setBypassedCount(), TTAProgram::BasicBlockStatistics::setImmediateCount(), TTAProgram::BasicBlockStatistics::setInstructionCount(), TTAProgram::BasicBlockStatistics::setMoveCount(), TTAProgram::Move::source(), statistics_, and statisticsValid_.
Referenced by BasicBlockNode::statistics().
|
inline |
in case the BB is inside a loop and trip count is known, returns it, otherwise returns 0
Definition at line 108 of file BasicBlock.hh.
References tripCount_.
Referenced by BasicBlockPass::copyRMToBB(), and BBSchedulerController::handleBasicBlock().
|
private |
Definition at line 119 of file BasicBlock.hh.
Referenced by isInInnerLoop(), and setInInnerLoop().
LiveRangeData* TTAProgram::BasicBlock::liveRangeData_ |
Definition at line 111 of file BasicBlock.hh.
Referenced by InlineAsmParser::addLiveRangeData(), DataDependenceGraphBuilder::build(), DataDependenceGraphBuilder::clearUnneededBookkeeping(), DataDependenceGraphBuilder::constructIndividualBB(), BFRegCopy::createAntidepsForReg(), RegisterCopyAdder::createAntidepsForReg(), DataDependenceGraphBuilder::createTriggerDependencies(), BasicBlockPass::executeDDGPass(), BBSchedulerController::handleBasicBlock(), DataDependenceGraphBuilder::initializeBBStates(), RegisterRenamer::initializeFreeRegisters(), ControlFlowGraph::mergeNodes(), DataDependenceGraphBuilder::processEntryNode(), DataDependenceGraphBuilder::processMemUse(), DataDependenceGraphBuilder::processMemWrite(), DataDependenceGraphBuilder::processRegUse(), DataDependenceGraphBuilder::processRegWrite(), RegisterRenamer::renameLiveRange(), BF2Scheduler::revertBBLiveRangeBookkeepingForDestination(), BF2Scheduler::revertBBLiveRangeBookkeepingForSource(), RegisterRenamer::revertedRenameToRegister(), BFRenameLiveRange::setFirstDefsAndUses(), BFRenameLiveRange::setIncomingDeps(), BFRenameLiveRange::setOutgoingDeps(), BFRenameLiveRange::setRegDefsAndLastUses(), DataDependenceGraphBuilder::setSucceedingPredepsForBB(), ControlFlowGraph::splitBasicBlockAtIndex(), BFRenameLiveRange::undoSetFirstDefsAndUses(), BFRenameLiveRange::undoSetRegDefsAndLastUses(), BFRenameLiveRange::unsetIncomingDeps(), BFRenameLiveRange::unsetOutgoingDeps(), RegisterRenamer::updateAntiEdgesFromLRTo(), DataDependenceGraphBuilder::updateBB(), DataDependenceGraphBuilder::updateMemAndFuAliveAfter(), DataDependenceGraphBuilder::updateMemUse(), DataDependenceGraphBuilder::updateMemWrite(), DataDependenceGraphBuilder::updatePreceedingRegistersUsedAfter(), DataDependenceGraphBuilder::updateRegistersAliveAfter(), DataDependenceGraphBuilder::updateRegistersUsedInOrAfter(), DataDependenceGraph::updateRegUse(), and DataDependenceGraph::updateRegWrite().
|
private |
Definition at line 115 of file BasicBlock.hh.
Referenced by skipFirstInstructions(), and skippedFirstInstructions().
|
private |
Definition at line 117 of file BasicBlock.hh.
Referenced by statistics().
|
private |
Definition at line 116 of file BasicBlock.hh.
Referenced by clear(), and statistics().
|
private |
Definition at line 120 of file BasicBlock.hh.
Referenced by setTripCount(), and tripCount().