MayDomain.cpp 1.1 KB
Newer Older
Valentin Touzeau's avatar
WIP    
Valentin Touzeau committed
1
#include "MayDomain.h"
Valentin Touzeau's avatar
Valentin Touzeau committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

#include <exactlru/features.h>
#include <otawa/icat3/features.h>

using namespace otawa;

namespace exactlru
{

MayDomain::MayDomain(const icat3::LBlock* focus,
                     const icat3::LBlockCollection& coll,
                     int set,
                     const t* init) :
	m_focus(focus),
	m_bot(),
	m_top({Generator(focus, coll.A(), false)}),
	m_set(set),
	m_coll(coll),
	m_init(init ? *init : m_top),
	m_tmp()
{
}

void MayDomain::join(t& d, const t& s) {
	d.join(s);
}

void MayDomain::fetch(t& a, const icat3::LBlock *lb) {
	a.update(lb);
}

void MayDomain::update(const icache::Access& access, t& a) {
	switch(access.kind()) {

	case icache::FETCH:
		if(m_coll.cache()->set(access.address()) == m_set)
			fetch(a, icat3::LBLOCK(access));
		break;

	case icache::PREFETCH:
		if(m_coll.cache()->set(access.address()) == m_set) {
			copy(m_tmp, a);
			fetch(a, icat3::LBLOCK(access));
			join(a, m_tmp);
		}
		break;

	case icache::NONE:
		break;

	default:
		ASSERT(false);
	}
}

bool MayDomain::isAlwaysMiss(const t& a) const
{
	return a.isAlwaysMiss();
}

} // namespace exactlru