Otawa
0.10
|
This is the minimal definition of a basic block. More...
#include <otawa/cfg/BasicBlock.h>
Classes | |
class | Bundle |
A bundle, in a VLIW processors, is a group of instructions executed in parallel. More... | |
class | BundleIter |
Iterator on bundles composing a basic block. More... | |
class | EdgeIterator |
class | InIterator |
class | InstIter |
Iterator for instructions in the basic block. More... | |
class | OutIterator |
Public Types | |
typedef InstIter | InstIterator |
Public Member Functions | |
BasicBlock (void) | |
Build an empty basic block. More... | |
bool | isCall (void) const |
Test if the basic block is ended by a call to a sub-program. More... | |
bool | isReturn (void) const |
Test if the basic block is ended by a sub-program return. More... | |
bool | isTargetUnknown (void) const |
Test if the target of the branch instruction of this basic block is known or not. More... | |
bool | isEntry (void) const |
Test if the basic block is the CFG entry. More... | |
bool | isExit (void) const |
Test if the basic block is the CFG exit. More... | |
bool | isEnd (void) const |
Test if the basic block is the CFG end, entry or exit. More... | |
bool | isConditional (void) const |
Test if the BB is ended by a conditional branch. More... | |
Address | address (void) const |
Address | topAddress (void) const |
virtual int | countInsts (void) const |
Count the number of instructions in the basic block. More... | |
t::uint32 | size (void) const |
Get the size of the basic block. More... | |
bool | isVirtual (void) const |
unsigned long | getFlags (void) const |
int | number (void) const |
Get the number hooked on this basic block, that is, value of ID_Index property. More... | |
CFG * | cfg (void) |
Inst * | firstInst (void) const |
Inst * | lastInst (void) const |
Get the last instruction of a basic block. More... | |
Inst * | controlInst (void) const |
Find the last control instruction of the basic block. More... | |
void | print (io::Output &out) const |
Print the reference for a basic block. More... | |
void | addInEdge (Edge *edge) |
Add an input edge to the basic block input list. More... | |
void | addOutEdge (Edge *edge) |
Add an output edge to the basic block output list. More... | |
void | removeInEdge (Edge *edge) |
Remove an input edge from the basic block input list. More... | |
void | removeOutEdge (Edge *edge) |
Remove an output edge from the basic block output list. More... | |
BasicBlock * | getTaken (void) |
Get the target basic block if the last branch instruction is taken. More... | |
BasicBlock * | getNotTaken (void) |
Get the following basic block if the last branch instruction is not taken. More... | |
t::uint32 | getBlockSize (void) const |
Compute the size of the basic block. More... | |
int | countInstructions (void) const |
Property * | getProp (const AbstractIdentifier *id) const |
Find a property by its identifier. More... | |
void | setProp (Property *prop) |
Set the property in the property list removing any double. More... | |
void | setProp (const AbstractIdentifier *id) |
void | removeProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier. More... | |
void | removeProp (const AbstractIdentifier &id) |
Property * | extractProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier and return it. More... | |
Property * | extractProp (const AbstractIdentifier &id) |
Remove a property matching the given identifier and return it. More... | |
void | addProp (Property *prop) |
Add property to the list without checking of duplication. More... | |
void | removeAllProp (const AbstractIdentifier *id) |
Remove all the properties matching the given identifier. More... | |
bool | hasProp (const AbstractIdentifier &id) const |
Test if the property list contains a property matching the given identifier. More... | |
void | clearProps (void) |
Remove all properties from the list. More... | |
void | addProps (const PropList &props) |
Add all properties from the given property list, in a reverse order. More... | |
Public Attributes | |
Inst * | first |
t::size | _size |
unsigned long | flags |
elm::genstruct::SLList< Edge * > | ins |
elm::genstruct::SLList< Edge * > | outs |
CFG * | _cfg |
Static Public Attributes | |
static Identifier< BasicBlock * > | ID |
Identifier of the basic block pseudo-instruction. More... | |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Protected Member Functions | |
virtual | ~BasicBlock (void) |
void | setTaken (BasicBlock *bb) |
Set the target basic block of the branch last instruction. More... | |
void | setNotTaken (BasicBlock *bb) |
Set the following basic block. More... | |
Static Protected Attributes | |
static const unsigned long | FLAG_Call = 0x01 |
static const unsigned long | FLAG_Unknown = 0x02 |
static const unsigned long | FLAG_Return = 0x04 |
static const unsigned long | FLAG_Entry = 0x08 |
static const unsigned long | FLAG_Exit = 0x10 |
static const unsigned long | FLAG_Virtual = 0x20 |
static const unsigned long | FLAG_Cond = 0x40 |
static BasicBlock & | null_bb = null_bb_inst |
Friends | |
class | CFGBuilder |
class | CFGInfo |
class | CFG |
class | VirtualCFG |
class | Edge |
This is the minimal definition of a basic block.
|
protectedvirtual |
otawa::BasicBlock::BasicBlock | ( | void | ) |
Build an empty basic block.
|
inline |
Add an input edge to the basic block input list.
edge | Edge to add. |
References ins.
Referenced by otawa::Edge::Edge().
|
inline |
Add an output edge to the basic block output list.
edge | Edge to add. |
References outs.
Referenced by otawa::Edge::Edge().
|
inherited |
Add property to the list without checking of duplication.
prop | Property to add. |
References otawa::Property::_next.
Referenced by otawa::Identifier< T >::add(), otawa::ast::ASTInfo::ASTInfo(), otawa::Identifier< otawa::arm::Info * >::copy(), otawa::AbstractIdentifier::initProps(), otawa::ContextualProperty::make(), otawa::script::Script::makeConfig(), otawa::ccg::Builder::processLBlockSet(), otawa::ipet::ILPSystemGetter::processWorkSpace(), otawa::Identifier< T >::ref(), otawa::ContextualProperty::ref(), and otawa::ContextualProperty::refProps().
|
inherited |
Add all properties from the given property list, in a reverse order.
props | Property list to clone. |
References copy(), otawa::PropList::head, and otawa::Property::next().
Referenced by otawa::display::CFGDrawer::CFGDrawer(), otawa::display::GraphVizGraph::GraphVizGraph(), otawa::ParamFeature::instantiate(), otawa::Manager::loadXML(), otawa::display::GraphVizGraph::newEdge(), otawa::display::GraphVizGraph::newNode(), otawa::PropList::operator=(), otawa::Process::Process(), otawa::PropList::PropList(), otawa::display::GraphVizItem::setProps(), otawa::VirtualBasicBlock::VirtualBasicBlock(), and otawa::VirtualCFG::VirtualCFG().
|
inline |
References otawa::ProgItem::address(), and first.
Referenced by otawa::CFGBuilder::addCFG(), otawa::LBlockBuilder::addLBlock(), otawa::ccg::LBlockBuilder::addLBlock(), otawa::CFG::address(), otawa::CFGBuilder::buildCFG(), otawa::Dominance::dominates(), otawa::ipet::FlowFactLoader::enteringCall(), otawa::Virtualizer::enteringCall(), otawa::DelayedBuilder::fix(), otawa::ipet::VarAssignment::makeEdgeVar(), otawa::ipet::VarAssignment::makeNodeVar(), otawa::CFG::name(), otawa::CFGBuilder::nextBB(), print(), otawa::ipet::TrivialInstCacheManager::processBB(), otawa::ParamExeGraphBBTime::processBB(), otawa::ipet::FlowFactLoader::processBB(), otawa::ipet::BasicObjectFunctionBuilder::processBB(), otawa::cfgio::Output::processBB(), otawa::CFGChecker::processBB(), otawa::ipet::FlowFactConstraintBuilder::processBB(), otawa::ccg::LBlockBuilder::processBB(), otawa::LBlockBuilder::processBB(), otawa::CFGSaver::processBB(), otawa::ipet::BasicConstraintsBuilder::processBB(), otawa::BBRatioDisplayer::processBB(), otawa::GraphBBTime< G >::processBB(), otawa::BBStatCollector::processCFG(), otawa::CFG::scan(), otawa::CFGBuilder::thisBB(), and topAddress().
|
inline |
References _cfg.
Referenced by otawa::ccg::ConstraintBuilder::addConstraintHeader(), otawa::DelayedBuilder::buildBB(), otawa::DelayedBuilder::cloneEdge(), otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::Dominance::dominates(), otawa::Edge::Edge(), otawa::cfgio::Output::id(), otawa::DelayedBuilder::insert(), otawa::DelayedBuilder::makeEdge(), otawa::PostDominance::postDominates(), otawa::etime::EdgeTimeBuilder::processEdge(), and otawa::ccg::ConstraintBuilder::processLBlockSet().
|
inherited |
Remove all properties from the list.
References otawa::Property::next().
Referenced by otawa::PSTBuilder::getVCFG(), otawa::PropList::operator=(), otawa::display::GraphVizItem::setProps(), otawa::PropList::~PropList(), and otawa::WorkSpace::~WorkSpace().
Inst * otawa::BasicBlock::controlInst | ( | void | ) | const |
Find the last control instruction of the basic block.
This is usually the last one but (1) delayed-branch architecture insert instructions after the control and (2) OTAWA CFG configuration system may make merge different blocks or ignore some control instructions. If no control is found, return the last instruction.
Referenced by otawa::etime::EdgeTimeBuilder::getBranchNode(), otawa::CFGChecker::processBB(), otawa::etime::StandardEventBuilder::processBB(), and otawa::BBStatCollector::processCFG().
|
inline |
References countInsts().
Referenced by otawa::PathContext::addBlock(), otawa::LiExeGraphBBTime::buildEpilogueList(), otawa::ParamExeGraphBBTime::buildPrologueList(), otawa::LiExeGraphBBTime::buildPrologueList(), otawa::PathContext::PathContext(), otawa::ParamExeGraphBBTime::processBB(), otawa::LiExeGraphBBTime::processBB(), otawa::GraphBBTime< G >::processBB(), and otawa::tsim::Delta::processCFG().
|
virtual |
Count the number of instructions in the basic block.
Referenced by countInstructions(), and otawa::ipet::TrivialBBTime::processBB().
|
inherited |
Remove a property matching the given identifier and return it.
Caller is responsible of the management of the obtained property.
id | Identifier of the property to extract. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::script::Script::makeConfig().
|
inlineinherited |
Remove a property matching the given identifier and return it.
Caller is responsible of the management of the obtained property.
id | Identifier of the property to extract. |
References otawa::PropList::extractProp().
Referenced by otawa::PropList::extractProp().
|
inline |
References first.
Referenced by otawa::BasicBlock::BundleIter::BundleIter(), otawa::EndBasicBlock::EndBasicBlock(), otawa::DelayedBuilder::fix(), otawa::BasicBlock::InstIter::InstIter(), otawa::CFG::label(), otawa::ipet::FlowFactLoader::processBB(), otawa::ccg::LBlockBuilder::processBB(), otawa::LBlockBuilder::processBB(), and otawa::VirtualBasicBlock::VirtualBasicBlock().
|
inline |
|
inline |
References flags.
Referenced by otawa::VirtualBasicBlock::VirtualBasicBlock().
BasicBlock * otawa::BasicBlock::getNotTaken | ( | void | ) |
Get the following basic block if the last branch instruction is not taken.
References otawa::cfgio::edge(), and EDGE_NotTaken.
|
inherited |
Find a property by its identifier.
id | Identifier of the property to find. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::Identifier< otawa::arm::Info * >::exists(), otawa::ContextualProperty::exists(), otawa::ContextualProperty::find(), otawa::Identifier< T >::get(), otawa::PropList::hasProp(), otawa::ContextualProperty::make(), otawa::ParamFeature::matches(), otawa::ImmutableRef< T, I >::print(), otawa::ContextualProperty::print(), otawa::Identifier< T >::ref(), otawa::ContextualProperty::ref(), otawa::ContextualProperty::refProps(), otawa::Identifier< T >::set(), otawa::Identifier< T >::use(), and otawa::Identifier< T >::value().
BasicBlock * otawa::BasicBlock::getTaken | ( | void | ) |
Get the target basic block if the last branch instruction is taken.
References otawa::cfgio::edge(), EDGE_Call, and EDGE_Taken.
|
inlineinherited |
Test if the property list contains a property matching the given identifier.
id | Property identifier to look for. |
References otawa::PropList::getProp().
Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::Monitor::configure(), otawa::ImmutableRef< T, I >::exists(), and otawa::Manager::setVerbosity().
|
inline |
Test if the basic block is ended by a call to a sub-program.
References FLAG_Call, and flags.
Referenced by otawa::ContextTree::addBB().
|
inline |
Test if the BB is ended by a conditional branch.
References FLAG_Cond, and flags.
Referenced by otawa::ipet::BasicConstraintsBuilder::processBB().
|
inline |
Test if the basic block is the CFG end, entry or exit.
References FLAG_Entry, FLAG_Exit, and flags.
Referenced by otawa::BasicBlock::BundleIter::BundleIter(), otawa::display::CFGOutput::genBBLabel(), otawa::BasicBlock::InstIter::InstIter(), otawa::ipet::FlowFactLoader::processBB(), otawa::cfgio::Output::processBB(), otawa::dcache::WCETFunctionBuilder::processBB(), otawa::ccg::LBlockBuilder::processBB(), otawa::LBlockBuilder::processBB(), otawa::CFGSaver::processBB(), otawa::etime::EdgeTimeBuilder::processBB(), otawa::dcache::CLPBlockBuilder::processBB(), otawa::BBRatioDisplayer::processBB(), and otawa::etime::StandardEventBuilder::processBB().
|
inline |
Test if the basic block is the CFG entry.
References FLAG_Entry, and flags.
Referenced by otawa::ipet::FlowFactLoader::enteringCall(), otawa::Virtualizer::enteringCall(), otawa::GraphBBTime< G >::FillSequence(), otawa::ccg::Problem::gen(), otawa::cat::CATProblem::gen(), otawa::display::CFGOutput::genBBLabel(), print(), otawa::ipet::TrivialDataCacheManager::processBB(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::tsim::TimeDeltaObjectFunctionModifier::processBB(), otawa::ipet::BasicObjectFunctionBuilder::processBB(), otawa::CFGChecker::processBB(), otawa::ipet::BasicConstraintsBuilder::processBB(), otawa::BBStatCollector::processCFG(), otawa::etime::EdgeTimeBuilder::processEdge(), otawa::LoopUnroller::unroll(), and otawa::dfa::XCFGVisitor< P >::visitPreds().
|
inline |
Test if the basic block is the CFG exit.
References FLAG_Exit, and flags.
Referenced by otawa::GraphBBTime< G >::FillSequence(), otawa::display::CFGOutput::genBBLabel(), otawa::ipet::FlowFactLoader::leavingCall(), otawa::Virtualizer::leavingCall(), print(), otawa::ipet::TrivialDataCacheManager::processBB(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::ipet::BasicObjectFunctionBuilder::processBB(), otawa::CFGChecker::processBB(), otawa::ipet::BasicConstraintsBuilder::processBB(), and otawa::LoopUnroller::unroll().
|
inline |
Test if the basic block is ended by a sub-program return.
References FLAG_Return, and flags.
Referenced by otawa::CFG::scan().
|
inline |
Test if the target of the branch instruction of this basic block is known or not.
Unknown branch target is usually to a non-constant branch address. Remark that sub-program return is not viewed as an unknown branch target.
References FLAG_Unknown, and flags.
Referenced by otawa::CFGChecker::processBB().
|
inline |
References FLAG_Virtual, and flags.
Referenced by otawa::VirtualBasicBlock::VirtualBasicBlock().
Inst * otawa::BasicBlock::lastInst | ( | void | ) | const |
Get the last instruction of a basic block.
Referenced by otawa::ipet::FlowFactLoader::enteringCall(), otawa::Virtualizer::enteringCall(), otawa::CFGChecker::processBB(), otawa::branch::CondNumber::processBB(), otawa::branch::OnlyConsBuilder::processBB(), otawa::branch::ConsBuilder::processBB(), and otawa::BranchProblem::update().
|
inline |
Get the number hooked on this basic block, that is, value of ID_Index property.
References otawa::INDEX.
Referenced by otawa::GraphBBTime< G >::analyzePathContext(), otawa::dfa::hai::UnrollingListener< P >::blockInterpreted(), otawa::dfa::hai::DefaultListener< P >::blockInterpreted(), otawa::dfa::hai::WideningListener< P >::blockInterpreted(), otawa::dfa::IterativeDFA< Problem, Set, Iter >::compute(), otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::Dominance::dominates(), otawa::CachePenalty::dump(), otawa::PSTBuilder::getVCFG(), otawa::cfgio::Output::id(), otawa::display::CFGAdapter::Vertex::index(), otawa::ForwardCFGAdapter::index(), otawa::BackwardCFGAdapter::index(), otawa::ai::CFGGraph::index(), otawa::ipet::VarAssignment::makeEdgeVar(), otawa::ipet::VarAssignment::makeNodeVar(), otawa::PostDominance::postDominates(), otawa::SESERegion::print(), print(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::ParamExeGraphBBTime::processBB(), otawa::ipet::BasicObjectFunctionBuilder::processBB(), otawa::cfgio::Output::processBB(), otawa::branch::CondNumber::processBB(), otawa::branch::OnlyConsBuilder::processBB(), otawa::BBRatioDisplayer::processBB(), otawa::LiExeGraphBBTime::processBB(), otawa::GraphBBTime< G >::processBB(), otawa::BBStatCollector::processCFG(), otawa::cat::CATConstraintBuilder::processLBlockSet(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::etime::EdgeTimeBuilder::processSequence(), otawa::StackAnalysis::processWorkSpace(), otawa::display::CFGAdapter::VertexMap< T >::put(), otawa::dfa::hai::HalfAbsInt< FixPoint >::tryAddToWorkList(), and otawa::dfa::XCFGVisitor< P >::XCFGVisitor().
void otawa::BasicBlock::print | ( | io::Output & | out | ) | const |
Print the reference for a basic block.
out | Output stream. |
References address(), isEntry(), isExit(), and number().
Referenced by otawa::operator<<().
|
inherited |
Remove all the properties matching the given identifier.
id | Identifier of properties to remove. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::LoopUnroller::unroll().
|
inline |
Remove an input edge from the basic block input list.
edge | Edge to remove. |
References ins.
Referenced by otawa::Edge::toCall(), and otawa::Edge::~Edge().
|
inline |
Remove an output edge from the basic block output list.
edge | Edge to remove. |
References outs.
Referenced by otawa::Edge::~Edge().
|
inherited |
Remove a property matching the given identifier.
id | Identifier of the property to remove. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::PSTBuilder::buildTree(), otawa::BBRemover< T >::clean(), otawa::display::CFGOutput::processCFG(), otawa::SubCFGBuilder::processWorkSpace(), otawa::Ref< T, I >::remove(), and otawa::ContextualPath::Ref< T >::remove().
|
inlineinherited |
References otawa::PropList::removeProp().
Referenced by otawa::PropList::removeProp().
|
protected |
Set the following basic block.
bb | New following basic block. |
References Edge, and EDGE_NotTaken.
|
inherited |
Set the property in the property list removing any double.
prop | Property to set. |
References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().
|
inlineinherited |
References otawa::PropList::setProp().
Referenced by otawa::PropList::setProp().
|
protected |
Set the target basic block of the branch last instruction.
bb | New target basic block. |
References Edge, and EDGE_Taken.
|
inline |
Get the size of the basic block.
References _size.
Referenced by otawa::ccg::LBlockBuilder::addLBlock(), otawa::LBlockBuilder::addLBlock(), otawa::CFGBuilder::buildCFG(), getBlockSize(), otawa::ipet::TrivialInstCacheManager::processBB(), otawa::cfgio::Output::processBB(), otawa::ccg::LBlockBuilder::processBB(), otawa::LBlockBuilder::processBB(), otawa::CFGSaver::processBB(), otawa::BBRatioDisplayer::processBB(), otawa::CodeBasicBlock::set(), otawa::CodeBasicBlock::setSize(), topAddress(), and otawa::VirtualBasicBlock::VirtualBasicBlock().
|
inline |
References address(), and size().
Referenced by otawa::BasicBlock::BundleIter::BundleIter(), otawa::BasicBlock::InstIter::InstIter(), and otawa::BBRatioDisplayer::processBB().
|
friend |
|
friend |
|
friend |
|
friend |
Referenced by setNotTaken(), and setTaken().
|
friend |
CFG* otawa::BasicBlock::_cfg |
Referenced by otawa::VirtualCFG::addBB(), cfg(), and otawa::VirtualCFG::VirtualCFG().
t::size otawa::BasicBlock::_size |
|
staticinherited |
This is an empty proplist for convenience.
Inst* otawa::BasicBlock::first |
|
staticprotected |
|
staticprotected |
Referenced by otawa::CFGBuilder::buildCFG(), isConditional(), and otawa::CodeBasicBlock::setCond().
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
Referenced by otawa::CFGBuilder::buildCFG(), isTargetUnknown(), and otawa::CodeBasicBlock::setUnknown().
|
staticprotected |
Referenced by isVirtual(), and otawa::VirtualBasicBlock::VirtualBasicBlock().
unsigned long otawa::BasicBlock::flags |
Referenced by otawa::CFGBuilder::buildCFG(), otawa::CodeBasicBlock::CodeBasicBlock(), otawa::EndBasicBlock::EndBasicBlock(), getFlags(), isCall(), isConditional(), isEnd(), isEntry(), isExit(), isReturn(), isTargetUnknown(), isVirtual(), otawa::CodeBasicBlock::setCall(), otawa::CodeBasicBlock::setCond(), otawa::CodeBasicBlock::setReturn(), otawa::CodeBasicBlock::setUnknown(), otawa::Edge::toCall(), and otawa::VirtualBasicBlock::VirtualBasicBlock().
|
static |
Identifier of the basic block pseudo-instruction.
elm::genstruct::SLList<Edge *> otawa::BasicBlock::ins |
Referenced by addInEdge(), and removeInEdge().
|
staticprotected |
Referenced by otawa::EndBasicBlock::EndBasicBlock().
elm::genstruct::SLList<Edge *> otawa::BasicBlock::outs |
Referenced by addOutEdge(), and removeOutEdge().