Otawa  0.10
CFGBuilder.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * CFGBuilder processor interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2005-09, 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 
23 #ifndef OTAWA_CFG_CFG_BUILDER_H
24 #define OTAWA_CFG_CFG_BUILDER_H
25 
26 #include <elm/genstruct/Vector.h>
27 #include <otawa/cfg/features.h>
28 #include <otawa/proc/Processor.h>
29 #include <otawa/cfg/CFGInfo.h>
30 
31 namespace otawa {
32 
33 // CFGBuilder class
34 class CFGBuilder: public Processor {
35 public:
36  CFGBuilder(void);
37 
38  // Processor overload
39  virtual void processWorkSpace(WorkSpace *fw);
40  virtual void configure(const PropList& props = PropList::EMPTY);
41 
42 private:
44  CodeBasicBlock *thisBB(Inst *inst);
45  void addSubProgram(Segment *seg, Inst *inst);
46  void buildCFG(WorkSpace *ws, Segment *seg);
47  void addFile(WorkSpace *ws, File *file);
48  //void buildAll(WorkSpace *fw);
49  void addCFG(Segment *seg, BasicBlock *bb);
50 
51  //genstruct::Vector<CFG *> _cfgs;
53 };
54 
55 } // otawa
56 
57 #endif // OTAWA_CFG_CFG_BUILDER_H
58 
struct otawa::sem::inst inst
CFGInfo * info
Definition: CFGBuilder.h:52
void addCFG(Segment *seg, BasicBlock *bb)
Add a new CFG that starts at the given BB (if not already declared).
Definition: cfg_CFGBuilder.cpp:87
static const PropList EMPTY
This is an empty proplist for convenience.
Definition: PropList.h:66
WorkSpace * ws
Definition: Processor.h:185
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
Represent a basic block in the strictess meaning: a sequence of instructions containing no branch...
Definition: BasicBlock.h:188
In usual file format like ELF, COFF and so on, the program file is divided in segment according platf...
Definition: Segment.h:40
This class represents a file involved in the building of a process.
Definition: File.h:43
The processor class is implemented by all code processor.
Definition: Processor.h:49
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
void addFile(WorkSpace *ws, File *file)
Add a file to the builder.
Definition: cfg_CFGBuilder.cpp:349
void addSubProgram(Segment *seg, Inst *inst)
Record the given instruction as the startup of a sub-program.
Definition: cfg_CFGBuilder.cpp:153
CFGBuilder(void)
CFG builder constructor.
Definition: cfg_CFGBuilder.cpp:76
This processor is used for building the CFG from the binary program representation.
Definition: CFGBuilder.h:34
CodeBasicBlock * nextBB(Inst *inst)
Find the basic block starting on the next instruction.
Definition: cfg_CFGBuilder.cpp:104
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
This allows storing all CFG available in a workspace.
Definition: CFGInfo.h:29
This a list of properties.
Definition: PropList.h:63
virtual void processWorkSpace(WorkSpace *fw)
Process the given framework.
Definition: cfg_CFGBuilder.cpp:386
CodeBasicBlock * thisBB(Inst *inst)
Get or create the basic block on the given instruction.
Definition: cfg_CFGBuilder.cpp:131
virtual void configure(const PropList &props=PropList::EMPTY)
This method may be called for configuring a processor thanks to information passed in the property li...
Definition: cfg_CFGBuilder.cpp:406
void buildCFG(WorkSpace *ws, Segment *seg)
Build the CFG for the given code.
Definition: cfg_CFGBuilder.cpp:165