Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

lrusecurity_ExistHitPrevUAdapter.cpp 1.54 KB
Newer Older
1
2

#include "ExistHitPrevUAdapter.h"
3

Valentin Touzeau's avatar
Valentin Touzeau committed
4
5
#include <lrupreanalysis/ExistHitDomain.h>

6
7
8
9
using namespace otawa;

namespace lrusecurity
{
10
ExistHitPrevUAdapter::ExistHitPrevUAdapter(
11
12
13
14
15
		int set,
		const t* init,
		const icat3::LBlockCollection& coll,
		const CFGCollection& cfgs,
		otawa::WorkSpace* ws) :
16
  _set(set),
Valentin Touzeau's avatar
Valentin Touzeau committed
17
	_ehManager(ws),
18
19
20
21
22
23
	_domain(coll, set, init),
	_graph(cfgs),
	_store(_domain, _graph)
{
}

24
void ExistHitPrevUAdapter::update(const Bag<icache::Access>& accs, t& d)
25
{
26
	for(int i = 0; i < accs.count(); i++) {
Valentin Touzeau's avatar
Valentin Touzeau committed
27
28
		_domain.update(accs[i], d, _ehManager);
		_ehManager.update(accs[i]);
29
30
31
	}
}

32
33

void ExistHitPrevUAdapter::update(Block *v, t& d)
34
35
{
	_domain.copy(d, _domain.bot());
Valentin Touzeau's avatar
Valentin Touzeau committed
36
	lrupreanalysis::eh_em::ExistHitDomain::t d_eh;
37

38
39
	t s;

40
	bool first = true;
41
42
43
44
45
	// update and join along edges
	for(auto e = _graph.preds(v); e; e++) {
		Block *w = e->source();
		_domain.copy(s, _store.get(w));

Valentin Touzeau's avatar
Valentin Touzeau committed
46
		_ehManager.start(w);
47
48
		if(first) {
		  first = false;
Valentin Touzeau's avatar
Valentin Touzeau committed
49
		  _ehManager.ehDomain(_set).copy(d_eh, _ehManager.ehDomain(_set).bot());
50
51
		}
	        
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
		// apply block
		{
			const Bag<icache::Access>& accs = icache::ACCESSES(w);
			if(accs.count() > 0)
				update(accs, s);
		}

		// apply edge
		{
			const Bag<icache::Access>& accs = icache::ACCESSES(e);
			if(accs.count() > 0)
				update(accs, s);
		}


		// merge result
Valentin Touzeau's avatar
Valentin Touzeau committed
68
		lrupreanalysis::eh_em::ExistHitDomain::t* tmp = _ehManager.ehValue(_set);
69
		ASSERT(tmp && "tmp null");
Valentin Touzeau's avatar
Valentin Touzeau committed
70
		lrupreanalysis::eh_em::ExistHitDomain::t& s_eh = *tmp;
71
		_domain.join(d, s, d_eh, s_eh);
Valentin Touzeau's avatar
Valentin Touzeau committed
72
		_ehManager.ehDomain(_set).join(d_eh, s_eh);
73
74
75
76
	}
}

} // namespace lrusecurity