Otawa  0.10
ACSMayBuilder.h
Go to the documentation of this file.
1 /*
2  * dcache::ACSMayBuilder class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2010, 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  */
21 
22 #ifndef MAYACSBUILDER_H_
23 #define MAYACSBUILDER_H_
24 
25 #include <elm/genstruct/Vector.h>
26 #include <otawa/prop/Identifier.h>
27 #include <otawa/proc/Processor.h>
28 #include <otawa/util/HalfAbsInt.h>
29 #include "features.h"
30 
31 namespace otawa {
32 
33 class BasicBlock;
34 namespace hard { class Cache; }
35 
36 namespace dcache {
37 
38 // MAYProblem class
39 class MAYProblem {
40 public:
41 
42  class Domain: public ACS {
43  public:
44  inline Domain(const int _size, const int _A): ACS(_size, _A) { }
45  inline Domain(const Domain &source) : ACS(source) { }
46 
47  inline Domain& operator=(const Domain &src) { ACS::operator=(src); return *this; }
48  inline Domain& operator=(const ACS& src) { ACS::operator=(src); return *this; }
49 
50  inline void glb(const Domain &dom) { ASSERT(false); }
51 
52  inline void lub(const Domain &dom) {
53  ASSERT((A == dom.A) && (size == dom.size));
54  for (int i = 0; i < size; i++)
55  if (((age[i] > dom.age[i]) && (dom.age[i] != -1)) || (age[i] == -1))
56  age[i] = dom.age[i];
57  }
58 
59  inline void addDamage(const int id, const int damage) {
60  ASSERT((id >= 0) && (id < size));
61  if (age[id] == -1)
62  return;
63  age[id] += damage;
64  if (age[id] >= A)
65  age[id] = -1;
66  }
67 
68  inline void inject(const int id) {
69  if (contains(id)) {
70  for (int i = 0; i < size; i++)
71  if ((age[i] <= age[id]) && (age[i] != -1))
72  age[i]++;
73  }
74  else
75  for (int i = 0; i < size; i++) {
76  if (age[i] != -1)
77  age[i]++;
78  if (age[i] == A)
79  age[i] = -1;
80  }
81  age[id] = 0;
82  }
83 
84  inline void ageAll(void) {
85  for (int i = 0; i < size; i++) {
86  if (age[i] != -1)
87  age[i]++;
88  if (age[i] == A)
89  age[i] = -1;
90  }
91  }
92 
93  };
94 
95 private:
98  int line;
102 
103 public:
105 
106  MAYProblem(const BlockCollection& coll, WorkSpace *_fw, const hard::Cache *_cache);
107  ~MAYProblem(void);
108 
109  const Domain& bottom(void) const;
110  const Domain& entry(void) const;
111  inline void lub(Domain &a, const Domain &b) const { a.lub(b); }
112  inline void assign(Domain &a, const Domain &b) const { a = b; }
113  inline bool equals(const Domain &a, const Domain &b) const { return (a.equals(b)); }
114  void update(Domain& out, const Domain& in, BasicBlock* bb);
115  void update(Domain& s, const BlockAccess& access);
116  inline void enterContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx) { }
117  inline void leaveContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx) { }
118 };
119 
121 
123 
124 
125 // ACSMayBuilder class
127 public:
128  static p::declare reg;
130  virtual void processWorkSpace(otawa::WorkSpace *ws);
131  virtual void configure(const PropList &props);
132 
133 private:
135  bool unrolling;
137 };
138 
139 } } // otawa::dcache
140 
141 #endif /* MAYACSBUILDER_H_ */
void enterContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: ACSMayBuilder.h:116
Definition: ACSMayBuilder.h:42
void processLBlockSet(otawa::WorkSpace *ws, const BlockCollection &coll, const hard::Cache *cache)
Definition: dcache_ACSMayBuilder.cpp:157
int A
Definition: features.h:82
Domain(const int _size, const int _A)
Definition: ACSMayBuilder.h:44
dtd::RefAttr< BasicBlock * > source("source", dtd::STRICT|dtd::REQUIRED)
A block access represents a data memory access of an instruction.
Definition: features.h:125
bool equals(const ACS &dom) const
Test if two ACS are equals.
Definition: features.h:61
Domain callstate
Definition: ACSMayBuilder.h:104
void glb(const Domain &dom)
Definition: ACSMayBuilder.h:50
bool equals(const Domain &a, const Domain &b) const
Definition: ACSMayBuilder.h:113
int line
Definition: ACSMayBuilder.h:98
void ageAll(void)
Definition: ACSMayBuilder.h:84
elm::io::Output & operator<<(elm::io::Output &output, const MUSTProblem::Domain &dom)
Definition: dcache_ACSBuilder.cpp:155
Class to declare simple a processor.
Definition: Registration.h:213
bool contains(const int id) const
Test if a block is in the ACS , that is, its each age is in the interval [0, A[ where A is the associ...
Definition: features.h:68
sys::SystemInStream & in
WorkSpace * ws
Definition: Processor.h:185
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
void lub(const Domain &dom)
Definition: ACSMayBuilder.h:52
uint32 size
Domain(const Domain &source)
Definition: ACSMayBuilder.h:45
Domain & operator=(const ACS &src)
Definition: ACSMayBuilder.h:48
elm::genstruct::Vector< MAYProblem::Domain * > may_acs_t
Definition: ACSMayBuilder.h:122
Domain ent
Definition: ACSMayBuilder.h:101
void update(Domain &out, const Domain &in, BasicBlock *bb)
Produces the output MAY cache state with the execution of given BB.
Definition: dcache_ACSMayBuilder.cpp:73
The processor class is implemented by all code processor.
Definition: Processor.h:49
void leaveContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: ACSMayBuilder.h:117
ACSMayBuilder(p::declare &r=reg)
Definition: dcache_ACSMayBuilder.cpp:151
void lub(Domain &a, const Domain &b) const
Definition: ACSMayBuilder.h:111
MAYProblem(const BlockCollection &coll, WorkSpace *_fw, const hard::Cache *_cache)
Definition: dcache_ACSMayBuilder.cpp:21
void assign(Domain &a, const Domain &b) const
Definition: ACSMayBuilder.h:112
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
This class contains the configuration of a level of cache of processor.
Definition: Cache.h:34
int size
Definition: features.h:82
Vector< ACS * > * may_entry
Definition: ACSMayBuilder.h:136
void addDamage(const int id, const int damage)
Definition: ACSMayBuilder.h:59
const BlockCollection & coll
Definition: ACSMayBuilder.h:96
Definition: MAYProblem.h:43
WorkSpace * fw
Definition: ACSMayBuilder.h:97
StringOption cache(command, 'c',"cache","used cache","path","")
sys::SystemOutStream & out
const Domain & entry(void) const
Definition: dcache_ACSMayBuilder.cpp:44
static p::declare reg
Definition: ACSMayBuilder.h:128
void inject(const int id)
Definition: ACSMayBuilder.h:68
const Domain & bottom(void) const
Definition: dcache_ACSMayBuilder.cpp:41
hai_context_t
Definition: HalfAbsInt.h:50
ACS & operator=(const ACS &src)
Definition: features.h:59
~MAYProblem(void)
Definition: dcache_ACSMayBuilder.cpp:37
const hard::Cache * cache
Definition: ACSMayBuilder.h:99
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
int * age
Definition: features.h:83
virtual void configure(const PropList &props)
This method may be called for configuring a processor thanks to information passed in the property li...
Definition: dcache_ACSMayBuilder.cpp:196
This processor computes the ACS for the MAY cache analysis.
Definition: ACSMayBuilder.h:126
Domain & operator=(const Domain &src)
Definition: ACSMayBuilder.h:47
This a list of properties.
Definition: PropList.h:63
virtual void processWorkSpace(otawa::WorkSpace *ws)
Process the given framework.
Definition: dcache_ACSMayBuilder.cpp:204
Definition: ACSMayBuilder.h:39
Representation of an Abstract Cache State where each data cache block is represented by its age...
Definition: features.h:47
Domain bot
Definition: ACSMayBuilder.h:100
A block collections stores the list of data blocks used in a task for a specific line.
Definition: features.h:108
bool unrolling
Definition: ACSMayBuilder.h:135