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/

Commit bd2fad60 authored by Valentin Touzeau's avatar Valentin Touzeau Committed by EXT Valentin Touzeau
Browse files

WIP

parent dc1af59f
......@@ -6,12 +6,16 @@ set(NAMESPACE "") # namespace
set(SOURCES "src/exactlru.cpp"
"src/Generator.cpp"
"src/MayAnalysis/MayDomain.cpp"
"src/MayAnalysis/MayGeneratorsAntichain.cpp"
"src/MayAnalysis/MayGeneratorsSet.cpp"
"src/MayAnalysis/MayAnalysis.cpp"
"src/MustAnalysis/MustDomain.cpp"
"src/MustAnalysis/MustGeneratorsAntichain.cpp"
"src/MustAnalysis/MustGeneratorsSet.cpp"
"src/MustAnalysis/MustAnalysis.cpp"
"src/ClassificationBuilder.cpp"
"src/ZDD/ZDD.cpp"
"src/ZDD/ZDDManager.cpp"
"src/ZDD/ZDDMustDomain.cpp"
"src/ZDD/ZDDMayDomain.cpp"
)
add_subdirectory(ddlib)
......@@ -37,7 +41,7 @@ include_directories("${CMAKE_SOURCE_DIR}" "include")
add_library(${PLUGIN} SHARED ${SOURCES})
set_property(TARGET ${PLUGIN} PROPERTY PREFIX "")
set_property(TARGET ${PLUGIN} PROPERTY COMPILE_FLAGS "${OTAWA_CFLAGS} --std=c++11 -g -Wall -Wextra -pedantic")
target_link_libraries(${PLUGIN} PRIVATE cudd epd extra)
target_link_libraries(${PLUGIN} PUBLIC "${OTAWA_LDFLAGS}" cudd_core cudd_epd cudd_st cudd_util extra)
# installation
set(PLUGIN_PATH "${OTAWA_PREFIX}/lib/otawa/${NAMESPACE}")
......
......@@ -13,38 +13,61 @@ execute_process(
COMMAND patch -p0 -i ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1.patch
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process(
COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/
)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/extra/)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_CURRENT_SOURCE_DIR}/extra20a.tar.gz
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
execute_process(
COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/
COMMAND patch -p0 -i ${CMAKE_CURRENT_SOURCE_DIR}/extra20.patch
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# CUDD
set(CUDD_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/cudd/libcudd.a)
set(EPD_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/epd/libepd.a)
set(ST_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/st/libst.a)
set(UTIL_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/util/libutil.a)
add_library(cudd STATIC IMPORTED GLOBAL)
add_library(epd STATIC IMPORTED GLOBAL)
add_library(cudd_core STATIC IMPORTED GLOBAL)
add_library(cudd_epd STATIC IMPORTED GLOBAL)
add_library(cudd_st STATIC IMPORTED GLOBAL)
add_library(cudd_util STATIC IMPORTED GLOBAL)
set_target_properties(cudd
set_target_properties(cudd_core
PROPERTIES
IMPORTED_LOCATION ${CUDD_LIB_FILE}
INTERFACE_INCLUDE_DIRECTORIES ${HEADERS_FOLDER}
)
set_target_properties(epd
set_target_properties(cudd_epd
PROPERTIES
IMPORTED_LOCATION ${EPD_LIB_FILE}
INTERFACE_INCLUDE_DIRECTORIES ${HEADERS_FOLDER}
)
set_target_properties(cudd_st
PROPERTIES
IMPORTED_LOCATION ${ST_LIB_FILE}
INTERFACE_INCLUDE_DIRECTORIES ${HEADERS_FOLDER}
)
set_target_properties(cudd_util
PROPERTIES
IMPORTED_LOCATION ${UTIL_LIB_FILE}
INTERFACE_INCLUDE_DIRECTORIES ${HEADERS_FOLDER}
)
# EXTRA
set(EXTRA_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/cudd/libextra.a)
set(EXTRA_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cudd-2.3.1/extra/libextra.a)
add_custom_command(
OUTPUT ${EXTRA_LIB_FILE}
......@@ -53,34 +76,13 @@ add_custom_command(
)
add_custom_target(extra_target DEPENDS ${EXTRA_LIB_FILE})
add_dependencies(extra_target cudd_core)
add_library(extra STATIC IMPORTED GLOBAL)
add_dependencies(extra extra_target cudd)
add_dependencies(extra extra_target)
set_target_properties(extra
PROPERTIES
IMPORTED_LOCATION ${EXTRA_LIB_FILE}
INTERFACE_INCLUDE_DIRECTORIES ${HEADERS_FOLDER}
)
# EXTRA
#
#set(EXTRA_LIB_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extra20/libextra.a)
#set(EXTRA_HEADER_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/extra20/)
#
#add_custom_command(
# OUTPUT ${EXTRA_LIB_FILE}
# COMMAND make
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/extra20/
#)
#
#add_custom_target(extra_target DEPENDS ${EXTRA_LIB_FILE})
#
#add_library(extra STATIC IMPORTED GLOBAL)
#add_dependencies(extra extra_target)
#
#set_target_properties(extra
# PROPERTIES
# IMPORTED_LOCATION ${EXTRA_LIB_FILE}
# INTERFACE_INCLUDE_DIRECTORIES ${EXTRA_HEADER_FOLDER}
#)
diff -r -c cudd-2.3.1/Makefile cudd-2.3.1/Makefile
*** cudd-2.3.1/Makefile 2001-05-18 02:54:26.000000000 +0200
--- cudd-2.3.1/Makefile 2018-05-04 10:43:28.432815172 +0200
--- cudd-2.3.1/Makefile 2018-05-24 15:35:42.034516245 +0200
***************
*** 42,48 ****
#ICFLAGS =
......@@ -37,9 +37,26 @@ diff -r -c cudd-2.3.1/Makefile cudd-2.3.1/Makefile
#
#==========================
# Solaris
diff -r -c cudd-2.3.1/util/pipefork.c cudd-2.3.1/util/pipefork.c
*** cudd-2.3.1/util/pipefork.c 2001-03-19 11:59:06.000000000 +0100
--- cudd-2.3.1/util/pipefork.c 2018-05-24 15:38:43.370514254 +0200
***************
*** 40,50 ****
int forkpid, waitPid;
int topipe[2], frompipe[2];
char buffer[1024];
- #if (defined __hpux) || (defined __osf__) || (defined _IBMR2) || (defined __SVR4) || (defined __CYGWIN32__)
int status;
- #else
- union wait status;
- #endif
/* create the PIPES...
* fildes[0] for reading from command
--- 40,46 ----
diff -r -c cudd-2.3.1/util/util.h cudd-2.3.1/util/util.h
*** cudd-2.3.1/util/util.h 2001-02-14 19:08:51.000000000 +0100
--- cudd-2.3.1/util/util.h 2018-05-04 10:44:06.636813263 +0200
--- cudd-2.3.1/util/util.h 2018-05-24 15:35:42.018516245 +0200
***************
*** 138,144 ****
/* most machines don't give us a header file for these */
......
......@@ -22,14 +22,14 @@
#ifndef MAY_DOMAIN_H_
#define MAY_DOMAIN_H_
#include <exactlru/MayAnalysis/MayGeneratorsAntichain.h>
#include <exactlru/MayAnalysis/MayGeneratorsSet.h>
namespace exactlru
{
class MayDomain {
public:
using t = MayGeneratorsAntichain;
using t = MayGeneratorsSet;
MayDomain(const otawa::icat3::LBlock* focus,
const otawa::icat3::LBlockCollection& coll,
......
#ifndef MAY_GENERATORS_ANTICHAIN_H
#define MAY_GENERATORS_ANTICHAIN_H
#ifndef MAY_GENERATORS_SET_H
#define MAY_GENERATORS_SET_H
#include <set>
......@@ -17,25 +17,25 @@ public:
}
};
class MayGeneratorsAntichain
class MayGeneratorsSet
{
public:
using Block = Generator::Block;
using GeneratorsSet = std::set<Generator, LexicalOrder>;
using PartialOrder = MayComparator;
MayGeneratorsAntichain(const GeneratorsSet& g = {});
MayGeneratorsSet(const GeneratorsSet& g = {});
void update(const Block* block);
void join(const MayGeneratorsAntichain& rhs);
void join(const MayGeneratorsSet& rhs);
bool isAlwaysMiss() const;
inline bool operator==(const MayGeneratorsAntichain& rhs) const
inline bool operator==(const MayGeneratorsSet& rhs) const
{
return _generators == rhs._generators;
}
inline bool operator!=(const MayGeneratorsAntichain& rhs) const
inline bool operator!=(const MayGeneratorsSet& rhs) const
{
return !(*this == rhs);
}
......@@ -65,4 +65,4 @@ private:
} // namespace exactlru
#endif // MAY_GENERATORS_ANTICHAIN_H
#endif // MAY_GENERATORS_SET_H
......@@ -6,13 +6,16 @@
namespace exactlru
{
template<typename MayDomain>
class MayManager
{
public:
using Value = typename MayDomain::t;
MayManager(MayDomain& domain,
const MayDomain::t& value) :
m_domain(domain),
m_current(value)
const Value& value) :
m_domain(domain),
m_current(value)
{
}
......@@ -21,12 +24,12 @@ public:
m_domain.update(acc, m_current);
}
inline void restart(const MayDomain::t& value)
inline void restart(const Value& value)
{
m_domain.copy(m_current, value);
}
inline MayDomain::t current() const
inline Value current() const
{
return m_current;
}
......@@ -37,7 +40,7 @@ public:
}
private:
MayDomain& m_domain;
MayDomain::t m_current;
Value m_current;
};
} // namespace exactlru
......
#ifndef EXACTLRU_MAY_MUST_TAG_H
#define EXACTLRU_MAY_MUST_TAG_H
struct MayTag {};
struct MustTag {};
#endif // EXACTLRU_MAY_MUST_TAG_H
#ifndef MUST_ABSTRACT_VALUE_H
#define MUST_ABSTRACT_VALUE_H
#include <exactlru/MayAnalysis/MayGeneratorsAntichain.h>
#include <exactlru/MustAnalysis/MustGeneratorsAntichain.h>
namespace exactlru
{
using MustAbstractValue = MayGeneratorsAntichain;
using MustAbstractValue = MustGeneratorsAntichain;
} // namespace exactlru
......
......@@ -22,14 +22,14 @@
#ifndef MUST_DOMAIN_H_
#define MUST_DOMAIN_H_
#include <exactlru/MustAnalysis/MustGeneratorsAntichain.h>
#include <exactlru/MustAnalysis/MustGeneratorsSet.h>
namespace exactlru
{
class MustDomain {
public:
using t = MustGeneratorsAntichain;
using t = MustGeneratorsSet;
MustDomain(const otawa::icat3::LBlock* focus,
const otawa::icat3::LBlockCollection& coll,
......
#ifndef MUST_GENERATORS_ANTICHAIN_H
#define MUST_GENERATORS_ANTICHAIN_H
#ifndef MUST_GENERATORS_SET_H
#define MUST_GENERATORS_SET_H
#include <set>
......@@ -17,25 +17,25 @@ public:
}
};
class MustGeneratorsAntichain
class MustGeneratorsSet
{
public:
using Block = Generator::Block;
using GeneratorsSet = std::set<Generator, LexicalOrder>;
using PartialOrder = MustComparator;
MustGeneratorsAntichain(const GeneratorsSet& g = {});
MustGeneratorsSet(const GeneratorsSet& g = {});
void update(const Block* block);
void join(const MustGeneratorsAntichain& rhs);
void join(const MustGeneratorsSet& rhs);
bool isAlwaysHit() const;
inline bool operator==(const MustGeneratorsAntichain& rhs) const
inline bool operator==(const MustGeneratorsSet& rhs) const
{
return _generators == rhs._generators;
}
inline bool operator!=(const MustGeneratorsAntichain& rhs) const
inline bool operator!=(const MustGeneratorsSet& rhs) const
{
return !(*this == rhs);
}
......@@ -65,4 +65,4 @@ private:
} // namespace exactlru
#endif // MUST_GENERATORS_ANTICHAIN_H
#endif // MUST_GENERATORS_SET_H
#ifndef MUST_GENERATORS_ZDD_H
#define MUST_GENERATORS_ZDD_H
#include <set>
namespace exactlru
{
class MustGeneratorsZDD
{
public:
using Block = Generator::Block;
MustGeneratorsZDD();
void update(const Block* block);
void join(const MustGeneratorsZDD& rhs);
bool isAlwaysHit() const;
inline bool operator==(const MustGeneratorsZDD& rhs) const
{
return _generators == rhs._generators;
}
inline bool operator!=(const MustGeneratorsZDD& rhs) const
{
return !(*this == rhs);
}
private:
ZDDNode _generators;
};
} // namespace exactlru
#endif // MUST_GENERATORS_ZDD_H
#ifndef MUST_MANAGER_H
#define MUST_MANAGER_H
#include <exactlru/MustAnalysis/MustDomain.h>
namespace exactlru
{
template<typename MustDomain>
class MustManager
{
public:
using Value = typename MustDomain::t;
MustManager(MustDomain& domain,
const MustDomain::t& value) :
m_domain(domain),
m_current(value)
const Value& value) :
m_domain(domain),
m_current(value)
{
}
......@@ -21,12 +22,12 @@ public:
m_domain.update(acc, m_current);
}
inline void restart(const MustDomain::t& value)
inline void restart(const Value& value)
{
m_domain.copy(m_current, value);
}
inline MustDomain::t current() const
inline Value current() const
{
return m_current;
}
......@@ -37,7 +38,7 @@ public:
}
private:
MustDomain& m_domain;
MustDomain::t m_current;
Value m_current;
};
} // namespace exactlru
......
......@@ -30,11 +30,12 @@
#include <otawa/hard/Cache.h>
#include <otawa/icache/features.h>
#include <otawa/icat3/features.h>
#include <otawa/proc/Feature.h>
//#include <exactlru/CacheState.h>
//#include <exactlru/ExactMust/ExactMustAbstractValue.h>
#include <exactlru/MayAnalysis/MayAbstractValue.h>
//#include <exactlru/MayAnalysis/MayAbstractValue.h>
namespace exactlru
{
......
......@@ -6,8 +6,6 @@
#include <otawalru/features.h>
#include "testextra.h"
using namespace otawa;
namespace exactlru
......
......@@ -32,6 +32,8 @@
#include <exactlru/MayAnalysis/MayDomain.h>
#include <exactlru/MayAnalysis/MayManager.h>
#include "../ZDD/ZDDMayDomain.h"
using namespace otawa;
namespace exactlru
......@@ -40,6 +42,7 @@ namespace exactlru
class MayAdapter
{
public:
//typedef ZDDMayDomain domain_t;
typedef MayDomain domain_t;
typedef typename domain_t::t t;
typedef CompositeCFG graph_t;
......@@ -102,6 +105,9 @@ private:
class MayAnalysis : public Processor
{
public:
//using domain_t = ZDDMayDomain;
using domain_t = MayDomain;
static p::declare reg;
MayAnalysis(p::declare& r = reg) :
Processor(r),
......@@ -161,9 +167,12 @@ private:
classifyBlock(lb, ada.domain(), b, ada.store().get(b));
}
void classifyBlock(const icat3::LBlock* focus, MayAdapter::domain_t& d, Block* b, const MayAdapter::t& v)
void classifyBlock(const icat3::LBlock* focus,
MayAdapter::domain_t& d,
Block* b,
const MayAdapter::t& v)
{
MayManager man(d, v);
MayManager<domain_t> man(d, v);
Bag<icache::Access>& bAccs = icache::ACCESSES(b).ref();
MayAdapter::t save = classifyAccesses(b, focus, man, bAccs);
......@@ -174,7 +183,10 @@ private:
}
}
MayAdapter::t classifyAccesses(const Block* b, const icat3::LBlock* focus, MayManager& man, Bag<icache::Access>& accs)
MayAdapter::t classifyAccesses(const Block* b,
const icat3::LBlock* focus,
MayManager<domain_t>& man,
Bag<icache::Access>& accs)
{
for(int i = 0; i < accs.size(); ++i) {
icat3::LBlock* lb = icat3::LBLOCK(accs[i]);
......
#include <exactlru/MayAnalysis/MayGeneratorsAntichain.h>
#include <exactlru/MayAnalysis/MayGeneratorsSet.h>
namespace exactlru
{
MayGeneratorsAntichain::MayGeneratorsAntichain(const GeneratorsSet& g) :
MayGeneratorsSet::MayGeneratorsSet(const GeneratorsSet& g) :
_generators(g)
{
}
void MayGeneratorsAntichain::update(const Block* block)
void MayGeneratorsSet::update(const Block* block)
{
GeneratorsSet old(_generators);
_generators.clear();
......@@ -19,14 +19,14 @@ void MayGeneratorsAntichain::update(const Block* block)
}
}
void MayGeneratorsAntichain::join(const MayGeneratorsAntichain& rhs)
void MayGeneratorsSet::join(const MayGeneratorsSet& rhs)
{
for(const auto& g : rhs._generators) {
insert(g);
}
}
bool MayGeneratorsAntichain::isAlwaysMiss() const
bool MayGeneratorsSet::isAlwaysMiss() const
{
for(const auto& g : _generators) {
if(!g.isFocusedBlockEvicted())
......
......@@ -30,6 +30,8 @@
#include <exactlru/MustAnalysis/MustDomain.h>
#include <exactlru/MustAnalysis/MustManager.h>
#include "../ZDD/ZDDMustDomain.h"
using namespace otawa;
namespace exactlru
......@@ -38,7 +40,8 @@ namespace exactlru
class MustAdapter
{
public:
typedef MustDomain domain_t;
typedef ZDDMustDomain domain_t;
//typedef MustDomain domain_t;
typedef typename domain_t::t t;
typedef CompositeCFG graph_t;
typedef ai::ArrayStore<domain_t, graph_t> store_t;
......@@ -100,6 +103,9 @@ private:
class MustAnalysis : public Processor
{
public:
using domain_t = ZDDMustDomain;
//using domain_t = MustDomain;
static p::declare reg;
MustAnalysis(p::declare& r = reg) :
Processor(r),
......@@ -159,9 +165,12 @@ private:
classifyBlock(lb, ada.domain(), b, ada.store().get(b));
}
void classifyBlock(const icat3::LBlock* focus, MustAdapter::domain_t& d, Block* b, const MustAdapter::t& v)
void classifyBlock(const icat3::LBlock* focus,
MustAdapter::domain_t& d,
Block* b,
const MustAdapter::t& v)
{
MustManager man(d, v);
MustManager<domain_t> man(d, v);
Bag<icache::Access>& bAccs = icache::ACCESSES(b).ref();
MustAdapter::t save = classifyAccesses(b, focus, man, bAccs);
......@@ -172,13 +181,17 @@ private:
}
}
MustAdapter::t classifyAccesses(const Block* b, const icat3::LBlock* focus, MustManager& man, Bag<icache::Access>& accs)
MustAdapter::t classifyAccesses(const Block* b,
const icat3::LBlock* focus,
MustManager<domain_t>& man,
Bag<icache::Access>& accs)
{
for(int i = 0; i < accs.size(); ++i) {
icat3::LBlock* lb = icat3::LBLOCK(accs[i]);