Otawa  0.10
AbstractCacheState.h
Go to the documentation of this file.
1 /*
2  * AbstractCacheState class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2005, 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 #ifndef OTAWA_ETS_ABSTRACTCACHESTATE_H
22 #define OTAWA_ETS_ABSTRACTCACHESTATE_H
23 
24 #include <elm/util/BitVector.h>
25 #include <elm/genstruct/HashTable.h>
26 #include <elm/genstruct/Vector.h>
27 #include <elm/io.h>
28 #include <otawa/base.h>
29 
30 using namespace elm;
31 
32 namespace otawa { namespace ets {
33 
34 // AbstractCacheState class
36  public :
38  genstruct::HashTable<address_t, int> htable;//<l-block, its index in BitVector>
40  typedef enum categorisation_t {
44  CONFLICT = 3
45  } categorisation_t;
47  genstruct::HashTable<address_t, int> hcat;//<l-block, its categorisation>
48 
50  inline AbstractCacheState(int which_line);
51  inline ~AbstractCacheState(void);
52 
53  bool areDifferent(AbstractCacheState *other);
54  void join(AbstractCacheState *state1, AbstractCacheState *state2);
55  void assignment(AbstractCacheState *other);
56  bool byConflict();
57 };
58 
59 // Inlines
60 inline AbstractCacheState::AbstractCacheState(AbstractCacheState *acs) {
61  for(int i=0;i<acs->cache_state.length();i++)
62  cache_state.add(new BitVector(*acs->cache_state[i]));
63  htable.putAll(acs->htable);
64  hcat.putAll(acs->hcat);
65  cache_line = acs->cache_line;
66 }
67 
68 inline AbstractCacheState::AbstractCacheState(int which_line) {
69  cache_line = which_line;
70 }
71 
72 inline AbstractCacheState::~AbstractCacheState(void) {
73  for(int i=0;i<cache_state.length();i++)
74  delete cache_state[i];
75  cache_state.clear();
76  htable.clear();
77  hcat.clear();
78 }
79 
80 } } // otawa::ets
81 
82 #endif // OTAWA_ETS_ABSTRACTCACHESTATE_H
genstruct::HashTable< address_t, int > htable
Definition: AbstractCacheState.h:38
Definition: categories.h:39
This class is used to represent an abstract cache line state.
Definition: AbstractCacheState.h:35
Definition: categories.h:41
genstruct::Vector< BitVector * > cache_state
Represent the cache state (table of set) with all l-blocks being in this line.
Definition: AbstractCacheState.h:37
categorisation_t
Definition: AbstractCacheState.h:40
genstruct::HashTable< address_t, int > hcat
Definition: AbstractCacheState.h:47
categorisation_t categorisation
Categorisation (a_h, a_m, f_m, c) according to F.
Definition: AbstractCacheState.h:46
int cache_line
It is the number of the cache line.
Definition: AbstractCacheState.h:39
Definition: categories.h:42