Commit 701cfa6d authored by Julien Balette-Pape's avatar Julien Balette-Pape

passage aux unordered set

parent 76d900ba
......@@ -3,27 +3,22 @@
#include <otawa/icache/features.h>
#include <otawa/icat3/features.h>
#include <otawa/base.h>
#include <set>
#include <unordered_set>
namespace lrusecurity
{
struct Ptr_addr_comparator
{
bool operator()(const otawa::Address* a, const otawa::Address* b ) const {return *a < *b;}
};
class ACSSecurity : public elm::AllocArray<std::set <otawa::Address *, Ptr_addr_comparator>>
class ACSSecurity : public elm::AllocArray<std::unordered_set <otawa::Address *>>
{
public:
ACSSecurity() = default;
ACSSecurity(int n) : elm::AllocArray<std::set <otawa::Address *, Ptr_addr_comparator>>(n){
ACSSecurity(int n) : elm::AllocArray<std::unordered_set <otawa::Address *>>(n){
for (int i = 0; i < n; i++)
(*this)[i] = std::set <otawa::Address *, Ptr_addr_comparator>();
(*this)[i] = std::unordered_set <otawa::Address *>();
}
ACSSecurity(int n, otawa::Address addr) : elm::AllocArray<std::set <otawa::Address *, Ptr_addr_comparator>>(n) {
ACSSecurity(int n, otawa::Address addr) : elm::AllocArray<std::unordered_set <otawa::Address *>>(n) {
for (int i = 0; i < n; i++){
(*this)[i] = std::set <otawa::Address *, Ptr_addr_comparator>();
(*this)[i] = std::unordered_set <otawa::Address *>();
(*this)[i].insert({&addr});
}
}
......
......@@ -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].empty()); }
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);
......
......@@ -42,10 +42,10 @@ bool ExistHitPrevDomain::equals(const t& acss, const t& bcss) const
for (int i = 0; i < _n; i++){
if (i == b){
Address smol[] = {access.address()};
acss[i] = std::set<otawa::Address *, Ptr_addr_comparator>();
acss[i] = std::unordered_set<otawa::Address *>();
acss[i].insert(smol);
} else if (ehManager.existHitAge(_coll[_set][i]) == _A)
acss[i] = std::set<otawa::Address *, Ptr_addr_comparator>();
acss[i] = std::unordered_set<otawa::Address *>();
}
}
......
#include "ExistHitPrevODomain.h"
#include <unordered_set>
using namespace otawa;
......@@ -50,9 +51,16 @@ void ExistHitPrevODomain::fetch(t& acss, const icache::Access& access, lrupreana
for (int i = 0; i < _n; i++){
if (i == b){
Address smol[] = {access.address()};
<<<<<<< HEAD
acss[i] = Bag<Address>(1, smol);
} else if (mayManager.mayAge(_coll[_set][i]) == _A)
acss[i] = Bag<Address>();
=======
acss[i] = std::unordered_set<otawa::Address *>();
acss[i].insert(smol);
} else if (mayManager.mayAge(_coll[_set][i]) == _A)
acss[i] = std::unordered_set<otawa::Address *>();
>>>>>>> passage aux unordered set
}
}
......
#include "ExistHitPrevUDomain.h"
#include <unordered_set>
using namespace otawa;
......@@ -46,10 +47,10 @@ void ExistHitPrevUDomain::fetch(t& acss, const icache::Access& access, lrupreana
for (int i = 0; i < _n; i++){
if (i == b){
Address smol[] = {access.address()};
acss[i] = std::set<otawa::Address *, Ptr_addr_comparator>();
acss[i] = std::unordered_set<otawa::Address *>();
acss[i].insert(smol);
} else if (ehManager.existHitAge(_coll[_set][i]) == _A)
acss[i] = std::set<otawa::Address *, Ptr_addr_comparator>();
acss[i] = std::unordered_set<otawa::Address *>();
}
}
......
......@@ -6,7 +6,7 @@
#include <otawa/proc/BBProcessor.h>
#include <otawa/prog/Process.h>
#include <lruexact/features.h>
#include <set>
#include <unordered_set>
#include<iterator>
//#include "SecCFGOutput.h"
using namespace otawa;
......@@ -113,12 +113,10 @@ protected:
ACSSecurity prev = (*EXIST_HIT_PREV_IN(bb))[set];
int index = otawa::icat3::LBLOCK(access)->index();
number = prev[index].size();
std::set<otawa::Address *, Ptr_addr_comparator>::iterator iter;
int debug = 0; //FIXME
std::unordered_set<otawa::Address *>::iterator iter;
for (iter = prev[index].begin(); iter != prev[index].end(); iter++){
_out << *(*iter) << "\n\t\t\t\t\b";
debug++;
_out << debug;
_out << (**iter) << "\n\t\t\t\t\b";
}
// REMONTEE
......
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