Commit b6d50cad authored by Maeva Ramarijaona's avatar Maeva Ramarijaona

Merge branch 'new_t_of_data' into 'dev'

New type of data

See merge request !2
parents 9b83345d 355be542
......@@ -3,20 +3,24 @@
#include <otawa/icache/features.h>
#include <otawa/icat3/features.h>
#include <otawa/base.h>
#include <set>
namespace lrusecurity
{
class ACSSecurity : public elm::AllocArray<otawa::Bag<otawa::Address>>
class ACSSecurity : public elm::AllocArray<std::set <otawa::Address>>
{
public:
ACSSecurity() = default;
ACSSecurity(int n) : elm::AllocArray<otawa::Bag<otawa::Address>>(n){
ACSSecurity(int n) : elm::AllocArray<std::set <otawa::Address>>(n){
for (int i = 0; i < n; i++)
(*this)[i] = otawa::Bag<otawa::Address>();
(*this)[i] = std::set <otawa::Address>();
}
ACSSecurity(int n, otawa::Address addr) : elm::AllocArray<otawa::Bag<otawa::Address>>(n) {
for (int i = 0; i < n; i++)
(*this)[i] = otawa::Bag<otawa::Address>(1, &addr);
ACSSecurity(int n, otawa::Address addr) : elm::AllocArray<std::set <otawa::Address>>(n) {
for (int i = 0; i < n; i++){
(*this)[i] = std::set <otawa::Address>();
(*this)[i].insert(addr);
}
}
void print(int set, const otawa::icat3::LBlockCollection& coll, elm::io::Output& out= elm::cout) const;
};
......
......@@ -21,7 +21,7 @@ public:
inline const t& init(void) const { return _init; }
inline void print(const t& a, otawa::io::Output& out) const { a.print(_set, _coll, out); }
inline elm::io::Printable<t, ExistHitPrevDomain> print(const t& a) const { return elm::io::p(a, *this); }
inline bool contains(const t& a, int i) { return(a[i] !=otawa::Bag< otawa::Address>()); }
inline bool contains(const t& a, int i) { return(!a[i].empty()); }
inline void copy(t& d, const t& s) { d.copy(s); }
bool equals(const t& a, const t& b) const;
void join(t& d, const t& s);
......
#include "ExistHitPrevDomain.h"
#include <set>
using namespace otawa;
......@@ -29,19 +30,11 @@ bool ExistHitPrevDomain::equals(const t& acss, const t& bcss) const
}
void ExistHitPrevDomain::join(t& dcss, const t& scss)
{
for (int i = 0; i < _n; i++){
int newsize = dcss[i].size()+scss[i].size();
Bag<Address> newbag = Bag<Address>(newsize);
for (int j = 0; j < newsize; j++) {
if (j < dcss[i].size())
newbag[j]=dcss[i][j];
else
newbag[j]=scss[i][j - dcss[i].size()];
}
dcss[i] = Bag<Address>(newbag);
for (int i = 0; i < _n; i++){
dcss[i].insert(scss[i].begin(), scss[i].end());
}
}
void ExistHitPrevDomain::fetch(t& acss, const icache::Access& access, lrumc::ACSManager& ehManager)
{
......@@ -49,10 +42,11 @@ bool ExistHitPrevDomain::equals(const t& acss, const t& bcss) const
int b = lb->index();
for (int i = 0; i < _n; i++){
if (i == b){
Address smol[] = {access.address()};
acss[i] = Bag<Address>(1,smol);}
else if (ehManager.existHitAge(lb) == _A)
acss[i] = Bag<Address>();
Address smol = access.address();
acss[i] = std::set<otawa::Address>();
acss[i].insert(smol);
} else if (ehManager.existHitAge(_coll[_set][i]) == _A)
acss[i] = std::set<otawa::Address>();
}
}
......
......@@ -21,7 +21,7 @@ public:
inline const t& init(void) const { return _init; }
inline void print(const t& a, otawa::io::Output& out) const { a.print(_set, _coll, out); }
inline elm::io::Printable<t, ExistHitPrevODomain> print(const t& a) const { return elm::io::p(a, *this); }
inline bool contains(const t& a, int i) { return(a[i] !=otawa::Bag< otawa::Address>()); }
inline bool contains(const t& a, int i) { return(!a[i].empty()); }
inline void copy(t& d, const t& s) { d.copy(s); }
bool equals(const t& a, const t& b) const;
void join(t& d, const t& s);
......
#include "ExistHitPrevODomain.h"
#include <set>
using namespace otawa;
......@@ -30,16 +31,8 @@ bool ExistHitPrevODomain::equals(const t& acss, const t& bcss) const
void ExistHitPrevODomain::join(t& dcss, const t& scss)
{
for (int i = 0; i < _n; i++){
int newsize = dcss[i].size()+scss[i].size();
Bag<Address> newbag = Bag<Address>(newsize);
for (int j = 0; j < newsize; j++) {
if (j < dcss[i].size())
newbag[j]=dcss[i][j];
else
newbag[j]=scss[i][j - dcss[i].size()];
}
dcss[i] = Bag<Address>(newbag);
for (int i = 0; i < _n; i++) {
dcss[i].insert(scss[i].begin(), scss[i].end());
}
}
......@@ -49,10 +42,11 @@ void ExistHitPrevODomain::fetch(t& acss, const icache::Access& access, lrupreana
int b = lb->index();
for (int i = 0; i < _n; i++){
if (i == b){
Address smol[] = {access.address()};
acss[i] = Bag<Address>(1, smol);
Address smol = access.address();
acss[i] = std::set<otawa::Address>();
acss[i].insert(smol);
} else if (mayManager.mayAge(_coll[_set][i]) == _A)
acss[i] = Bag<Address>();
acss[i] = std::set<otawa::Address>();
}
}
......
......@@ -23,7 +23,7 @@ public:
inline void print(const t& a, otawa::io::Output& out) const { a.print(_set, _coll, out); }
inline elm::io::Printable<t, ExistHitPrevUDomain> print(const t& a) const { return elm::io::p(a, *this); }
inline bool contains(const t& a, int i) { return(a[i] !=otawa::Bag< otawa::Address>()); }
inline bool contains(const t& a, int i) { return(!a[i].empty()); }
inline void copy(t& d, const t& s) { d.copy(s); }
bool equals(const t& a, const t& b) const;
void join(t& d, const t& s, otawa::icat3::ACS d_eh, otawa::icat3::ACS s_eh);
......
#include "ExistHitPrevUDomain.h"
#include <set>
using namespace otawa;
......@@ -34,15 +35,7 @@ void ExistHitPrevUDomain::join(t& dcss, const t& scss, icat3::ACS d_eh, icat3::A
if (s_eh[i] < d_eh[i] || (d_eh[i] == -1 && s_eh[i] != -1)) {
dcss[i] = scss[i];
} else if (s_eh[i] == d_eh[i]) {
int fullsize = (dcss[i]).size() + (scss[i]).size();
Bag <Address> tmp = Bag <Address> (fullsize);
for (int j = 0; j < fullsize; j++) {
if (j < (dcss[i]).size())
tmp[j] = dcss[i][j];
else
tmp[j] = scss[i][j - dcss[i].size()];
}
dcss[i] = tmp;
dcss[i].insert(scss[i].begin(), scss[i].end());
}
}
}
......@@ -53,10 +46,11 @@ void ExistHitPrevUDomain::fetch(t& acss, const icache::Access& access, lrupreana
int b = lb->index();
for (int i = 0; i < _n; i++){
if (i == b){
Address smol[] = {access.address()};
acss[i] = Bag<Address>(1, smol);
Address smol = access.address();
acss[i] = std::set<otawa::Address>();
acss[i].insert(smol);
} else if (ehManager.existHitAge(_coll[_set][i]) == _A)
acss[i] = Bag<Address>();
acss[i] = std::set<otawa::Address>();
}
}
......
......@@ -6,6 +6,8 @@
#include <otawa/proc/BBProcessor.h>
#include <otawa/prog/Process.h>
#include <lruexact/features.h>
#include <set>
#include<iterator>
//#include "SecCFGOutput.h"
using namespace otawa;
......@@ -111,8 +113,11 @@ protected:
ACSSecurity prev = (*EXIST_HIT_PREV_IN(bb))[set];
int index = otawa::icat3::LBLOCK(access)->index();
number = prev[index].size();
for (int i = 0; i < number; i++)
_out << prev[index][i] << "\n\t\t\t\t\b";
std::set<otawa::Address>::iterator iter;
for (iter = prev[index].begin(); iter != prev[index].end(); iter++){
_out << *iter << "\n\t\t\t\t\b";
}
// REMONTEE
_out << "\033[" << number << "A";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment