Otawa
0.10
|
A virtual CFG is a CFG not-mapped to real code, that is, it may contains virtual nodes for inlining functions calls or for separating nodes according some context information. More...
#include <otawa/cfg/VirtualCFG.h>
Public Member Functions | |
VirtualCFG (CFG *cfg, bool inlined=true) | |
Build a new virtual CFG from the given CFG. More... | |
VirtualCFG (bool addEntryExit=true) | |
Build a new empty VirtualCFG. More... | |
CFG * | cfg (void) const |
Get the base CFG of the current virtual CFG. More... | |
void | addBB (BasicBlock *bb) |
Adds a basic block. More... | |
void | removeBB (BasicBlock *bb) |
Remove a basic block. More... | |
void | numberBBs (void) |
Give a number to each basic block of the virtual CFG. More... | |
Segment * | segment (void) const |
string | label (void) |
Get some label to identify the CFG. More... | |
string | name (void) |
Build a name that identifies this CFG and is valid C name. More... | |
string | format (const Address &addr) |
Format the display of the given address relativelt to the given CFG. More... | |
int | number (void) |
address_t | address (void) |
Get the address of the first instruction of the CFG. More... | |
BasicBlock * | entry (void) |
Get the entry basic block of the CFG. More... | |
BasicBlock * | exit (void) |
Get the exit basic block of the CFG. More... | |
int | countBB (void) |
bool | isVirtual (void) const |
bool | isInlined (void) const |
void | numberBB (void) |
Number the basic block of the CFG, that is, hook a property with ID_Index identifier and the integer value of the number to each basic block. More... | |
BasicBlock * | firstBB (void) |
Get the first basic block of the CFG. More... | |
Inst * | firstInst (void) |
Get the first instruction of the CFG. More... | |
void | print (io::Output &out) |
Print a reference for the CFG. More... | |
void | print (elm::io::Output &out) const |
Display the current property list. More... | |
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... | |
Static Public Attributes | |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Protected Member Functions | |
virtual void | scan (void) |
Scan the CFG for finding exit and builds virtual edges with entry and exit. More... | |
Protected Attributes | |
unsigned long | flags |
EndBasicBlock | _entry |
EndBasicBlock | _exit |
bbs_t | _bbs |
Static Protected Attributes | |
static const unsigned long | FLAG_Scanned = 0x01 |
static const unsigned long | FLAG_Virtual = 0x02 |
static const unsigned long | FLAG_Inlined = 0x04 |
Private Member Functions | |
void | virtualize (struct call_t *stack, CFG *cfg, BasicBlock *entry, BasicBlock *exit) |
Build the virtual CFG. More... | |
Private Attributes | |
CFG * | _cfg |
A virtual CFG is a CFG not-mapped to real code, that is, it may contains virtual nodes for inlining functions calls or for separating nodes according some context information.
otawa::VirtualCFG::VirtualCFG | ( | CFG * | cfg, |
bool | inlined = true |
||
) |
Build a new virtual CFG from the given CFG.
cfg | CFG to buid from. |
inlined | If true, performs inlining. |
References otawa::PropList::addProps(), otawa::CFG::FLAG_Inlined, otawa::CFG::FLAG_Virtual, and otawa::CFG::flags.
otawa::VirtualCFG::VirtualCFG | ( | bool | addEntryExit = true | ) |
Build a new empty VirtualCFG.
References otawa::CFG::_bbs, otawa::BasicBlock::_cfg, otawa::CFG::_entry, otawa::CFG::_exit, elm::genstruct::FragTable< T >::add(), otawa::CFG::FLAG_Scanned, otawa::CFG::FLAG_Virtual, and otawa::CFG::flags.
void otawa::VirtualCFG::addBB | ( | BasicBlock * | bb | ) |
Adds a basic block.
bb | Added basic block. |
References otawa::CFG::_bbs, otawa::BasicBlock::_cfg, elm::genstruct::FragTable< T >::add(), elm::genstruct::FragTable< T >::count(), and otawa::INDEX.
Referenced by otawa::DelayedBuilder::buildBB(), otawa::PSTBuilder::getVCFG(), otawa::DelayedBuilder::makeBB(), otawa::DelayedBuilder::makeNOp(), otawa::DelayedBuilder::processCFG(), otawa::LoopUnroller::processWorkSpace(), otawa::LoopReductor::processWorkSpace(), otawa::SubCFGBuilder::processWorkSpace(), otawa::DelayedBuilder::processWorkSpace(), otawa::LoopReductor::reduce(), otawa::LoopUnroller::unroll(), otawa::Virtualizer::virtualize(), and otawa::Virtualizer::virtualizeCFG().
|
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 VirtualCFG().
|
inherited |
Get the address of the first instruction of the CFG.
References otawa::BasicBlock::address(), otawa::cfgio::edge(), otawa::CFG::ent, otawa::CFG::entry(), and otawa::Address::null.
Referenced by otawa::PCGBlock::getAddress(), makeAddress(), and nameOf().
|
inline |
Get the base CFG of the current virtual CFG.
References _cfg.
Referenced by virtualize().
|
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().
|
inlineinherited |
References otawa::CFG::_bbs, otawa::CFG::FLAG_Scanned, otawa::CFG::flags, elm::genstruct::FragTable< T >::length(), and otawa::CFG::scan().
Referenced by otawa::PSTBuilder::assignClasses(), otawa::ForwardCFGAdapter::count(), otawa::BackwardCFGAdapter::count(), otawa::display::CFGAdapter::count(), otawa::dfa::hai::DefaultListener< P >::DefaultListener(), otawa::PSTBuilder::getVCFG(), otawa::BBStatCollector::processCFG(), otawa::PSTBuilder::processCFG(), otawa::Virtualizer::processWorkSpace(), otawa::LoopReductor::reduce(), otawa::dfa::hai::UnrollingListener< P >::UnrollingListener(), otawa::dfa::hai::WideningListener< P >::WideningListener(), otawa::dfa::hai::DefaultListener< P >::~DefaultListener(), otawa::dfa::hai::UnrollingListener< P >::~UnrollingListener(), and otawa::dfa::hai::WideningListener< P >::~WideningListener().
|
inlineinherited |
Get the entry basic block of the CFG.
References otawa::CFG::_entry, otawa::CFG::FLAG_Scanned, otawa::CFG::flags, and otawa::CFG::scan().
Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::CFG::address(), otawa::DelayedBuilder::buildBB(), otawa::Dominance::ensure(), otawa::PostDominance::ensure(), otawa::ForwardCFGAdapter::entry(), otawa::dfa::Predecessor::entry(), otawa::PSTBuilder::getVCFG(), otawa::CFG::label(), otawa::cfgio::Output::processCFG(), otawa::BBStatCollector::processCFG(), otawa::CFGSaver::processCFG(), otawa::BBRatioDisplayer::processCFG(), otawa::ContextualProcessor::processCFG(), otawa::PSTBuilder::processCFG(), otawa::LoopReductor::processWorkSpace(), otawa::LoopUnroller::processWorkSpace(), otawa::SubCFGBuilder::processWorkSpace(), otawa::DelayedBuilder::processWorkSpace(), otawa::ipet::BasicConstraintsBuilder::processWorkSpace(), otawa::LoopReductor::reduce(), otawa::SESERegion::SESERegion(), otawa::dfa::hai::HalfAbsInt< FixPoint >::solve(), otawa::LoopUnroller::unroll(), virtualize(), otawa::Virtualizer::virtualize(), and otawa::Virtualizer::virtualizeCFG().
|
inlineinherited |
Get the exit basic block of the CFG.
References otawa::CFG::_exit, otawa::CFG::FLAG_Scanned, otawa::CFG::flags, and otawa::CFG::scan().
Referenced by otawa::DelayedBuilder::buildBB(), otawa::dfa::Successor::entry(), otawa::BackwardCFGAdapter::entry(), otawa::PSTBuilder::getVCFG(), otawa::cfgio::Output::processCFG(), otawa::CFGChecker::processCFG(), otawa::BBStatCollector::processCFG(), otawa::CFGSaver::processCFG(), otawa::DelayedBuilder::processCFG(), otawa::ContextualProcessor::processCFG(), otawa::PSTBuilder::processCFG(), otawa::LoopReductor::processWorkSpace(), otawa::SubCFGBuilder::processWorkSpace(), otawa::LoopReductor::reduce(), otawa::SESERegion::SESERegion(), otawa::LoopUnroller::unroll(), virtualize(), and otawa::Virtualizer::virtualizeCFG().
|
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().
|
inherited |
Get the first basic block of the CFG.
References otawa::CFG::_bbs, otawa::CFG::FLAG_Scanned, otawa::CFG::flags, and otawa::CFG::scan().
Referenced by otawa::DelayedBuilder::buildEdges(), otawa::CFG::firstInst(), and otawa::etime::EdgeTimeBuilder::processEdge().
|
inherited |
Get the first instruction of the CFG.
References otawa::cfgio::bb(), otawa::CFG::firstBB(), otawa::CFG::FLAG_Scanned, otawa::CFG::flags, and otawa::CFG::scan().
Referenced by otawa::Virtualizer::isInlined(), otawa::CFGProcessor::str(), virtualize(), and otawa::Virtualizer::virtualize().
Format the display of the given address relativelt to the given CFG.
addr | Address to format. |
References elm::_, otawa::ot::address(), elm::io::hex(), and otawa::display::LABEL.
|
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().
|
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().
|
inlineinherited |
References otawa::CFG::FLAG_Inlined, and otawa::CFG::flags.
Referenced by virtualize().
|
inlineinherited |
References otawa::CFG::FLAG_Virtual, and otawa::CFG::flags.
Referenced by otawa::SubCFGBuilder::processWorkSpace().
|
inherited |
Get some label to identify the CFG.
References otawa::CFG::ent, otawa::CFG::entry(), otawa::BasicBlock::firstInst(), otawa::FUNCTION_LABEL, otawa::LABEL, and out.
Referenced by otawa::CFGBuilder::addCFG(), otawa::ContextTree::addChild(), otawa::PCGBuilder::addPCGBlock(), otawa::dfa::hai::UnrollingListener< P >::blockInterpreted(), otawa::CFG::CFG(), otawa::ContextTree::ContextTree(), otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::display::CFGOutput::genGraphLabel(), otawa::PCGBlock::getName(), makeAddress(), otawa::ipet::VarAssignment::makeEdgeVar(), otawa::ipet::VarAssignment::makeNodeVar(), otawa::CFG::name(), nameOf(), otawa::display::CFGDrawer::onCall(), otawa::CFG::print(), otawa::ipet::BasicObjectFunctionBuilder::processBB(), otawa::ipet::FlowFactConstraintBuilder::processBB(), otawa::BBRatioDisplayer::processBB(), otawa::cfgio::Output::processCFG(), otawa::CFGChecker::processCFG(), otawa::BBRatioDisplayer::processCFG(), otawa::display::CFGOutput::processCFG(), otawa::ContextualProcessor::processCFG(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::dcache::CatConstraintBuilder::processWorkSpace(), otawa::StackAnalysis::processWorkSpace(), otawa::CFGCollector::processWorkSpace(), otawa::CFGProcessor::processWorkSpace(), otawa::clp::Analysis::processWorkSpace(), and otawa::Virtualizer::virtualize().
|
inherited |
Build a name that identifies this CFG and is valid C name.
References _, otawa::BasicBlock::address(), otawa::CFG::ent, and otawa::CFG::label().
|
inlineinherited |
|
inherited |
Number the basic block of the CFG, that is, hook a property with ID_Index identifier and the integer value of the number to each basic block.
The entry get the number 0 et the exit the last number.
References otawa::CFG::_bbs, otawa::INDEX, and elm::genstruct::FragTable< T >::length().
Referenced by otawa::PSTBuilder::getVCFG(), and otawa::Virtualizer::virtualizeCFG().
void otawa::VirtualCFG::numberBBs | ( | void | ) |
Give a number to each basic block of the virtual CFG.
References otawa::CFG::_bbs, otawa::INDEX, and elm::genstruct::FragTable< T >::length().
Referenced by otawa::DelayedBuilder::processCFG(), and otawa::SubCFGBuilder::processWorkSpace().
|
inherited |
Print a reference for the CFG.
out | Output stream. |
References otawa::CFG::label().
Referenced by otawa::operator<<().
|
inherited |
Display the current property list.
out | Output to use. |
Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().
|
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().
void otawa::VirtualCFG::removeBB | ( | BasicBlock * | bb | ) |
Remove a basic block.
bb | Removed basic block. |
References otawa::CFG::_bbs, elm::genstruct::FragTable< T >::count(), otawa::INDEX, and elm::genstruct::FragTable< T >::shrink().
|
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().
|
protectedvirtual |
Scan the CFG for finding exit and builds virtual edges with entry and exit.
For memory-place and time purposes, this method is only called when the CFG is used (call to an accessors method).
Reimplemented from otawa::CFG.
References otawa::CFG::_bbs, _cfg, otawa::CFG::_entry, otawa::CFG::_exit, elm::genstruct::FragTable< T >::add(), otawa::CFG::FLAG_Scanned, otawa::CFG::flags, otawa::INDEX, elm::genstruct::FragTable< T >::length(), and virtualize().
|
inlineinherited |
References otawa::CFG::_seg.
|
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().
|
private |
Build the virtual CFG.
stack | Stack to previous calls. |
cfg | CFG to develop. |
ret | Basic block for returning. |
References otawa::CFG::_bbs, elm::genstruct::FragTable< T >::add(), otawa::cfgio::bb(), otawa::Edge::CALL, otawa::cfgio::called(), otawa::CALLED_CFG, cfg(), otawa::cfgio::edge(), otawa::CFG::entry(), otawa::CFG::exit(), otawa::CFG::firstInst(), otawa::CFG::isInlined(), otawa::NO_INLINE, otawa::RECURSIVE_LOOP, otawa::Edge::VIRTUAL_CALL, and otawa::Edge::VIRTUAL_RETURN.
Referenced by scan().
|
protectedinherited |
|
protectedinherited |
Referenced by otawa::CFG::entry(), scan(), otawa::CFG::scan(), and VirtualCFG().
|
protectedinherited |
Referenced by otawa::CFG::exit(), scan(), otawa::CFG::scan(), and VirtualCFG().
|
staticinherited |
This is an empty proplist for convenience.
|
staticprotectedinherited |
Referenced by otawa::CFG::isInlined(), and VirtualCFG().
|
staticprotectedinherited |
|
staticprotectedinherited |
Referenced by otawa::CFG::isVirtual(), and VirtualCFG().
|
protectedinherited |