Use 'ao-dbg' instead of 's51' to communicate with TeleMetrum
[fw/sdcc] / src / SDCCpeeph.h
1 /*-------------------------------------------------------------------------
2   SDCCpeeph.h - Header file for The peep hole optimizer: for interpreting 
3                 the peep hole rules
4
5              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)
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  SDCCPEEPH_H
27 #define SDCCPEEPH_H 1
28
29 #define MAX_PATTERN_LEN 128
30
31 struct asmLineNode;     /* defined in each port */
32 struct lineNode;
33
34 typedef struct lineNode
35   {
36     char *line;
37     iCode *ic;
38     unsigned int isInline:1;
39     unsigned int isComment:1;
40     unsigned int isDebug:1;
41     unsigned int isLabel:1;
42     unsigned int visited:1;
43     struct asmLineNode *aln;
44     struct lineNode *prev;
45     struct lineNode *next;
46   }
47 lineNode;
48
49 typedef struct peepRule
50   {
51     lineNode *match;
52     lineNode *replace;
53     unsigned int restart:1;
54     char *cond;
55     hTab *vars;
56     struct peepRule *next;
57   }
58 peepRule;
59
60 typedef struct
61   {
62     char name[SDCC_NAME_MAX + 1];
63     int refCount;
64     /* needed for deadMove: */
65     bool passedLabel;
66     int jmpToCount;
67   }
68 labelHashEntry;
69
70 bool isLabelDefinition (const char *line, const char **start, int *len,
71                         bool isPeepRule);
72
73 extern hTab *labelHash;
74 labelHashEntry *getLabelRef (const char *label, lineNode *head);
75
76 void printLine (lineNode *, struct dbuf_s *);
77 lineNode *newLineNode (const char *);
78 lineNode *connectLine (lineNode *, lineNode *);
79 void initPeepHole (void);
80 void peepHole (lineNode **);
81
82 #endif