Otawa  0.10
CFGProcessor.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * CFGProcessor class interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2005-08, 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_PROC_CFGPROCESSOR_H
23 #define OTAWA_PROC_CFGPROCESSOR_H
24 
25 #include <otawa/proc/Processor.h>
26 #include <elm/genstruct/SLList.h>
27 
28 namespace otawa {
29 
30 // Extern class
31 class CFG;
32 class BasicBlock;
33 
34 // Processor class
35 class CFGProcessor: public Processor {
36 public:
37  CFGProcessor(void);
40  inline CFGProcessor(cstring name, const Version& version, AbstractRegistration& reg)
41  : Processor(name, version, reg) { }
42  virtual void configure(const PropList& props);
44 
45 protected:
46 
47  // to customize
48  virtual void processWorkSpace(WorkSpace *fw);
49  virtual void processCFG(WorkSpace *fw, CFG *cfg) = 0;
50  virtual void cleanupCFG(WorkSpace *ws, CFG *cfg);
51 
52  // useful
53  void doCleanUp(void);
54  string str(const Address& address);
55  string str(const Address& base, const Address& address);
56  inline CFG *cfg(void) const { return _cfg; }
57 
58 private:
59  void init(const PropList& props);
61 };
62 
63 // Configuration Properties
66 
67 // Statistics Properties
69 
70 } // otawa
71 
72 #endif // OTAWA_PROC_CFGPROCESSOR_H
CFGProcessor(cstring name, const Version &version, AbstractRegistration &reg)
Definition: CFGProcessor.h:40
void doCleanUp(void)
Trigger associated with CFG.
Definition: proc_CFGProcessor.cpp:117
virtual void processCFG(WorkSpace *fw, CFG *cfg)=0
CFG * cfg(void) const
Get the current CFG.
Definition: CFGProcessor.h:56
Definition: Registration.h:127
elm::String name(void) const
Definition: Processor.h:91
Abstract class to represent the registered processors.
Definition: Registration.h:80
WorkSpace * ws
Definition: Processor.h:185
Control Flow Graph representation.
Definition: CFG.h:42
elm::io::IntFormat address(Address addr)
Build a format to display addresses.
Definition: base.cpp:213
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
The processor class is implemented by all code processor.
Definition: Processor.h:49
virtual void processWorkSpace(WorkSpace *fw)
Process the given framework.
Definition: proc_CFGProcessor.cpp:80
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
The representation of an address in OTAWA.
Definition: base.h:54
This is a specialization of the processor class dedicated to CFG processing.
Definition: CFGProcessor.h:35
CFG * _cfg
Definition: CFGProcessor.h:60
virtual void cleanupCFG(WorkSpace *ws, CFG *cfg)
This function may be overridden by a subclass to provide custom cleanup for a CFG.
Definition: proc_CFGProcessor.cpp:109
string str(const Address &address)
Transform an address to a smart string, that is, if a source line is available, transform it to "sour...
Definition: proc_CFGProcessor.cpp:165
elm::Version version(void) const
Definition: Processor.h:92
CFGProcessor(AbstractRegistration &reg)
Definition: CFGProcessor.h:39
Identifier< int > PROCESSED_CFG
This property is used to store statistics about the count of processed CFG.
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
void init(const PropList &props)
Initialize the processor.
Definition: proc_CFGProcessor.cpp:143
Identifier< bool > RECURSIVE
Activate the recucursive feature of BBProcessors : each time a basic block contains a function call...
This a list of properties.
Definition: PropList.h:63
CFGProcessor(void)
Build a new CFG processor.
Definition: proc_CFGProcessor.cpp:64
virtual void configure(const PropList &props)
Configure the current processor.
Definition: proc_CFGProcessor.cpp:151
static MetaRegistration reg
Definition: CFGProcessor.h:43