Otawa  0.10
ClpPack.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * CLP Pack definition
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2011, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
24 #ifndef OTAWA_DATA_CLP_PACK_H_
25 #define OTAWA_DATA_CLP_PACK_H_
26 
27 #include <elm/genstruct/Vector.h>
29 
30 namespace otawa {
31 
32 namespace clp {
33 
34 class ClpProblem;
35 
36 
42  friend class ClpProblem;
43 public:
45 
50  class InstPack{
51  friend class ClpStatePack; friend class ClpProblem;
52  public:
54  inline InstPack(): _inst_addr(0), _states() {}
58  inline InstPack(address_t inst): _inst_addr(inst), _states() {}
60  ~InstPack(void);
62  inline address_t inst_addr(void) { return _inst_addr; }
69  ASSERT(_states.length() > 0);
70  return *(_states[_states.length() - 1]);
71  }
73  bool isEmpty(void){ return _states.length() == 0; }
74  void append(clp::State &state);
75  private:
78  };
79 
80  class Context {
81  public:
82  Context(Process *process);
84  ~Context(void);
85  inline ClpProblem& problem(void) const { return *prob; }
86  private:
88  bool to_free;
89  };
90 
92 
93  ClpStatePack(BasicBlock *bb, Process *process);
94  ClpStatePack(BasicBlock *bb, const Context& context);
95  ~ClpStatePack(void);
96 
98  inline BasicBlock *bb(void){ return _bb; }
100  inline PackIterator getIterator(void) { return PackIterator(_packs); }
101 
102  clp::State state_after(address_t instruction);
103  clp::State state_after(address_t instruction, int sem);
104  clp::State state_before(address_t instruction);
105  clp::State state_before(address_t instruction, int sem);
106 
107  InstPack* newPack(address_t inst);
108 
109 private:
112 };
113 
114 } // clp
115 
116 } // otawa
117 
118 #endif /* OTAWA_DATA_CLP_PACK_H_ */
struct otawa::sem::inst inst
clp::State state_before(address_t instruction)
Definition: clp_analysis.cpp:2450
ClpStatePack(BasicBlock *bb, Process *process)
Constructor of a new ClpStatePack.
Definition: clp_analysis.cpp:2384
void append(clp::State &state)
Add a new state at the end of this pack.
Definition: clp_analysis.cpp:2418
A pack of CLP states inside a machine instruction.
Definition: ClpPack.h:50
StateIterator getIterator(void)
Definition: ClpPack.h:64
PackIterator getIterator(void)
Definition: ClpPack.h:100
bool isEmpty(void)
Definition: ClpPack.h:73
Context(Process *process)
Buid a ClpPack context.
Definition: clp_analysis.cpp:2346
address_t inst_addr(void)
Definition: ClpPack.h:62
~Context(void)
Definition: clp_analysis.cpp:2363
ClpProblem & problem(void) const
Definition: ClpPack.h:85
InstPack * newPack(address_t inst)
Add a new instruction pack inside the ClpStatePack.
Definition: clp_analysis.cpp:2483
Vector< InstPack * >::Iterator PackIterator
Definition: ClpPack.h:91
InstPack(address_t inst)
Constructor for a new instruction pack.
Definition: ClpPack.h:58
bool to_free
Definition: ClpPack.h:88
A pack of CLP states inside a BasicBlock.
Definition: ClpPack.h:41
Vector< clp::State * > _states
Definition: ClpPack.h:77
BasicBlock * bb(void)
Definition: ClpPack.h:98
A context allows to share a CLP problem through different constructions of ClpStatePack.
Definition: ClpPack.h:80
The abstract state of the computer (abstract domain).
Definition: ClpState.h:42
A process is the realization of a program on a platform.
Definition: Process.h:136
The representation of an address in OTAWA.
Definition: base.h:54
friend class ClpProblem
Definition: ClpPack.h:42
~ClpStatePack(void)
Destructor for ClpStatePack.
Definition: clp_analysis.cpp:2402
address_t _inst_addr
Definition: ClpPack.h:76
ClpProblem * prob
Definition: ClpPack.h:87
clp::State state_after(address_t instruction)
Definition: clp_analysis.cpp:2425
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
InstPack()
Constructor for a new instruction pack.
Definition: ClpPack.h:54
friend class ClpProblem
Definition: ClpPack.h:51
BasicBlock * _bb
Definition: ClpPack.h:110
Vector< clp::State * >::Iterator StateIterator
Definition: ClpPack.h:44
Vector< InstPack * > _packs
Definition: ClpPack.h:111
~InstPack(void)
Destructor.
Definition: clp_analysis.cpp:2409
clp::State & outputState(void)
Definition: ClpPack.h:68