23 #ifndef OTAWA_CFG_PFG_H_
24 #define OTAWA_CFG_PFG_H_
26 #include <elm/genstruct/HashTable.h>
31 namespace otawa {
namespace pfg {
43 inline BB(
void): _first(0), _size(0) { }
49 inline int count(
void)
const;
50 inline PFG& pfg(
void)
const;
51 bool isControl(
void)
const;
52 bool isBranch(
void)
const;
53 bool isConditional(
void)
const;
54 bool isBranched(
void)
const;
55 bool isCall(
void)
const;
56 bool isReturn(
void)
const;
57 bool isMultiTarget(
void)
const;
68 inline bool ended(
void)
const {
return !
inst ||
inst->address() >= top; }
97 :
graph_t::GenEdge(source, sink), _kind(kind) { }
struct otawa::sem::inst inst
Definition: GenGraph.h:38
Identifier< pfg::PFG * > PFG
PFG of the program.
void setSize(size_t size)
Definition: PFG.h:58
dtd::RefAttr< BasicBlock * > source("source", dtd::STRICT|dtd::REQUIRED)
InstIter & operator=(const InstIter &iter)
Definition: PFG.h:65
Definition: GenGraph.h:44
Inst * inst
Definition: PFG.h:73
Inst * first(void) const
Get the first instruction of the basic block.
Definition: PFG.h:48
genstruct::HashTable< Address, BB * > bbs
Definition: PFG.h:116
BB(Inst *first, t::uint32 size)
Definition: PFG.h:44
kind_t _kind
Definition: PFG.h:101
Definition: ClpValue.h:54
InstIter(const BB *bb)
Definition: PFG.h:63
kind_t
Type of edges.
Definition: PFG.h:85
Edge(BB *source, BB *sink, kind_t kind)
Definition: PFG.h:96
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
elm::io::IntFormat address(Address addr)
Build a format to display addresses.
Definition: base.cpp:213
Inst::kind_t kind
Definition: odisasm.cpp:106
This class represents the control transfer between basic block (BB).
Definition: PFG.h:83
otawa::GenGraph< BB, Edge > graph_t
Definition: PFG.h:35
t::uint32 size(void) const
Get the size of the basic block.
Definition: PFG.h:47
kind_t
Allowed types for values: NONE represents nothing; REG is only used for addresses, and represents a register; VAL represents some values (either a constant or an interval); ALL is the Top element.
Definition: ClpValue.h:53
BB ret
This special basic block is used as the sink vertex of edges representing sub-program return...
Definition: PFG.h:108
The representation of an address in OTAWA.
Definition: base.h:54
A basic block in a otawa::pfg::PFG .
Definition: PFG.h:40
InstIter(const InstIter &iter)
Definition: PFG.h:64
A PFG (Program Flow Graph) is built from the binary form of the program to represent all possible pat...
Definition: PFG.h:105
Definition: util_fft_parser.cpp:161
Definition: ast_parser.cpp:134
Address top
Definition: PFG.h:74
Definition: ipet_parser.cpp:125
inst add(int d, int a, int b)
Definition: inst.h:163
Definition: features.h:46
BB unknown
This special basic block is used as the sink vertex of edges representing branch or call to an unknow...
Definition: PFG.h:109
Inst * _first
Definition: PFG.h:78
bool ended(void) const
Definition: PFG.h:68
Iterator on the instructions of a basic block.
Definition: PFG.h:61
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
kind_t kind(void) const
Get the kind of an edge.
Definition: PFG.h:98
BB(void)
Definition: PFG.h:43
Address address(void) const
Get the start address of the basic block.
Definition: PFG.h:45
t::uint32 _size
Definition: PFG.h:79
void next(void)
Definition: PFG.h:70
Inst * item(void) const
Definition: PFG.h:69
Definition: GenGraph.h:61
Address topAddress(void) const
Get the address next after the basic block, that is, address + size.
Definition: PFG.h:46