Otawa  0.10
AlternativeProcessor.h
Go to the documentation of this file.
1 /*
2  * AlternativeProcessor class implementation
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2015, 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_ALTERNATIVE_PROCESSOR_H
22 #define OTAWA_ALTERNATIVE_PROCESSOR_H
23 
24 #include <elm/genstruct/Vector.h>
25 #include <otawa/proc/Processor.h>
26 
27 namespace otawa {
28 
30 public:
31 
32  class Alternative {
33  public:
34  inline Alternative& require(const AbstractFeature& f) { feats.add(FeatureUsage(FeatureUsage::require, f)); return *this; }
35  inline Alternative& use(const AbstractFeature& f) { feats.add(FeatureUsage(FeatureUsage::use, f)); return *this; }
36  inline const genstruct::Vector<FeatureUsage> features(void) const { return feats; }
37  private:
39  };
40 
41  class AlternativeSet: public genstruct::Vector<const Alternative *> {
42  public:
44  };
45 
46  AlternativeProcessor(AlternativeSet& alts, AbstractRegistration& r);
47 
48 protected:
49  virtual const Alternative& select(WorkSpace *ws) = 0;
50 
51 private:
53 };
54 
55 namespace p {
58 } // p
59 
60 } // otawa
61 
62 #endif // OTAWA_ALTERNATIVE_PROCESSOR_H
Definition: Registration.h:52
Alternative & use(const AbstractFeature &f)
Add a use to the alternative.
Definition: AlternativeProcessor.h:35
Definition: Registration.h:59
Abstract class to represent the registered processors.
Definition: Registration.h:80
WorkSpace * ws
Definition: Processor.h:185
Set of alternatives for an AlternativeProcessor.
Definition: AlternativeProcessor.h:41
Definition: Registration.h:56
Alternative & require(const AbstractFeature &f)
Add a requirement to the alternative.
Definition: AlternativeProcessor.h:34
const genstruct::Vector< FeatureUsage > features(void) const
Get the list of requirements of this alternative.
Definition: AlternativeProcessor.h:36
genstruct::Vector< FeatureUsage > feats
Definition: AlternativeProcessor.h:38
The processor class is implemented by all code processor.
Definition: Processor.h:49
Represent an alternetive in the requirement of an AlternativeProcessor, i.e., a list of required or u...
Definition: AlternativeProcessor.h:32
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
AlternativeSet & add(const Alternative &alt)
Add an alternative to the set.
Definition: AlternativeProcessor.h:43
inst add(int d, int a, int b)
Definition: inst.h:163
AlternativeProcessor::Alternative alt(void)
Definition: AlternativeProcessor.h:56
virtual const Alternative & select(WorkSpace *ws)=0
This method is called to select an alternative.
With OTAWA classic scheduler, the list of required feature if fixed in the registration data structur...
Definition: AlternativeProcessor.h:29
AlternativeProcessor::AlternativeSet altset(void)
Definition: AlternativeProcessor.h:57
See Feature.
Definition: AbstractFeature.h:36
AlternativeSet set
Definition: AlternativeProcessor.h:52
AlternativeProcessor(AlternativeSet &alts, AbstractRegistration &r)
Build an alternative processor.
Definition: proc_AlternativeProcessor.cpp:130