Otawa  0.10
MUSTPERS.h
Go to the documentation of this file.
1 /*
2  * dcache::MUSTPERS class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2013, 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
20  * 02110-1301 USA
21  */
22 
23 #ifndef OTAWA_DCACHE_MUSTPERS_H_
24 #define OTAWA_DCACHE_MUSTPERS_H_
25 
26 #include <elm/io.h>
27 #include <otawa/prog/WorkSpace.h>
28 #include <otawa/dcache/features.h>
29 #include <otawa/hard/Cache.h>
30 #include <otawa/cfg/BasicBlock.h>
31 #include <otawa/util/HalfAbsInt.h>
34 
35 namespace otawa { namespace dcache {
36 
37 class MUSTPERS {
38 public:
39  class Domain {
40  friend class MUSTPERS;
41  public:
42  inline Domain(const int _size, const int _A)
43  : pers(PERSProblem::Domain(_size, _A)), must(MUSTProblem::Domain(_size, _A)) { }
44  inline Domain(const Domain &source) : pers(source.pers), must(source.must) { }
45  inline MUSTProblem::Domain& getMust(void) { return must; }
46  inline PERSProblem::Domain& getPers(void) { return pers; }
47  private:
50  };
51 
52 public:
53  MUSTPERS(const BlockCollection *_lbset, WorkSpace *_fw, const hard::Cache *_cache);
54  inline void setMust(Domain& d, const ACS& acs) const { mustProb.assign(d.must, acs); }
55  inline void emptyPers(Domain& d) const { d.pers.empty(); }
56  inline void setPers(Domain& d, const ACS& acs, const acs_stack_t& s) { d.pers.set(acs, s); }
57 
58  // abstract interpretation
59  const Domain& bottom(void) const;
60  const Domain& entry(void) const;
61  inline void lub(Domain &a, const Domain &b) const
62  { mustProb.lub(a.must, b.must); persProb.lub(a.pers, b.pers); }
63  inline void assign(Domain &a, const Domain &b) const //{ a = b; }
64  { persProb.assign(a.pers, b.pers); mustProb.assign(a.must, b.must); }
65  inline bool equals(const Domain &a, const Domain &b) const //{ return (a.equals(b)); }
66  { return (persProb.equals(a.pers, b.pers) && mustProb.equals(a.must, b.must)); };
67  void print(elm::io::Output &output, const Domain& d) const;
68 
69  void update(Domain& out, const Domain& in, BasicBlock* bb);
70  void update(Domain& s, const BlockAccess& access);
71  inline void ageAll(Domain& d) const { d.must.ageAll(); d.pers.ageAll(); }
72  inline void inject(Domain& d, const int id) const { d.pers.inject(&d.must, id); d.must.inject(id); }
73 
74  inline void enterContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx) {
75  persProb.enterContext(dom.pers, header, ctx);
76  mustProb.enterContext(dom.must, header, ctx);
77  }
78 
79  inline void leaveContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx) {
80  persProb.leaveContext(dom.pers, header, ctx);
81  mustProb.leaveContext(dom.must, header, ctx);
82  }
83 
84 private:
87  int set;
90 };
91 
92 //elm::io::Output& operator<<(elm::io::Output& output, const Pair<const MUSTPERS&, const MUSTPERS::Domain>& dom);
93 
94 } } // otawa::dcache
95 
96 #endif /* OTAWA_DCACHE_MUSTPROBLEM_H_*/
dtd::RefAttr< BasicBlock * > source("source", dtd::STRICT|dtd::REQUIRED)
void assign(Domain &a, const Domain &b) const
Definition: PERSProblem.h:117
A block access represents a data memory access of an instruction.
Definition: features.h:125
MUSTProblem::Domain must
Definition: MUSTPERS.h:49
void lub(Domain &a, const Domain &b) const
Definition: MUSTPERS.h:61
const Domain & entry(void) const
Definition: dcache_ACSBuilder.cpp:700
void leaveContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: PERSProblem.h:131
void assign(Domain &a, const Domain &b) const
Definition: ACSBuilder.h:105
Domain(const Domain &source)
Definition: MUSTPERS.h:44
MUSTPERS(const BlockCollection *_lbset, WorkSpace *_fw, const hard::Cache *_cache)
Definition: dcache_ACSBuilder.cpp:681
Definition: ACSBuilder.h:37
void inject(Domain &d, const int id) const
Definition: MUSTPERS.h:72
void lub(Domain &a, const Domain &b) const
Definition: PERSProblem.h:116
void ageAll(Domain &d) const
Definition: MUSTPERS.h:71
void setMust(Domain &d, const ACS &acs) const
Definition: MUSTPERS.h:54
sys::SystemInStream & in
MUSTProblem::Domain & getMust(void)
Definition: MUSTPERS.h:45
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
Domain ent
Definition: MUSTPERS.h:86
Domain bot
Definition: MUSTPERS.h:85
PERSProblem::Domain & getPers(void)
Definition: MUSTPERS.h:46
void enterContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: PERSProblem.h:124
bool equals(const Domain &a, const Domain &b) const
Definition: PERSProblem.h:118
ACS of the MUSTPERS problem.
Definition: MUSTPERS.h:39
void leaveContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: ACSBuilder.h:112
MUSTProblem mustProb
Definition: MUSTPERS.h:88
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
bool equals(const Domain &a, const Domain &b) const
Definition: ACSBuilder.h:107
void ageAll(void)
Definition: ACSBuilder.h:83
void inject(MUSTProblem::Domain *must, const int id)
Consider that the designed block is accessed.
Definition: dcache_ACSBuilder.cpp:950
sys::SystemOutStream & out
PERSProblem::Domain pers
Definition: MUSTPERS.h:48
void enterContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: ACSBuilder.h:111
Definition: PERSProblem.h:58
hai_context_t
Definition: HalfAbsInt.h:50
Problem for computing the PERS ACS of L-blocks.
Definition: PERSProblem.h:37
void empty(void)
Empty the domain.
Definition: dcache_ACSBuilder.cpp:924
void lub(Domain &a, const Domain &b) const
Definition: ACSBuilder.h:100
Definition: MUSTPERS.h:37
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
const Domain & bottom(void) const
Definition: dcache_ACSBuilder.cpp:697
void ageAll(void)
Consider that an unknown access is performed and, therefore, all blocks must be aged.
Definition: dcache_ACSBuilder.cpp:646
void assign(Domain &a, const Domain &b) const
Definition: MUSTPERS.h:63
void update(Domain &out, const Domain &in, BasicBlock *bb)
Definition: dcache_ACSBuilder.cpp:749
bool equals(const Domain &a, const Domain &b) const
Definition: MUSTPERS.h:65
void set(const ACS &w, const genstruct::Table< ACS * > &d)
Definition: PERSProblem.h:88
int set
Definition: MUSTPERS.h:87
Domain(const int _size, const int _A)
Definition: MUSTPERS.h:42
The MUST problem provides the abstract interpretation of L1 data cache for the MUST case...
Definition: ACSBuilder.h:35
void enterContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: MUSTPERS.h:74
Representation of an Abstract Cache State where each data cache block is represented by its age...
Definition: features.h:47
void inject(const int id)
Definition: ACSBuilder.h:67
void leaveContext(Domain &dom, BasicBlock *header, util::hai_context_t ctx)
Definition: MUSTPERS.h:79
void setPers(Domain &d, const ACS &acs, const acs_stack_t &s)
Definition: MUSTPERS.h:56
void emptyPers(Domain &d) const
Definition: MUSTPERS.h:55
A block collections stores the list of data blocks used in a task for a specific line.
Definition: features.h:108
void print(elm::io::Output &output, const Domain &d) const
Print the MUSTPERS ACS.
Definition: dcache_ACSBuilder.cpp:672
PERSProblem persProb
Definition: MUSTPERS.h:89