Otawa  0.10
EdgeTimeBuilder.h
Go to the documentation of this file.
1 /*
2  * EdgeTimeBuilder class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2014, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef OTAWA_ETIME_EDGETIMEBUILDER_H_
22 #define OTAWA_ETIME_EDGETIMEBUILDER_H_
23 
24 #include <elm/genstruct/HashTable.h>
27 #include <otawa/etime/Config.h>
28 #include "features.h"
29 
30 namespace otawa { namespace etime {
31 
32 class ConfigSet;
33 
34 class EdgeTimeBuilder: public GraphBBTime<ParExeGraph> {
35 public:
36  static p::declare reg;
38  typedef enum { IN_PREFIX = 0, IN_EDGE = 1, IN_BLOCK = 2, IN_SIZE = 3 } place_t;
39 
40 protected:
41  virtual void configure(const PropList& props);
42 
43  // BBProcessor overload
44  virtual void setup(WorkSpace *ws);
45  virtual void processBB(WorkSpace *ws, CFG *cfg, BasicBlock *bb);
46  virtual void cleanup(WorkSpace *ws);
47 
48  // to customize
53  virtual void processEdge(WorkSpace *ws, CFG *cfg);
54  virtual void processSequence(void);
55  virtual void clean(ParExeGraph *graph);
56  void processTimes(const config_list_t& confs);
57  void applyStrictSplit(const config_list_t& confs);
58  void applyFloppySplit(const config_list_t& confs);
59  void applyWeightedSplit(const config_list_t& confs);
60 
61  // services
62  static EventCollector::case_t make(const Event *e, EdgeTimeBuilder::place_t place, bool on);
63  void contributeConst(void);
64  void contributeSplit(const config_list_t& confs, t::uint32 pos, t::uint32 neg, t::uint32 com, ot::time lts_time, ot::time hts_time);
65  void makeSplit(const config_list_t& confs, int p, ConfigSet& hts, ot::time& lts_time, ot::time& hts_time);
67 
68 private:
69 
71  public:
72  static int compare (const event_t& e1, const event_t& e2)
73  { return e1.fst->inst()->address().compare(e2.fst->inst()->address()); }
74  };
75 
76  void apply(Event *event, ParExeInst *inst);
77  void rollback(Event *event, ParExeInst *inst);
78  EventCollector *get(Event *event);
81  int splitConfs(const config_list_t& confs, const event_list_t& events, bool& lower);
85 
86  // ILP state
87  bool _explicit;
89  bool predump;
90  int event_th;
91 
92  // graph
101 
102  // collector of events
104 };
105 
106 } } // otawa::etime
107 
108 #endif /* OTAWA_ETIME_EDGETIMEBUILDER_H_ */
virtual void clean(ParExeGraph *graph)
Called to cleanup a graph allocated by a call to make().
Definition: EdgeTimeBuilder.cpp:372
struct otawa::sem::inst inst
CFG * cfg(void) const
Get the current CFG.
Definition: CFGProcessor.h:56
void applyWeightedSplit(const config_list_t &confs)
Performing split by computing an heuristic based on weights of BB and events.
Definition: EdgeTimeBuilder.cpp:961
virtual void processBB(WorkSpace *ws, CFG *cfg, BasicBlock *bb)
Perform the work of the given basic block.
Definition: EdgeTimeBuilder.cpp:343
void applyStrictSplit(const config_list_t &confs)
Application of two time approach, LTS and HTS time.
Definition: EdgeTimeBuilder.cpp:1036
genstruct::Vector< event_t > event_list_t
Definition: EdgeTimeBuilder.h:50
Compute execution time by edge using the parametric exegraph approach.
Definition: EdgeTimeBuilder.h:34
int countVarEvents(const event_list_t &events)
Count the number of variable events in the event list.
Definition: EdgeTimeBuilder.cpp:515
void makeSplit(const config_list_t &confs, int p, ConfigSet &hts, ot::time &lts_time, ot::time &hts_time)
Build the set after split.
Definition: EdgeTimeBuilder.cpp:1114
ilp::System * sys
Definition: EdgeTimeBuilder.h:88
void applyFloppySplit(const config_list_t &confs)
Application of two time approach, LTS and HTS time.
Definition: EdgeTimeBuilder.cpp:889
EdgeTimeBuilder(p::declare &r=reg)
Definition: EdgeTimeBuilder.cpp:298
elm::genstruct::Vector< Resource * > _hw_resources
Definition: GraphBBTime.h:158
Class to declare simple a processor.
Definition: Registration.h:213
void apply(Event *event, ParExeInst *inst)
Apply the given event to the given instruction.
Definition: EdgeTimeBuilder.cpp:800
void contributeConst(void)
Generate contribution for constant events.
Definition: EdgeTimeBuilder.cpp:1207
Definition: EdgeTimeBuilder.h:38
Collects variables linking events with blocks in ILP.
Definition: EventCollector.h:31
static int compare(const event_t &e1, const event_t &e2)
Definition: EdgeTimeBuilder.h:72
ParExeNode * bnode
Definition: EdgeTimeBuilder.h:98
ParExeEdge * bedge
Definition: EdgeTimeBuilder.h:99
WorkSpace * ws
Definition: Processor.h:185
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
Control Flow Graph representation.
Definition: CFG.h:42
An edge in a ParExeGraph.
Definition: ParExeGraph.h:400
BasicBlock * source
Definition: EdgeTimeBuilder.h:100
Edge * edge
Definition: EdgeTimeBuilder.h:93
Definition: EdgeTimeBuilder.h:38
virtual ParExeGraph * make(ParExeSequence *seq)
This method is called to build the parametric execution graph.
Definition: EdgeTimeBuilder.cpp:360
void sortEvents(event_list_t &events, BasicBlock *bb, place_t place, Edge *edge=0)
Sort events according the instructions they apply to.
Definition: EdgeTimeBuilder.cpp:695
Pair< Event *, place_t > event_t
Definition: EdgeTimeBuilder.h:49
void genForOneCost(ot::time cost, Edge *edge, event_list_t &events)
Generate the constraints when only one cost is considered for the edge.
Definition: EdgeTimeBuilder.cpp:649
void displayConfs(const genstruct::Vector< ConfigSet > &confs, const event_list_t &events)
Display the list of configuration sorted by cost.
Definition: EdgeTimeBuilder.cpp:761
A node of the ParExeGraph, that represents the crossing of an instruction inside a microprocessor sta...
Definition: ParExeGraph.h:339
Definition: EdgeTimeBuilder.h:38
genstruct::Vector< Resource * > * ressources(void)
Definition: EdgeTimeBuilder.h:66
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
An event represents a time variation in the execution of an instruction.
Definition: features.h:64
virtual void setup(WorkSpace *ws)
This method is called before an anlysis to let the processor do some initialization.
Definition: EdgeTimeBuilder.cpp:324
void contributeSplit(const config_list_t &confs, t::uint32 pos, t::uint32 neg, t::uint32 com, ot::time lts_time, ot::time hts_time)
Contribute to WCET estimation in split way, x_HTS and x_LTS, with two sets of times.
Definition: EdgeTimeBuilder.cpp:1140
A sequence of ParExeInstruction for which a ParExeGraph will be built.
Definition: ParExeGraph.h:125
event_list_t events
Definition: EdgeTimeBuilder.h:95
virtual void processSequence(void)
Compute and process the time for the given sequence.
Definition: EdgeTimeBuilder.cpp:527
static p::declare reg
Definition: EdgeTimeBuilder.h:36
Definition: EdgeTimeBuilder.h:38
This class represents edges in the CFG representation.
Definition: Edge.h:33
This basic block processor computes the basic block execution time using the execution graph method d...
Definition: GraphBBTime.h:143
Definition: EdgeTimeBuilder.h:70
Representation of a parametric execution graph (Parametric Execution Graph).
Definition: ParExeGraph.h:214
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
genstruct::Vector< ConfigSet > config_list_t
Definition: EdgeTimeBuilder.h:51
int splitConfs(const config_list_t &confs, const event_list_t &events, bool &lower)
Partition the configuration times in two sets: configuration times in [0, p[ are the low time set (LT...
Definition: EdgeTimeBuilder.cpp:716
void rollback(Event *event, ParExeInst *inst)
Rollback the given event to the given instruction.
Definition: EdgeTimeBuilder.cpp:840
virtual void configure(const PropList &props)
Configure the current processor.
Definition: EdgeTimeBuilder.cpp:314
void processTimes(const config_list_t &confs)
Process the computed time and generate associated objective functions and constraints.
Definition: EdgeTimeBuilder.cpp:875
ParExeNode * getBranchNode(void)
Get the branch node resolving a branch prediction.
Definition: EdgeTimeBuilder.cpp:775
BasicBlock * target
Definition: EdgeTimeBuilder.h:100
Instruction as presented in the ParExeGraph.
Definition: ParExeGraph.h:63
int event_th
Definition: EdgeTimeBuilder.h:90
bool _explicit
Definition: EdgeTimeBuilder.h:87
This a list of properties.
Definition: PropList.h:63
case_t
Definition: EventCollector.h:35
t::int64 time
Definition: base.h:47
genstruct::Vector< event_t > all_events
Definition: EdgeTimeBuilder.h:94
Set of configurations with the same or with a maximum of time.
Definition: Config.h:46
virtual void processEdge(WorkSpace *ws, CFG *cfg)
Definition: EdgeTimeBuilder.cpp:379
An ILP system is a colletion of ILP constraint that may maximize or minimize some object function...
Definition: System.h:42
place_t
Definition: EdgeTimeBuilder.h:38
ParExeGraph * graph
Definition: EdgeTimeBuilder.h:97
virtual void cleanup(WorkSpace *ws)
This method is called after the end of the processor analysis to let it do some clean up...
Definition: EdgeTimeBuilder.cpp:332
ParExeSequence * seq
Definition: EdgeTimeBuilder.h:96
inst neg(int d, int a)
Definition: inst.h:168
genstruct::HashTable< Event *, EventCollector * > colls
Definition: EdgeTimeBuilder.h:103
bool predump
Definition: EdgeTimeBuilder.h:89
uint32_t uint32