Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20160627114706

Diff

Diff from 1.4 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/arch/nova/table.c

Annotated File View

ragge
1.4
1 /*      $Id: table.c,v 1.4 2016/06/27 11:47:06 ragge Exp $      */
ragge
1.1
2 /*
3  * Copyright (c) 2006 Anders Magnusson (ragge@ludd.luth.se).
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29
30 # include "pass2.h"
31
32 # define ANYSIGNED TINT|TLONG|TSHORT|TCHAR
33 # define ANYUSIGNED TUNSIGNED|TULONG|TUSHORT|TUCHAR
34 # define ANYFIXED ANYSIGNED|ANYUSIGNED
ragge
1.3
35 # define ANYREG (INAREG|INBREG|INCREG)
ragge
1.1
36 # define TUWORD TUNSIGNED|TULONG
37 # define TSWORD TINT|TLONG
38 # define TWORD TUWORD|TSWORD
39
40 struct optab table[] = {
41 /* First entry must be an empty entry */
42 { -1FOREFFSANYTANYSANYTANY00"", },
43
ragge
1.3
44 /*
ragge
1.4
45  * Conversions.
46  */
47 /* uchar to (u)int */
48 SCONV,        INAREG,
49         SAREG,  TUCHAR,
50         SAREG,  TINT|TUNSIGNED,
51                 0,      RLEFT,
52                 "",     },
53
54 /*
ragge
1.3
55  * All ASSIGN entries.
56  */
57 /* reg->reg */
58 ASSIGN,       FOREFF|INAREG|INBREG,
59         SAREG|SBREG,    TWORD|TPOINT,
60         SAREG|SBREG,    TWORD|TPOINT,
61                 0,      RDEST,
62                 "       mov AR,AL\n", },
63 /* reg->mem */
64 ASSIGN,       FOREFF|INAREG|INBREG,
65         SNAME|SOREG,    TWORD|TPOINT,
66         SAREG|SBREG,    TWORD|TPOINT,
ragge
1.1
67                 0,      RDEST,
ragge
1.3
68                 "       sta AR,AL\n", },
69 /* mem->reg */
70 ASSIGN,       FOREFF|INAREG|INBREG,
71         SAREG|SBREG,    TWORD|TPOINT,
72         SNAME|SOREG,    TWORD|TPOINT,
ragge
1.1
73                 0,      RDEST,
ragge
1.3
74                 "       lda AL,AR\n", },
ragge
1.1
75
ragge
1.3
76 /*
77  * LEAF type movements.
78  */
79 /* 0 -> reg */
80 OPLTYPE,      INAREG|INBREG,
81         SANY,   TANY,
82         SZERO,  TWORD,
83                 NAREG,  RESC1,
84                 "       subo A1,A1\n", },
ragge
1.1
85
ragge
1.3
86 /* 1 -> reg */
87 OPLTYPE,      INAREG|INBREG,
ragge
1.1
88         SANY,   TANY,
89         SONE,   TWORD,
ragge
1.3
90                 NAREG|NBREG,    RESC1,
ragge
1.4
91                 "       subzl A1,A1\n", },
ragge
1.1
92
ragge
1.3
93 /* constant -> reg */
94 OPLTYPE,      INAREG|INBREG,
ragge
1.1
95         SANY,   TANY,
ragge
1.3
96         SCON,   TWORD|TPOINT,
97                 NAREG|NBREG,    RESC1,
98                 "       lda A1,AR\n", },
ragge
1.1
99
ragge
1.3
100 /* mem -> reg */
ragge
1.1
101 OPLTYPE,      INAREG,
ragge
1.3
102         SANY,           TANY,
103         SNAME|SOREG,    TWORD,
ragge
1.1
104                 NAREG,  RESC1,
ragge
1.3
105                 "       lda A1,AR\n", },
ragge
1.1
106
ragge
1.3
107 /* reg -> A-reg */
ragge
1.1
108 OPLTYPE,      INAREG,
ragge
1.3
109         SANY,           TANY,
110         SAREG|SBREG,    TWORD,
ragge
1.1
111                 NAREG,  RESC1,
ragge
1.3
112                 "       mov AR,A1\n", },
ragge
1.1
113
ragge
1.3
114 /* reg -> B-reg */
ragge
1.1
115 OPLTYPE,      INBREG,
ragge
1.3
116         SANY,           TANY,
ragge
1.4
117         SAREG|SBREG,    TWORD|TPOINT,
ragge
1.3
118                 NBREG,  RESC1,
119                 "       mov AR,A1\n", },
120
121 OPLTYPE,      INBREG,
122         SANY,           TANY,
123         SNAME|SOREG,    TPOINT,
ragge
1.1
124                 NBREG,  RESC1,
ragge
1.3
125                 "       lda A1,AR\n", },
ragge
1.1
126
127 OPLTYPE,      INBREG,
ragge
1.3
128         SANY,           TANY,
129         SLDFPSP,        TANY,
ragge
1.1
130                 NBREG,  RESC1,
131                 "       lda A1,AR\n", },
132
ragge
1.3
133 /*
134  * Simple ops.
135  */
136 PLUS,         INBREG|INAREG,
ragge
1.1
137         SAREG|SBREG,    TWORD|TPOINT,
138         SONE,           TANY,
139                 0,      RLEFT,
140                 "       inc AL,AL\n", },
141
142 OPSIMP,       INBREG|INAREG|FOREFF,
143         SAREG|SBREG,    TWORD|TPOINT,
144         SAREG|SBREG,    TWORD|TPOINT,
145                 0,      RLEFT,
146                 "       O AR,AL\n", },
147
ragge
1.3
148 /*
149  * Indirections
150  */
ragge
1.4
151 #ifdef nova4
ragge
1.1
152 UMULINAREG,
ragge
1.4
153         SANY,                           TPTRTO|TCHAR|TUCHAR,
154         SOREG|SAREG|SBREG|SNAME,        TCHAR|TUCHAR,
ragge
1.1
155                 NAREG|NASL,     RESC1,
ragge
1.4
156                 "       ldb A1,AL\n", },
157 #endif
158 UMULINAREG,
159         SANY,   TPTRTO|TUCHAR,
160         SOREG,  TUCHAR,
161                 NSPECIAL|NAREGRESC1,
162                 "       jsr @lbyt\n", },
163
164 UMULINAREG,
165         SANY,   TPTRTO|TCHAR,
166         SOREG,  TCHAR,
167                 NSPECIAL|NAREGRESC1,
168                 "       jsr @lsbyt\n", },
ragge
1.3
169
170 UMULINAREG,
171         SANY,   TPOINT|TWORD,
ragge
1.4
172         SOREG,  TPOINT|TWORD,
ragge
1.3
173                 NAREG|NASL,     RESC1,
ragge
1.4
174                 "       lda A1,AL\n", },
ragge
1.3
175
176 UMULINBREG,
177         SANY,   TPOINT|TWORD,
178         SOREG,  TPOINT|TWORD,
179                 NBREG|NBSL,     RESC1,
ragge
1.4
180                 "       lda A1,AL\n", },
ragge
1.1
181
182 /*
ragge
1.4
183  * logops
ragge
1.1
184  */
ragge
1.4
185 EQ,   FOREFF,
186         SAREG|SBREG,    TANY,
187         SZERO,          TANY,
188                 0,      RNOP,
189                 "       mov# AL,AL,snr\n        jmp LC\n", },
ragge
1.1
190
ragge
1.4
191 EQ,   FOREFF,
192         SAREG|SBREG,    TANY,
193         SAREG|SBREG,    TANY,
194                 0,      RNOP,
195                 "       sub# AL,AR,snr\n        jmp LC\n", },
ragge
1.1
196
ragge
1.4
197 NE,   FOREFF,
198         SAREG|SBREG,    TANY,
199         SZERO,          TANY,
200                 0,      RNOP,
201                 "       mov# AL,AL,szr\n        jmp LC\n", },
ragge
1.1
202
ragge
1.4
203 NE,   FOREFF,
204         SAREG|SBREG,    TANY,
205         SAREG|SBREG,    TANY,
206                 0,      RNOP,
207                 "       sub# AL,AR,szr\n        jmp LC\n", },
ragge
1.1
208
209 /*
210  * Subroutine calls.
211  */
212
213 CALL,         FOREFF,
214         SCON,   TANY,
215         SANY,   TANY,
216                 0,      0,
ragge
1.4
217                 "       jsr @CL\n", },
ragge
1.1
218
219 UCALL,        FOREFF,
220         SCON,   TANY,
ragge
1.3
221         SANY,   TANY,
ragge
1.1
222                 0,      0,
ragge
1.4
223                 "       jsr @CL\n", },
ragge
1.3
224
225 CALL,         INAREG|FOREFF,
226         SCON,   TANY,
227         SANY,   TANY,
228                 NAREG|NASL,     RESC1,
ragge
1.4
229                 "       jsr @CL\n", },
ragge
1.3
230
231 UCALL,        INAREG|FOREFF,
232         SCON,   TANY,
233         SANY,   TANY,
234                 NAREG|NASL,     RESC1,
ragge
1.4
235                 "       jsr @CL\n", },
ragge
1.1
236
ragge
1.4
237 GOTO,         FOREFF,
ragge
1.1
238         SCON,   TANY,
239         SANY,   TANY,
240                 0,      RNOP,
ragge
1.4
241                 "       jmp @LL\n", },
ragge
1.1
242
243 FUNARG,       FOREFF,
ragge
1.3
244         SAREG|SBREG,    TCHAR|TUCHAR|TWORD|TPOINT,
245         SANY,           TCHAR|TUCHAR|TWORD|TPOINT,
ragge
1.4
246                 NBREG,  RNULL,
247                 "       lda A1,csp\n    sta AL,ZB\n", },
ragge
1.1
248
249 # define DF(x) FORREW,SANY,TANY,SANY,TANY,REWRITE,x,""
250
251 UMULDFUMUL ), },
252
253 ASSIGNDF(ASSIGN), },
254
255 STASGDF(STASG), },
256
257 FLDDF(FLD), },
258
259 OPLEAFDF(NAME), },
260
261 OPUNARYDF(UMINUS), },
262
263 OPANYDF(BITYPE), },
264
265 FREEFREE,   FREE,   FREE,   FREE,   FREE,   FREE,   FREE,   "help; I'm in trouble\n" },
266 };
267
268 int tablesize = sizeof(table)/sizeof(table[0]);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2016-07-01 13:37 +0200