Otawa  0.10
features.h
Go to the documentation of this file.
1 /*
2  * etime plugin features
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_FEATURES_H_
22 #define OTAWA_ETIME_FEATURES_H_
23 
24 #include <otawa/proc/Feature.h>
25 
26 namespace otawa {
27 
28 // pre-declarations
29 namespace ilp {
30  class Constraint;
31  class System;
32  class Var;
33 } // ilp
34 namespace hard {
35  class FunctionalUnit;
36  class Stage;
37 }
38 class Inst;
39 
40 namespace etime {
41 
42 typedef enum {
44  FETCH, // no argument
45  MEM, // no argument
46  BRANCH, // no argument
47  STAGE, // stage argument
48  FU // FU argument
49 } kind_t;
50 
51 typedef enum {
52  NEVER = 0,
53  SOMETIMES = 1,
54  ALWAYS = 2
55 } occurrence_t;
56 
57 typedef enum type_t {
60 } type_t;
61 
62 
63 // Event class
64 class Event: public PropList {
65 public:
66 
67  Event(Inst *inst);
68  virtual ~Event(void);
69  inline Inst *inst(void) const { return _inst; }
70 
71  // accessors
72  virtual kind_t kind(void) const = 0;
73  virtual ot::time cost(void) const = 0;
74  virtual type_t type(void) const = 0;
75  virtual occurrence_t occurrence(void) const;
76  virtual cstring name(void) const;
77  virtual string detail(void) const = 0;
78  virtual const hard::Stage *stage(void) const;
79  virtual const hard::FunctionalUnit *fu(void) const;
80 
81  // heuristic contribution
82  virtual int weight(void) const;
83 
84  // ILP contribution
85  virtual bool isEstimating(bool on);
86  virtual void estimate(ilp::Constraint *cons, bool on);
87 
88 private:
90 };
91 
92 // event feature
96 
97 // configuration feature
101 
102 } } // otawa::etime
103 
104 #endif /* OTAWA_ETIME_FEATURES_H_ */
Definition: features.h:53
virtual type_t type(void) const =0
virtual void estimate(ilp::Constraint *cons, bool on)
Add an estimation of the event at the left of the given constraint.
Definition: hook.cpp:211
Identifier< int > EVENT_THRESHOLD
This property is used to configure the EDGE_TIME_FEATURE and determine the maximum number of events t...
virtual ot::time cost(void) const =0
Get the cost in cycles of the occurrence of the event.
virtual ~Event(void)
Definition: hook.cpp:113
Definition: features.h:43
occurrence_t
Definition: features.h:51
Definition: features.h:59
virtual cstring name(void) const
Get the name of the event (for human user).
Definition: hook.cpp:144
Definition: features.h:58
virtual const hard::Stage * stage(void) const
For events applying to a particular processor stage, get this stage.
Definition: hook.cpp:154
Definition: features.h:44
This class represents a stage in a pipeline.
Definition: Processor.h:87
Definition: features.h:52
virtual int weight(void) const
Weight is a coarse-grain estimation of the number of times an event arises.
Definition: hook.cpp:195
virtual const hard::FunctionalUnit * fu(void) const
For events applying to a particular processor functional unit, get this functional unit...
Definition: hook.cpp:164
An event represents a time variation in the execution of an instruction.
Definition: features.h:64
Definition: features.h:48
This class is used to represent constraints in an ILP system with the following form: ...
Definition: Constraint.h:33
p::feature EDGE_TIME_FEATURE
This feature ensures that block cost has been computed according to the context of edges...
virtual string detail(void) const =0
A functional unit is specialized in the computation of some kinds of instructions.
Definition: Processor.h:60
Definition: features.h:46
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
Identifier< Event * > EVENT
Allows to hook an event to a basic block.
virtual occurrence_t occurrence(void) const
Get the occurrences class of this event.
Definition: hook.cpp:135
Inst * inst(void) const
Get the instruction this event applies to.
Definition: features.h:69
Definition: features.h:45
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
virtual bool isEstimating(bool on)
Ask for support of overestimation for the event when activated (on is true) or desactivated (on is fa...
Definition: hook.cpp:184
kind_t
Definition: features.h:42
Definition: features.h:54
This a list of properties.
Definition: PropList.h:63
t::int64 time
Definition: base.h:47
Inst * _inst
Definition: features.h:89
Event(Inst *inst)
Build an event.
Definition: hook.cpp:107
p::feature EVENTS_FEATURE
This feature ensures that all timing events on pipeline has been recorded.
Definition: features.h:47
p::feature STANDARD_EVENTS_FEATURE
This feature ensures that events of the following analyses has been hooked to the task basic blocks: ...
Shortcut to create a feature with a maker (without the mess of SilentFeature).
Definition: AbstractFeature.h:51
Identifier< bool > PREDUMP
This property is used to configure the EDGE_TIME_FEATURE and ask to dump the generated execution grap...
type_t
Definition: features.h:57
virtual kind_t kind(void) const =0
Get the kind of the event.