Otawa  0.10
features.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * features of module cfg
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2008, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_CFG_FEATURES_H_
23 #define OTAWA_CFG_FEATURES_H_
24 
26 #include <elm/genstruct/FragTable.h>
27 #include <otawa/cfg/CFG.h>
28 
29 namespace elm { namespace genstruct { template <class T> class Tree; } }
30 
31 namespace otawa {
32 
33 // Pre-declarations
34 class BasicBlock;
35 class CFG;
36 class CFGCollector;
37 class CFGInfo;
38 class Edge;
39 class LoopUnroller;
40 namespace pfg { class PFG; class BB; }
41 class SESERegion;
43 
44 // CFGCollection Class
46  /*friend class CFGCollector;
47  friend class LoopUnroller;*/
49 public:
50  inline int count(void) const { return cfgs.length(); }
51  inline CFG *get(int index) const { return cfgs[index]; }
52  inline CFG *operator[](int index) const { return cfgs[index]; }
53 
55  public:
56  inline Iterator(const CFGCollection *cfgs)
57  : elm::genstruct::FragTable<CFG *>::Iterator(cfgs->cfgs) { }
58  inline Iterator(const CFGCollection& cfgs)
59  : elm::genstruct::FragTable<CFG *>::Iterator(cfgs.cfgs) { }
60  };
61 
62  class BBIterator: public PreIterator<BBIterator, BasicBlock *> {
63  public:
64  inline BBIterator(const CFGCollection *cfgs): cfg(cfgs), bb(*cfg) { }
65  inline BBIterator(const BBIterator& i): cfg(i.cfg), bb(i.bb) { }
66  inline BBIterator& operator=(const BBIterator& i) { cfg = i.cfg; bb = i.bb; return *this; }
67  inline bool ended(void) const { return bb.ended(); }
68  inline BasicBlock *item(void) const { return *bb; }
69  inline void next(void) { bb++; if(!bb) { cfg++; if(cfg) bb = CFG::BBIterator(*cfg); } }
70  private:
73  };
74 
75  void add(CFG *cfg);
76 };
77 
78 // PFG_FEATURE
82 
83 // COLLECTED_CFG_FEATURE
88 
89 // CFGInfoFeature
92 
93 // REDUCED_LOOPS_FEATURE
95 
96 // UNROLLED_LOOPS_FEATURE
99 
100 // PST_FEATURE
105 
106 // VIRTUALIZED_CFG_FEATURE
113 
114 // CFG_CHECKSUM_FEATURE
117 
118 // CHECKED_CFG_FEATURE
120 
121 // DELAYED_CFG_FEATURE
125 
126 // LOOP_HEADERS_FEATURE
130 
131 // LOOP_INFO_FEATURE
136 
137 // CFG I/O service
138 class CFGSaver;
139 class CFGLoader;
141 
142 // WEIGHT_FEATURE
143 extern Identifier<int> WEIGHT;
145 
146 } // otawa
147 
148 #endif /* OTAWA_CFG_FEATURES_H_ */
Identifier< bool > BACK_EDGE
Identifier for marking back edges.
The usual Feature class has as drawback to exhibit completely the processing of the feature and there...
Definition: SilentFeature.h:32
Definition: CFG.h:48
Identifier< pfg::PFG * > PFG
PFG of the program.
Identifier< bool > DELAYED_INST
This property is set on instruction of a delayed branch.
BBIterator(const CFGCollection *cfgs)
Definition: features.h:64
p::feature LOOP_INFO_FEATURE
This feature asserts that the loop info of the task is available in the framework.
CFG::BBIterator bb
Definition: features.h:72
SilentFeature REDUCED_LOOPS_FEATURE
Identifier< BasicBlock * > LOOP_EXIT_EDGE
Is defined for an Edge if this Edge is the exit-edge of any loop.
p::feature CFG_INFO_FEATURE
Feature asserting that the CFG has been scanned in the program.
Identifier< elm::genstruct::Vector< Edge * > * > EXIT_LIST
Defined for any BasicBlock that is a loop header.
Identifier< CFGInfo * > CFG_INFO
Get the collection of CFG found in the program.
Identifier< BasicBlock * > UNROLLED_FROM
Put on the header ex-header of a loop, this property gives the BB of the unrolled loop...
p::feature VIRTUALIZED_CFG_FEATURE
This features only show that the CFG has been virtualized.
SilentFeature CHECKED_CFG_FEATURE
This feature ensures that.
Identifier< bool > LOOP_HEADER
Identifier for marking basic blocks that are entries of loops.
Iterator(const CFGCollection *cfgs)
Build an iterator on the given CFG collection.
Definition: features.h:56
Identifier< bool > VIRTUAL_INLINING
Configuration property of Virtualizer: it set the default behavior for inlining of function call duri...
Control Flow Graph representation.
Definition: CFG.h:42
Identifier< Edge * > FROM_EDGE
This property is like.
Iterator(const CFGCollection &cfgs)
Definition: features.h:58
Identifier< CFG * > ENTRY_CFG
This property may be used to pass the entry CFG to a CFG processor or is used by the CFG processor to...
Definition: CFGProcessor.h:64
SilentFeature COLLECTED_CFG_FEATURE
This feature asserts that all CFG involved in the current computation has been collected and accessib...
SilentFeature PST_FEATURE
This feature represents the availability of the Program Structure Tree.
SilentFeature UNROLLED_LOOPS_FEATURE
This feature that the loops have been unrolled at least once.
Identifier< BasicBlock * > VIRTUAL_RETURN_BLOCK
This property is put on a BB performing a function call that has been virtualized (inlined in the cur...
Save the CFGs of the current task to a file.
Definition: CFGSaver.h:35
BasicBlock * item(void) const
Definition: features.h:68
Identifier< pfg::BB * > PFG_BB
Link of pfg::BB on an in instruction.
void next(void)
Definition: features.h:69
Definition: PSTBuilder.h:92
elm::genstruct::Tree< SESERegion * > PSTree
Definition: features.h:41
Contains a collection of CFGs (used with INVOLVED_CFGS property).
Definition: features.h:45
SilentFeature CFG_CHECKSUM_FEATURE
This feature ensures that each CFG has hooked a checksum allowing to check binary modifications betwe...
Identifier< bool > DELAYED_NOP
This property is true on NOP instructions insserted due to branch delay.
A basic block in a otawa::pfg::PFG .
Definition: PFG.h:40
Identifier< int > WEIGHT
Get the maximum weight for the basic block it is hooked to.
Identifier< Edge * > CALLED_BY
This properties are put on a CFG to get the list of edges calling it.
SilentFeature LOOP_HEADERS_FEATURE
This feature ensures that all loop header are marked with a LOOP_HEADER property, and the backedges a...
Identifier< sys::Path > CFG_IO_PATH
This property allows to configure the file used by CFGLoader and CFGSaver.
Identifier< BasicBlock * > ENCLOSING_LOOP_HEADER
Defined for any BasicBlock that is part of a loop.
BBIterator(const BBIterator &i)
Definition: features.h:65
A PFG (Program Flow Graph) is built from the binary form of the program to represent all possible pat...
Definition: PFG.h:105
Iterator cfg
Definition: features.h:71
Iterator on the CFG contained in a CFGCollection.
Definition: features.h:54
Identifier< const CFGCollection * > INVOLVED_CFGS
This property is used to link the current computation involved CFG on the framework.
Identifier< BasicBlock * > FROM_BB
When we get the VirtualCFG associated with a SESE region, this property, hooked on a BB from the Virt...
void add(CFG *cfg)
Add a CFG to the collection.
Definition: cfg_CFGCollector.cpp:261
Identifier< BasicBlock * > RETURN_OF
This property is put on a returning basic block and provides the matching entry block of the function...
Identifier< CFG * > CALLED_CFG
A property with this identifier is hooked to the edges performing virtual calls and virtual returns w...
p::feature WEIGHT_FEATURE
This feature ensures that weight information has been hooked to any BB of the CFG.
dtd::Element cfg(dtd::make("cfg", _CFG).attr(id).content((entry,*bb, exit,*edge)))
elm::genstruct::FragTable< CFG * > cfgs
Definition: features.h:48
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
Identifier< PSTree * > PROGRAM_STRUCTURE_TREE
This property points to the Program Structure Tree of the CFG.
CFG * operator[](int index) const
Shortcut to get().
Definition: features.h:52
int count(void) const
Get the count of CFG in the collection.
Definition: features.h:50
SilentFeature PFG_FEATURE
Feature providing the PFG of the application.
Identifier< unsigned long > CHECKSUM
This property hooked on a CFG provides a checksum build on the instruction of the CFG...
SilentFeature DELAYED_CFG_FEATURE
This feature informs that the current microprocessor supports delayed branches and that the CFG has b...
BBIterator & operator=(const BBIterator &i)
Definition: features.h:66
Definition: features.h:62
Shortcut to create a feature with a maker (without the mess of SilentFeature).
Definition: AbstractFeature.h:51
Identifier< bool > RECURSIVE_LOOP
A property with this identifier is hooked to edge performing a recursive call when inlining is used...
bool ended(void) const
Definition: features.h:67
Definition: features.h:29