Use 'ao-dbg' instead of 's51' to communicate with TeleMetrum
[fw/sdcc] / src / SDCCBBlock.h
1 /*-------------------------------------------------------------------------
2
3   SDCCBBlock.h - header file for Basic Blocks
4
5              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
6
7    This program is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published by the
9    Free Software Foundation; either version 2, or (at your option) any
10    later version.
11    
12    This program 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 this program; if not, write to the Free Software
19    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20    
21    In other words, you are welcome to use, share and improve this program.
22    You are forbidden to forbid anyone else to use, share and improve
23    what you give them.   Help stamp out software-hoarding!  
24 -------------------------------------------------------------------------*/
25
26 #ifndef SDCCBBLOCK_H
27 #define SDCCBBLOCK_H 1
28
29 /* definition of a basic block */
30 typedef struct eBBlock
31   {
32     int dfnum;                  /* depth first number */
33     int bbnum;                  /* index into array of numbers */
34     int depth;                  /* loop depth of this block */
35     int fSeq;                   /* sequence number of first iCode */
36     int lSeq;                   /* sequence number of the last iCode */
37     unsigned int visited:1;     /* visitied flag      */
38     unsigned int hasFcall:1;    /* has a function call */
39     unsigned int noPath:1;      /* there is no path from _entry to this block */
40     unsigned int isLastInLoop:1;        /* is the last block in a loop */
41     struct eBBlock *isConditionalExitFrom; /* this block ends with a return or goto from a conditional block*/
42     symbol *entryLabel;         /* entry label */
43
44     iCode *sch;                 /* pointer to start of code chain */
45     iCode *ech;                 /* pointer to last of code chain  */
46
47     struct eBBlock *preHeader;  /* preheader if this is a loop entry */
48     struct region *partOfLoop;  /* pointer to the loop region this block is part of */
49
50     /* control flow analysis */
51     set *succList;              /* list eBBlocks which are successors  */
52     bitVect *succVect;          /* bitVector of successors (index is bbnum) */
53     set *predList;              /* predecessors of this basic block    */
54     bitVect *domVect;           /* list of nodes this is dominated by (index is bbnum) */
55
56     /* data flow analysis */
57     set *inExprs;               /* in coming common expressions    */
58     set *outExprs;              /* out going common expressions    */
59     set *killedExprs;           /* killed common expressions       */
60     bitVect *inDefs;            /* in coming defintions            */
61     bitVect *outDefs;           /* out going defintions            */
62     bitVect *defSet;            /* symbols defined in block        */
63     bitVect *ldefs;             /* local definitions only          */
64     bitVect *usesDefs;          /* which definitions are used in this block */
65     bitVect *ptrsSet;           /* pointers assigned values in the block */
66     bitVect *inPtrsSet;         /* in coming pointers assigned values */
67     bitVect *ndompset;          /* pointers set by non-dominating basic blocks */
68     set *addrOf;                /* symbols for which addres has been taken in the block */
69     bitVect *linds;             /* if loop exit this contains defNumbers
70                                    for the inductions */
71   }
72 eBBlock;
73
74 typedef struct ebbIndex
75   {
76     int count;                  /* number of blocks in the index */
77     eBBlock **bbOrder;          /* blocks in bbnum order */
78     eBBlock **dfOrder;          /* blocks in dfnum (depth first) order */
79   }
80 ebbIndex;
81
82 typedef struct edge
83   {
84
85     eBBlock *from;              /* from basic block */
86     eBBlock *to;                /* to Basic Block   */
87   }
88 edge;
89
90
91 extern int eBBNum;
92 extern set *graphEdges;
93
94
95 DEFSETFUNC (printEntryLabel);
96 eBBlock *neweBBlock ();
97 edge *newEdge (eBBlock *, eBBlock *);
98 eBBlock *eBBWithEntryLabel (ebbIndex *, symbol *);
99 DEFSETFUNC (ifFromIs);
100 set *edgesTo (eBBlock *);
101 void remiCodeFromeBBlock (eBBlock *, iCode *);
102 void addiCodeToeBBlock (eBBlock *, iCode *, iCode *);
103 ebbIndex *iCodeBreakDown (iCode *);
104 void replaceSymBySym (set *, operand *, operand *);
105 iCode *iCodeFromeBBlock (eBBlock **, int);
106 int otherPathsPresent (eBBlock **, eBBlock *);
107 void replaceLabel (eBBlock *, symbol *, symbol *);
108 void dumpEbbsToFileExt (int, ebbIndex *);
109 void dumpLiveRanges (int, hTab * liveRanges);
110 void closeDumpFiles();
111
112 #endif