Otawa  0.10
MUSTPERS.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * This file describes the Must & Pers combined problem.
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 CACHE_MUSTPERS_H_
25 #define CACHE_MUSTPERS_H_
26 
27 #include <elm/io.h>
28 #include <otawa/prog/WorkSpace.h>
29 #include <otawa/cache/LBlockSet.h>
30 #include <otawa/hard/Cache.h>
31 #include <otawa/cfg/BasicBlock.h>
32 #include <otawa/util/HalfAbsInt.h>
33 
34 
35 namespace otawa {
36 
37 class MUSTPERS {
38 
41 
42  // Types
43  public:
44  class Domain {
45  friend class MUSTPERS;
46 
49 
50  public:
51  inline Domain(const int _size, const int _A)
52  : pers(PERSProblem::Domain(_size, _A)), must(MUSTProblem::Domain(_size, _A)) {
53 
54  }
55 
56 
57  inline Domain(const Domain &source) : pers(source.pers), must(source.must) {
58  }
59 
60  inline Domain& operator=(const Domain &src) {
61  pers = src.pers;
62  must = src.must;
63  return *this;
64  }
65 
67  return must;
68  }
69 
70 
72  return pers;
73  }
74 
75  inline void lub(const Domain &dom) {
76  pers.lub(dom.pers);
77  must.lub(dom.must);
78  }
79 
80  inline int getSize(void) {
81  return must.getSize();
82  }
83 
84  inline bool equals(const Domain &dom) const {
85  return (pers.equals(dom.pers) && must.equals(dom.must));
86  }
87 
88  inline void empty() {
89  must.empty();
90  pers.empty();
91  }
92 
93  inline bool mustContains(const int id) {
94  return(must.contains(id));
95  }
96 
97  inline bool persContains(const int id, const int index) {
98  return(pers.contains(id, index));
99  }
100 
101  inline bool isWiped(const int id, const int index) {
102  return(pers.isWiped(id, index));
103  }
104 
105  inline bool isPersistent(const int id, const int index) {
106  return(pers.isPersistent(id, index));
107  }
108  inline void inject(const int id) {
109  pers.inject(&must, id);
110  must.inject(id);
111  }
112 
113  inline void print(elm::io::Output &output) const {
114  output << "PERS=[ ";
115  pers.print(output);
116  output << "] MUST=[ ";
117  must.print(output);
118  output << "]";
119  }
120 
121  };
122 
123 
124  private:
127  unsigned int line;
128 
129  public:
130 
131  // Constructors
132  MUSTPERS(const int _size, LBlockSet *_lbset, WorkSpace *_fw, const hard::Cache *_cache, const int _A);
133 
134  // Problem methods
135  const Domain& bottom(void) const;
136  const Domain& entry(void) const;
137 
138  inline void lub(Domain &a, const Domain &b) const {
139  a.lub(b);
140  }
141  inline void assign(Domain &a, const Domain &b) const {
142  a = b;
143  }
144  inline bool equals(const Domain &a, const Domain &b) const {
145  return (a.equals(b));
146  }
147 
148  void update(Domain& out, const Domain& in, BasicBlock* bb);
149 
150  inline void enterContext(Domain &dom, BasicBlock *header, hai_context_t ctx) {
151  persProb.enterContext(dom.pers, header, ctx);
152  mustProb.enterContext(dom.must, header, ctx);
153 
154  }
155 
156  inline void leaveContext(Domain &dom, BasicBlock *header, hai_context_t ctx) {
157  persProb.leaveContext(dom.pers, header, ctx);
158  mustProb.leaveContext(dom.must, header, ctx);
159 
160  }
161 
162 };
163 
164 elm::io::Output& operator<<(elm::io::Output& output, const MUSTPERS::Domain& dom);
165 
166 }
167 
168 #endif /*CACHE_MUSTPROBLEM_H_*/
bool equals(const Domain &a, const Domain &b) const
Definition: MUSTPERS.h:144
dtd::RefAttr< BasicBlock * > source("source", dtd::STRICT|dtd::REQUIRED)
MUSTPERS(const int _size, LBlockSet *_lbset, WorkSpace *_fw, const hard::Cache *_cache, const int _A)
Definition: cache_MUSTPERS.cpp:89
void leaveContext(Domain &dom, BasicBlock *header, hai_context_t ctx)
Definition: PERSProblem.h:443
void update(Domain &out, const Domain &in, BasicBlock *bb)
Definition: cache_MUSTPERS.cpp:112
int getSize(void)
Definition: MUSTPERS.h:80
Definition: MUSTPERS.h:37
void lub(Domain &a, const Domain &b) const
Definition: MUSTPERS.h:138
bool isPersistent(const int id, const int index)
Definition: MUSTPERS.h:105
bool persContains(const int id, const int index)
Definition: MUSTPERS.h:97
bool equals(const Domain &dom) const
Definition: MUSTPERS.h:84
void print(elm::io::Output &output) const
Definition: PERSProblem.h:347
Definition: MUSTPERS.h:44
void inject(const int id)
Definition: MUSTPERS.h:108
Domain bot
Definition: MUSTPERS.h:125
PERSProblem::Domain pers
Definition: MUSTPERS.h:47
bool contains(const int id, const int index)
Definition: PERSProblem.h:294
void leaveContext(Domain &dom, BasicBlock *header, hai_context_t ctx)
Definition: MUSTProblem.h:234
sys::SystemInStream & in
MUSTProblem mustProb
Definition: MUSTPERS.h:39
void lub(const Domain &dom)
Definition: PERSProblem.h:219
void lub(const Domain &dom)
Definition: MUSTPERS.h:75
void empty()
Definition: MUSTPERS.h:88
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
bool isPersistent(const int id, const int index)
Definition: PERSProblem.h:318
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
void assign(Domain &a, const Domain &b) const
Definition: MUSTPERS.h:141
void enterContext(Domain &dom, BasicBlock *header, hai_context_t ctx)
Definition: PERSProblem.h:436
void inject(const int id)
Definition: MUSTProblem.h:133
void inject(MUSTProblem::Domain *must, const int id)
Definition: PERSProblem.h:300
bool equals(const Domain &dom) const
Definition: PERSProblem.h:265
PERSProblem::Domain & getPers()
Definition: MUSTPERS.h:71
Problem for computing the PERS ACS of L-blocks.
Definition: PERSProblem.h:38
void lub(const Domain &dom)
Definition: MUSTProblem.h:91
PERSProblem persProb
Definition: MUSTPERS.h:40
void enterContext(Domain &dom, BasicBlock *header, hai_context_t ctx)
Definition: MUSTPERS.h:150
MUSTProblem::Domain & getMust()
Definition: MUSTPERS.h:66
void print(elm::io::Output &output) const
Definition: MUSTPERS.h:113
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
void empty()
Definition: MUSTProblem.h:121
This class contains the configuration of a level of cache of processor.
Definition: Cache.h:34
bool contains(const int id)
Definition: MUSTProblem.h:127
const Domain & entry(void) const
Definition: cache_MUSTPERS.cpp:108
void print(elm::io::Output &output) const
Definition: MUSTProblem.h:151
int getSize(void)
Definition: MUSTProblem.h:100
Definition: MUSTProblem.h:39
Domain & operator=(const Domain &src)
Definition: MUSTPERS.h:60
void leaveContext(Domain &dom, BasicBlock *header, hai_context_t ctx)
Definition: MUSTPERS.h:156
sys::SystemOutStream & out
This class represents the list of l-blocks of a task for a chosen cache row.
Definition: LBlockSet.h:38
bool mustContains(const int id)
Definition: MUSTPERS.h:93
hai_context_t
Definition: HalfAbsInt.h:50
unsigned int line
Definition: MUSTPERS.h:127
bool equals(const Domain &dom) const
Definition: MUSTProblem.h:113
void enterContext(Domain &dom, BasicBlock *header, hai_context_t ctx)
Definition: MUSTProblem.h:230
Domain(const Domain &source)
Definition: MUSTPERS.h:57
Domain ent
Definition: MUSTPERS.h:126
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
void empty()
Definition: PERSProblem.h:274
const Domain & bottom(void) const
Definition: cache_MUSTPERS.cpp:105
MUSTProblem::Domain must
Definition: MUSTPERS.h:48
bool isWiped(const int id, const int index)
Definition: MUSTPERS.h:101
Definition: PERSProblem.h:168
bool isWiped(const int id, const int index)
Definition: PERSProblem.h:307
Domain(const int _size, const int _A)
Definition: MUSTPERS.h:51
Definition: MUSTProblem.h:44