Skip to content
Snippets Groups Projects
Commit b93c2831 authored by Bouquillon Fabien's avatar Bouquillon Fabien
Browse files

clean old plugins

parent ae633a35
No related branches found
No related tags found
No related merge requests found
#cflags pour tout compiler
CXXFLAGS=`otawa-config otawa/display --cflags`
#ldlibs pour compiler le plugin
LDLIBS=`otawa-config otawa/display --libs`
#ldlibs pour compiler la application
LDLIBS2=`otawa-config otawa/display otawa/ucb_lt --libs`
ARMCC=arm-none-eabi-gcc
CXXFLAGS += -std=c++11 -O0 -g -I ../otawa-core2-build/otawa/include/ -I ../otawa-core2-build/elm/include/
all: clean ucb_lt.so install application binaire
binaire: binaire.c
$(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
##debut
application: application.o
$(CXX) -o application application.o $(LDLIBS2)
application.o: application.cpp
ucb_lt.so: ucb_lt.cpp include/ucb_lt.h
$(CXX) -fPIC -shared $(CXXFLAGS) -o ucb_lt.so ucb_lt.cpp $(LDLIBS)
##fin
clean:
rm -f *.o application binaire *~ *.dot *.ps *.so
install: ucb_lt.so
mkdir -p $(HOME)/.otawa/proc/otawa
cp ucb_lt.eld $(HOME)/.otawa/proc/otawa/
cp ucb_lt.so $(HOME)/.otawa/proc/otawa/
.PHONY: all test clean graph
#include <otawa/app/Application.h>
#include <otawa/cfg/features.h>
#include <otawa/script/Script.h>
#include <otawa/prog/WorkSpace.h>
#include <otawa/proc/DynProcessor.h>
#include <otawa/cfg/Dominance.h>
#include <otawa/proc/DynFeature.h>
//includes pour l'affichage du CFG
#include <otawa/display/CFGOutput.h>
#include <elm/io/OutFileStream.h>
#include "include/ucb_lt.h"
using namespace otawa; //comme import
using namespace otawa::ucb_lt;
int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr, "usage: %s <binary> ", argv[0]);
exit(1);
}
WorkSpace *ws = NULL;
PropList conf;
Manager manager;
NO_SYSTEM(conf) = true;
TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true;
CACHE_CONFIG_PATH(conf) = "./cache.xml";
StringBuffer buf;
buf << argv[1] << "-decomp.c";
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
ws = manager.load(argv[1], conf);
ws->require(DynFeature("otawa::ucb_lt::UCB_LT_FEATURE"), conf);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<cache-config>
<icache>
<block_bits>8</block_bits>
<way_bits>4</way_bits>
<row_bits>6</row_bits>
<miss_penalty>70</miss_penalty>
</icache>
</cache-config>
\ No newline at end of file
#ifndef UCB_LT_H
#define UCB_LT_H
#include <typeinfo>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <functional>
#include <otawa/cfg.h>
#include <otawa/cfg/features.h>
#include <otawa/proc/ProcessorPlugin.h>
#include <otawa/cfg/Dominance.h>
#include <otawa/otawa.h>
namespace otawa { namespace ucb_lt {
class Ucb_ltProcessor : public Processor {
public:
static p::declare reg;
explicit Ucb_ltProcessor(p::declare &r = reg);
protected:
void processWorkSpace(WorkSpace * /*ws*/) override;
void configure(const PropList &props) override;
};
// declaration feature
extern p::feature UCB_LT_FEATURE;
//declaration propriete
extern Identifier<Mathset::Multiset<int>*> UCBS_LT;
} }
#endif
#include "include/ucb_lt.h"
#include <multiset.hpp>
#include <otawa/hard/CacheConfiguration.h>
#include <otawa/cache/features.h>
#include <otawa/cfg/CFG.h>
#include <otawa/cache/features.h>
#include <otawa/cache/cat2/CAT2Builder.h>
#include <otawa/cache/LBlockBuilder.h>
#include <otawa/ipet/features.h>
#include <otawa/ipet/FlowFactLoader.h>
#include <otawa/flowfact/features.h>
using namespace Mathset;
namespace otawa {
namespace ucb_lt {
// Declaration du plugin
class Plugin : public ProcessorPlugin {
public:
Plugin() : ProcessorPlugin("otawa::ucb_lt", Version(1, 0, 0), OTAWA_PROC_VERSION) {}
};
otawa::ucb_lt::Plugin ucb_lt_plugin;
ELM_PLUGIN(ucb_lt_plugin, OTAWA_PROC_HOOK);
p::declare Ucb_ltProcessor::reg = p::init("otawa::ucb_lt::Ucb_ltProcessor", Version(1, 0, 0))
.require(COLLECTED_CFG_FEATURE)
.require(LOOP_INFO_FEATURE)
.provide(UCB_LT_FEATURE);
// definition feature
p::feature UCB_LT_FEATURE("otawa::ucb_lt::UCB_LT_FEATURE", new Maker<Ucb_ltProcessor>());
Ucb_ltProcessor::Ucb_ltProcessor(p::declare &r) : Processor(r) {}
void Ucb_ltProcessor::configure(const PropList &props) {
Processor::configure(props);
}
int pred_category(LBlock *lb) {
bool start = false;
bool end = false;
BasicBlock bb = lb->bb();
AllocArray<LBlock*> *lblock_array = BB_LBLOCKS(bb);
if(lblock_array[lblock_array->count() - 1] == lb) {
end == true;
}
if(lblock_array[0] == lb) {
start == true;
}
if(start && end) {
return 0;
}
if(start && !end) {
return 1;
}
if(!start && !end) {
return 2;
}
else {
return 3;
}
}
void Ucb_ltProcessor::processWorkSpace(WorkSpace *ws) {
Multiset<int> *ucb_set = new Multiset<int>;
const CFGCollection *coll = INVOLVED_CFGS(ws);
for(CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
for(CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++) {
if(block_iter->isBasic()) {
BasicBlock *bb = block_iter->toBasic();
AllocArray<LBlock*> *lblock_array = BB_LBLOCKS(bb);
for(int i = 0; i < lblock_array->count(); i++) {
LBlock *lb = (*lblock_array)[i];
cache::category_t status = cache::CATEGORY(lb);
struct Element<int> tmp_e;
tmp_e.counter = 1;
const hard::Cache *cache = lb->lblockset()->cache();
//tmp_e.elem = cache->line(lb->address());
tmp_e.elem = lb->lblockset()->line();
//std::cout << tmp_e.elem << std::endl;
// deprecated !!!
//tmp_e.elem = (int)(lb->cacheblock());
switch(status) {
case ALWAYS_HIT:
ucb_set->add_elem_struct(tmp_e);
break;
case FIRST_MISS:
ucb_set->add_elem_struct(tmp_e);
break;
case FIRST_HIT:
ucb_set->add_elem_struct(tmp_e);
break;
default:
int tmp_inst = lb->countInsts();
std::cout << "nb isntruction: " << tmp_inst << std::endl;
if(tmp_inst != 1) {
ucb_set->add_elem_struct(tmp_e);
} else {
std::cout << "coucou:" << tmp_e.elem << std::endl;
}
break;
}
}
}
}
}
ucb_set->to_set();
UCBS_LT(ws) = ucb_set;
}
// definition propriete
Identifier<Mathset::Multiset<int>*> UCBS_LT("otawa::classic_ucb::UCBS");
}
}
[elm-plugin]
name = ucb_lt
author = Fabien Bouquillon <fabien.bouquillon@univ-lille.fr>
description = plugin vide
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment