Otawa  0.10
Virtualizer.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Virtualizer processor (function inliner)
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2007, 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
21  * 02110-1301 USA
22  */
23 
24 #ifndef OTAWA_CFG_VIRTUALIZER_H_
25 #define OTAWA_CFG_VIRTUALIZER_H_
26 
27 #include <otawa/proc/Processor.h>
28 #include <otawa/proc/Feature.h>
29 #include <otawa/prop/Identifier.h>
30 #include <elm/genstruct/HashTable.h>
31 #include <otawa/cfg/CFG.h>
32 #include <otawa/cfg/VirtualCFG.h>
33 #include <otawa/cfg/BasicBlock.h>
34 #include <otawa/prog/WorkSpace.h>
35 #include <otawa/prop/PropList.h>
36 #include <elm/util/Option.h>
38 
39 
40 namespace otawa {
41 
42 class CFGCollection;
43 
44 // Virtualizer class
45 class Virtualizer: public Processor {
46 
47 public:
48  Virtualizer(void);
49  static p::declare reg;
50 
51  virtual void configure(const PropList& props);
52 
53 protected:
54  virtual void processWorkSpace(WorkSpace *ws);
55  virtual void cleanup(WorkSpace *ws);
56 
57 private:
58  void virtualize(struct call_t*, CFG *cfg, VirtualCFG *vcfg, BasicBlock *entry,
59  BasicBlock *exit, elm::Option<int> local_inlining, ContextualPath &path);
60  VirtualCFG *virtualizeCFG(struct call_t *call, CFG *cfg, elm::Option<int> local_inlining);
61  void enteringCall(BasicBlock *caller, BasicBlock *callee, ContextualPath &path);
62  void leavingCall(BasicBlock *to, ContextualPath &path);
63  bool isInlined(CFG* cfg, Option<int> local_inlining, ContextualPath &path);
67 };
68 
69 } // otawa
70 
71 #endif // OTAWA_CFG_VIRTUALIZER_H_
virtual void cleanup(WorkSpace *ws)
This method is called after the end of the processor analysis to let it do some clean up...
Definition: cfg_Virtualizer.cpp:404
elm::genstruct::HashTable< void *, VirtualCFG * > cfgMap
Definition: Virtualizer.h:66
VirtualCFG * virtualizeCFG(struct call_t *call, CFG *cfg, elm::Option< int > local_inlining)
Virtualize a CFG and add it to the cfg map.
Definition: cfg_Virtualizer.cpp:365
Definition: ContextualProperty.h:105
Class to declare simple a processor.
Definition: Registration.h:213
bool virtual_inlining
Definition: Virtualizer.h:64
This processor inlines the function calls.
Definition: Virtualizer.h:45
WorkSpace * ws
Definition: Processor.h:185
Control Flow Graph representation.
Definition: CFG.h:42
dtd::Element exit(dtd::make("exit", _EXIT).attr(id))
The processor class is implemented by all code processor.
Definition: Processor.h:49
virtual void configure(const PropList &props)
This method may be called for configuring a processor thanks to information passed in the property li...
Definition: cfg_Virtualizer.cpp:185
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
Virtualizer(void)
Definition: cfg_Virtualizer.cpp:156
void leavingCall(BasicBlock *to, ContextualPath &path)
Definition: cfg_Virtualizer.cpp:395
bool isInlined(CFG *cfg, Option< int > local_inlining, ContextualPath &path)
Test if inlining has been activated on.
Definition: cfg_Virtualizer.cpp:197
void enteringCall(BasicBlock *caller, BasicBlock *callee, ContextualPath &path)
Definition: cfg_Virtualizer.cpp:378
A virtual CFG is a CFG not-mapped to real code, that is, it may contains virtual nodes for inlining f...
Definition: VirtualCFG.h:29
struct otawa::call_t call_t
dtd::Element cfg(dtd::make("cfg", _CFG).attr(id).content((entry,*bb, exit,*edge)))
void virtualize(struct call_t *, CFG *cfg, VirtualCFG *vcfg, BasicBlock *entry, BasicBlock *exit, elm::Option< int > local_inlining, ContextualPath &path)
Build the virtual CFG.
Definition: cfg_Virtualizer.cpp:220
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
static p::declare reg
Definition: Virtualizer.h:49
virtual void processWorkSpace(WorkSpace *ws)
Process the given framework.
Definition: cfg_Virtualizer.cpp:170
This a list of properties.
Definition: PropList.h:63
CFG * entry
Definition: Virtualizer.h:65