This commit enables arbitrary instrumentation points at the last instruction
[dyninst.git] / dyninstAPI / h / BPatch_basicBlockLoop.h
1 #ifndef _BPatch_basicBlockLoop_h
2 #define _BPatch_basicBlockLoop_h
3
4 #include <stdlib.h>
5 #include "BPatch_dll.h"
6 #include "BPatch_Vector.h"
7 #include "BPatch_Set.h"
8 #include "BPatch_basicBlock.h"
9
10 /** class to represent the loops composed of machine code basic 
11   * blocks in the executable (Natural loops)
12   *
13   * @see BPatch_basicBlock
14   * @see BPatch_flowGraph
15   */
16
17 class BPatch_variableExpr;
18
19 class BPATCH_DLL_EXPORT BPatch_basicBlockLoop  {
20         friend class BPatch_flowGraph;
21         friend ostream& operator<<(ostream&,BPatch_basicBlockLoop&);
22
23 private:
24         /** head basic block which dominates all basic blocks in the loop */
25         BPatch_basicBlock* loopHead;
26
27         /** set of loops that are contained (nested) in this loop. */
28         BPatch_Set<BPatch_basicBlockLoop*> containedLoops;
29
30         /** the basic blocks in the loop */
31         BPatch_Set<BPatch_basicBlock*> basicBlocks;
32
33         /** set of basic blocks having an edge to the head of the loop */
34         BPatch_Set<BPatch_basicBlock*> backEdges;
35
36 public:
37         /** returns tail of back edges to loop head */
38         void getBackEdges(BPatch_Vector<BPatch_basicBlock*>&);
39
40         /** returns vector of contained loops */
41         void getContainedLoops(BPatch_Vector<BPatch_basicBlockLoop*>&); 
42
43         /** returns all basic blocks in the loop */
44         void getLoopBasicBlocks(BPatch_Vector<BPatch_basicBlock*>&);
45
46         /** returns the head basic block of the loop */
47         BPatch_basicBlock* getLoopHead();
48
49         /** method that returns the variables used as iterator */
50         /** not implemented yet */
51         BPatch_Set<BPatch_variableExpr*>* getLoopIterators();
52
53         /** destructor for the class */
54         ~BPatch_basicBlockLoop() {}
55
56 private:
57 // internal use only
58         /** constructor of class */
59         BPatch_basicBlockLoop();
60
61         /** constructor of the class */
62         BPatch_basicBlockLoop(BPatch_basicBlock*);
63 };
64
65 #endif /*_BPatch_basicBlockLoop_h_*/