1 #ifndef _BPatch_basicBlockLoop_h
2 #define _BPatch_basicBlockLoop_h
5 #include "BPatch_dll.h"
6 #include "BPatch_Vector.h"
7 #include "BPatch_Set.h"
8 #include "BPatch_basicBlock.h"
10 /** class to represent the loops composed of machine code basic
11 * blocks in the executable (Natural loops)
13 * @see BPatch_basicBlock
14 * @see BPatch_flowGraph
17 class BPatch_variableExpr;
19 class BPATCH_DLL_EXPORT BPatch_basicBlockLoop {
20 friend class BPatch_flowGraph;
21 friend ostream& operator<<(ostream&,BPatch_basicBlockLoop&);
24 /** head basic block which dominates all basic blocks in the loop */
25 BPatch_basicBlock* loopHead;
27 /** set of loops that are contained (nested) in this loop. */
28 BPatch_Set<BPatch_basicBlockLoop*> containedLoops;
30 /** the basic blocks in the loop */
31 BPatch_Set<BPatch_basicBlock*> basicBlocks;
33 /** set of basic blocks having an edge to the head of the loop */
34 BPatch_Set<BPatch_basicBlock*> backEdges;
37 /** returns tail of back edges to loop head */
38 void getBackEdges(BPatch_Vector<BPatch_basicBlock*>&);
40 /** returns vector of contained loops */
41 void getContainedLoops(BPatch_Vector<BPatch_basicBlockLoop*>&);
43 /** returns all basic blocks in the loop */
44 void getLoopBasicBlocks(BPatch_Vector<BPatch_basicBlock*>&);
46 /** returns the head basic block of the loop */
47 BPatch_basicBlock* getLoopHead();
49 /** method that returns the variables used as iterator */
50 /** not implemented yet */
51 BPatch_Set<BPatch_variableExpr*>* getLoopIterators();
53 /** destructor for the class */
54 ~BPatch_basicBlockLoop() {}
58 /** constructor of class */
59 BPatch_basicBlockLoop();
61 /** constructor of the class */
62 BPatch_basicBlockLoop(BPatch_basicBlock*);
65 #endif /*_BPatch_basicBlockLoop_h_*/