Otawa  0.10
ConstraintLoader.h
Go to the documentation of this file.
1 /*
2  * ConstraintLoader class implementation
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2005-07, 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_IPET_CONSTRAINT_LOADER_H
22 #define OTAWA_IPET_CONSTRAINT_LOADER_H
23 
24 #include <elm/string.h>
25 #include <elm/system/Path.h>
26 #include <elm/genstruct/HashTable.h>
27 #include <elm/string.h>
28 #include <otawa/base.h>
30 #include <otawa/ilp.h>
31 
32 // External class
33 namespace otawa {
34  namespace ipet { class ConstraintLoader; }
35  class ExpNode;
36  class BasicBlock;
37 }
39 void ipet_error(otawa::ipet::ConstraintLoader *, const char *);
40 
41 namespace otawa { namespace ipet {
42 
43 class NormNode;
44 
45 
46 // ConstraintLoader class
49  friend void ::ipet_error(ConstraintLoader *, const char *);
50 
51 public:
55 
56 protected:
57  virtual void processCFG(WorkSpace *fw, CFG *cfg);
58  virtual void configure(const PropList &props = PropList::EMPTY);
59 
60 private:
66 
67  BasicBlock *getBB(address_t addr);
68  BasicBlock *getBB(int index);
69  void newBBVar(cstring name, address_t addr);
70  void newBBVar(cstring name, int index);
74  NormNode *normalize(ExpNode *node, double mult = 1);
75 
76  void error(string message);
77  void fatal(string message);
78 };
79 
80 } } // otawa::ipet
81 
82 #endif // OTAWA_IPET_CONSTRAINT_LOADER_H
BasicBlock * getBB(address_t addr)
Find the BB matching the given address.
Definition: ipet_ConstraintLoader.cpp:153
t::uint32 mult(t::uint32 a, t::uint32, bool &over)
CFG * cfg(void) const
Get the current CFG.
Definition: CFGProcessor.h:56
elm::String name(void) const
Definition: Processor.h:91
elm::genstruct::HashTable< Address, BasicBlock * > bbs
Definition: ConstraintLoader.h:63
comparator_t
Definition: Constraint.h:36
bool addConstraint(ExpNode *left, ilp::Constraint::comparator_t t, ExpNode *right)
Add a constraint to the current ILP system.
Definition: ipet_ConstraintLoader.cpp:275
WorkSpace * fw
Definition: ConstraintLoader.h:61
void fatal(string message)
Display an error message and stop the execution (raising an exception).
Definition: ipet_ConstraintLoader.cpp:442
virtual void configure(const PropList &props=PropList::EMPTY)
Configure the current processor.
Definition: ipet_ConstraintLoader.cpp:387
static const PropList EMPTY
This is an empty proplist for convenience.
Definition: PropList.h:66
Abstract class to represent the registered processors.
Definition: Registration.h:80
ConstraintLoader(AbstractRegistration &r=reg)
Constructor.
Definition: ipet_ConstraintLoader.cpp:141
Definition: Registration.h:138
elm::genstruct::HashTable< String, ilp::Var * > vars
Definition: ConstraintLoader.h:64
IntFormat right(IntFormat fmt)
ilp::System * system
Definition: ConstraintLoader.h:62
void ipet_error(otawa::ipet::ConstraintLoader *, const char *)
Definition: ipet_parser.cpp:1727
Control Flow Graph representation.
Definition: CFG.h:42
bool newEdgeVar(elm::CString name, address_t src, address_t dst)
For internal use only.
Definition: ipet_ConstraintLoader.cpp:224
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
This code processor allows loading IPET constraint from an external file.
Definition: ConstraintLoader.h:47
The representation of an address in OTAWA.
Definition: base.h:54
This is a specialization of the processor class dedicated to CFG processing.
Definition: CFGProcessor.h:35
virtual void processCFG(WorkSpace *fw, CFG *cfg)
Definition: ipet_ConstraintLoader.cpp:398
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
NormNode * normalize(ExpNode *node, double mult=1)
Normalize the given expression.
Definition: ipet_ConstraintLoader.cpp:321
IntFormat left(IntFormat fmt)
static Registration< ConstraintLoader > reg
Definition: ConstraintLoader.h:53
This a list of properties.
Definition: PropList.h:63
int ipet_parse(otawa::ipet::ConstraintLoader *)
elm::String path
Definition: ConstraintLoader.h:65
static Identifier< String > PATH
This property identifier is used for passing specific file to load to the ConstraintLoader (argument ...
Definition: ConstraintLoader.h:52
A variable is an identifier used for performing ILP computation.
Definition: Var.h:36
void newBBVar(cstring name, address_t addr)
For internal use only.
Definition: ipet_ConstraintLoader.cpp:190
An ILP system is a colletion of ILP constraint that may maximize or minimize some object function...
Definition: System.h:42
ilp::Var * getVar(CString name)
For internal use only.
Definition: ipet_ConstraintLoader.cpp:260
Definition: ExpNode.h:15
void error(string message)
Display an error with line number.
Definition: ipet_ConstraintLoader.cpp:433