Otawa  0.10
WorkSpace.h
Go to the documentation of this file.
1 /*
2  * WorkSpace class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2007-8, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  * This file is part of OTAWA
21  * Copyright (c) 2007-08, IRIT UPS.
22  */
23 #ifndef OTAWA_PROG_WORK_SPACE_H
24 #define OTAWA_PROG_WORK_SPACE_H
25 
26 #include <elm/system/Path.h>
27 #include <elm/genstruct/Vector.h>
28 #include <otawa/properties.h>
29 #include <otawa/prog/Process.h>
30 
31 namespace elm { namespace xom {
32  class Element;
33 } } // elm::xom
34 
35 namespace otawa {
36 
37 using namespace elm;
38 using namespace elm::genstruct;
39 
40 // Classes
41 class AbstractFeature;
42 class FeatureDependency;
43 namespace ast {
44  class AST;
45  class ASTInfo;
46 }
47 class CFG;
48 class CFGInfo;
49 class File;
50 class Inst;
51 class Loader;
52 class Manager;
53 class Process;
54 namespace hard {
55  class CacheConfiguration;
56  class Platform;
57  class Processor;
58 }
59 namespace ilp {
60  class System;
61 }
62 namespace sim {
63  class Simulator;
64 }
65 
66 // WorkSpace class
67 class WorkSpace: public PropList {
68 public:
69  WorkSpace(Process *_proc);
70  WorkSpace(const WorkSpace *ws);
71  virtual ~WorkSpace(void);
72  inline Process *process(void) const { return &proc; };
73 
74  // Process overload
75  virtual hard::Platform *platform(void) { return proc->platform(); };
76  virtual Manager *manager(void) { return proc->manager(); };
77  virtual Inst *start(void) { return proc->start(); };
78  virtual Inst *findInstAt(address_t addr) { return proc->findInstAt(addr); };
79  string format(Address addr, bool with_address = true);
80 
81  // Configuration services
83  void loadConfig(const elm::system::Path& path);
84 
85  // Feature management
86  void require(const AbstractFeature& feature, const PropList& props = PropList::EMPTY);
87  void provide(const AbstractFeature& feature, const Vector<const AbstractFeature*> *required = NULL);
88  bool isProvided(const AbstractFeature& feature);
89  void remove(const AbstractFeature& feature);
90  void invalidate(const AbstractFeature& feature);
91  FeatureDependency* getDependency(const AbstractFeature* feature);
92 
93  // cancellation management
94  inline void clearCancellation(void) { cancelled = false; }
95  inline void cancel(void) { cancelled = true; }
96  inline bool isCancelled(void) const { return cancelled; }
97 
98  // serialization
99  virtual void serialize(elm::serial2::Serializer& serializer);
100  virtual void unserialize(elm::serial2::Unserializer& unserializer);
101 
102  // deprecated
103  ast::ASTInfo *getASTInfo(void);
104  ilp::System *newILPSystem(bool max = true);
105  CFGInfo *getCFGInfo(void);
106  CFG *getStartCFG(void);
107  virtual const hard::CacheConfiguration& cache(void);
108 
109 private:
110  void newFeatDep(const AbstractFeature* feature);
111  bool hasFeatDep(const AbstractFeature* feature);
112  void delFeatDep(const AbstractFeature* feature);
113 
114 private:
118  bool cancelled;
119 };
120 
121 }; // otawa
122 
123 #endif // OTAWA_PROG_WORK_SPACE_H
const int config
Definition: Registration.h:48
virtual Manager * manager(void)
Definition: WorkSpace.h:76
static const PropList EMPTY
This is an empty proplist for convenience.
Definition: PropList.h:66
feat_map_t featMap
Definition: WorkSpace.h:117
bool isCancelled(void) const
Test if the cancel() method has been called on the workspace.
Definition: WorkSpace.h:96
const int provide
Definition: Registration.h:44
Control Flow Graph representation.
Definition: CFG.h:42
StringOption proc(command, 'p',"processor","used processor","path","")
The manager class providesfacilities for storing, grouping and retrieving shared resources like loade...
Definition: Manager.h:58
void cancel(void)
Informs the current computation to stop as soon as possible.
Definition: WorkSpace.h:95
Process * process(void) const
Definition: WorkSpace.h:72
virtual hard::Platform * platform(void)
Definition: WorkSpace.h:75
A feature dependency represents the dependencies used to implement a feature and is a node of the dep...
Definition: FeatureDependency.h:35
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
bool cancelled
Definition: WorkSpace.h:118
A process is the realization of a program on a platform.
Definition: Process.h:136
The representation of an address in OTAWA.
Definition: base.h:54
This class stores all the function known for the current framework.
Definition: ASTInfo.h:34
const int require
Definition: Registration.h:43
StringOption cache(command, 'c',"cache","used cache","path","")
virtual Inst * start(void)
Definition: WorkSpace.h:77
const int invalidate
Definition: Registration.h:45
void clearCancellation(void)
Reset the cancellation bit.
Definition: WorkSpace.h:94
This class records information about the architecture where the processed program will run...
Definition: Platform.h:48
virtual Inst * findInstAt(address_t addr)
Definition: WorkSpace.h:78
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
HashTable< const AbstractFeature *, FeatureDependency * > feat_map_t
Definition: WorkSpace.h:116
See Feature.
Definition: AbstractFeature.h:36
This allows storing all CFG available in a workspace.
Definition: CFGInfo.h:29
This a list of properties.
Definition: PropList.h:63
An ILP system is a colletion of ILP constraint that may maximize or minimize some object function...
Definition: System.h:42
intn_t max(intn_t a, intn_t b)
Return the max with a signed comparison.
Definition: clp_analysis.cpp:180
This class represents the full configuration of caches of a processor.
Definition: CacheConfiguration.h:37
AutoPtr< Process > proc
Definition: WorkSpace.h:115