1 /* A Bison parser, made by GNU Bison 3.0.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any 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, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.2"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations. */
65 #line 25 "oil.y" /* yacc.c:339 */
66
67
68 #include "config.h"
69 #include <stdio.h>
70 #include <stdlib.h>
71 #include <string.h>
72 #include <ctype.h>
73 #include "ick_bool.h"
74
75 /* Define strdup if it isn't available */
76 #ifndef HAVE_STRDUP
strdup(const char * s)77 char* strdup(const char* s)
78 {
79 char* t=malloc(strlen(s)+1);
80 if(t) strcpy(t,s);
81 return t;
82 }
83 #endif
84
85 /*
86 #define YYDEBUG 1
87 int yydebug=1;
88 */
89
90 /* Each semantic value represents either a constraint on a node that needs to
91 be true for the optimization template to match, or part of the replacement
92 for the optimization template. */
93 struct ickstype
94 {
95 unsigned depth; /* The number of child nodes this is from the root */
96 unsigned long path; /* Bits from the end of this number represent the
97 sequence of lvals (=0) or rvals (=1) this is from the
98 root; depth bits from the end are relevant, and the
99 bit nearest the root is least significant */
100 const char* condition; /* Points to a constant string; the condition to generate
101 on that node. Could also point to something the lexer
102 mallocs, but then the lexer has to keep track of being
103 able to free it again. If this is NULL, it means that
104 there isn't a condition other than maybe mustbemesh */
105 const char* nodetypename; /* The name of the type of node this condition matches,
106 or NULL for a LEXERLEAF */
107 bool usec; /* Whether to append the value of c to the condition */
108 bool mustbemesh; /* Must this node be a mesh or mesh32? */
109 bool cxneeded; /* True means calculate c and x for the node and the
110 condition is on those; false means append 'condition'
111 to the node itself to form the condition and c and x
112 aren't needed */
113 bool width32; /* Generate a 32-bit node? */
114 bool ublo; /* Is this a UBLO (if set, generate conditions
115 to check width)? */
116 unsigned long c; /* The value to append to the condition */
117 int replnum; /* Number of this group for replacements */
118 struct ickstype *n1;/* n1 and n2 are pointers to other conditions that */
119 struct ickstype *n2;/* also have to be satisified */
120 };
121
122 #define YYSTYPE YYSTYPE
123
124 #define MAXOPTNAMELEN 64
125 char optname[MAXOPTNAMELEN]="undefined";
126 int optnumber = 0;
127
128 typedef struct ickstype *YYSTYPE;
129
130 void splitend(void);
131 void splitstart(void);
132
133 void treedepthup(YYSTYPE, bool);
134 void treefree(YYSTYPE);
135 void gennodepath(unsigned, unsigned long);
136 bool treeshapecond(YYSTYPE, bool);
137 YYSTYPE treenscheck(YYSTYPE, YYSTYPE, int);
138 void treecxcond(YYSTYPE);
139 void treerepcount(YYSTYPE, int*);
140 void treerepgen(YYSTYPE, YYSTYPE*, int*);
141
142 int countgetchar(void);
143 int countungetc(int, FILE*);
144 int cgccol;
145 int cgcrow;
146
147 /* #defines for chaining together template expressions; here, s is the type
148 of expression (e.g. select, bitwise and, unary and) that's chaining the
149 expressions together and n is the nonterminal that's the rval */
150 #define BINARYEXPR(s,m,l,r,w) do{ \
151 m=malloc(sizeof(struct ickstype)); \
152 m->n1=l; \
153 m->n2=r; \
154 m->usec=0; \
155 m->condition="->opcode==" s; \
156 m->nodetypename=s; \
157 m->mustbemesh=0; \
158 m->cxneeded=0; \
159 m->depth=0; \
160 m->path=0; \
161 m->replnum=0; \
162 m->width32=w; \
163 m->ublo=0; \
164 treedepthup(m->n1,0); \
165 treedepthup(m->n2,1); \
166 } while(0)
167
168 #define UNARYEXPR(s,m,r,w,u) do{ \
169 m=malloc(sizeof(struct ickstype)); \
170 m->n1=0; \
171 m->n2=r; \
172 m->usec=0; \
173 m->condition="->opcode==" s; \
174 m->nodetypename=s; \
175 m->mustbemesh=0; \
176 m->cxneeded=0; \
177 m->depth=0; \
178 m->path=0; \
179 m->replnum=0; \
180 m->width32=w; \
181 m->ublo=u; \
182 treedepthup(m->n2,1); \
183 } while(0)
184
185 /* Error handling and lexing */
186 int yylex(void);
187 int yyerror(char const *);
188
189 /* Split the output file */
190 #define SPLITMAX 20
191 int splitcount=SPLITMAX;
192 int filenumber=0;
193 bool inloop=0;
194
195 #line 196 "src/oil-oil.c" /* yacc.c:339 */
196
197 # ifndef YY_NULLPTR
198 # if defined __cplusplus && 201103L <= __cplusplus
199 # define YY_NULLPTR nullptr
200 # else
201 # define YY_NULLPTR 0
202 # endif
203 # endif
204
205 /* Enabling verbose error messages. */
206 #ifdef YYERROR_VERBOSE
207 # undef YYERROR_VERBOSE
208 # define YYERROR_VERBOSE 1
209 #else
210 # define YYERROR_VERBOSE 0
211 #endif
212
213
214 /* Debug traces. */
215 #ifndef YYDEBUG
216 # define YYDEBUG 0
217 #endif
218 #if YYDEBUG
219 extern int yydebug;
220 #endif
221
222 /* Token type. */
223 #ifndef YYTOKENTYPE
224 # define YYTOKENTYPE
225 enum yytokentype
226 {
227 LEXERLEAF = 258
228 };
229 #endif
230 /* Tokens. */
231 #define LEXERLEAF 258
232
233 /* Value type. */
234 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
235 typedef int YYSTYPE;
236 # define YYSTYPE_IS_TRIVIAL 1
237 # define YYSTYPE_IS_DECLARED 1
238 #endif
239
240
241 extern YYSTYPE yylval;
242
243 int yyparse (void);
244
245
246
247 /* Copy the second part of user declarations. */
248
249 #line 250 "src/oil-oil.c" /* yacc.c:358 */
250
251 #ifdef short
252 # undef short
253 #endif
254
255 #ifdef YYTYPE_UINT8
256 typedef YYTYPE_UINT8 yytype_uint8;
257 #else
258 typedef unsigned char yytype_uint8;
259 #endif
260
261 #ifdef YYTYPE_INT8
262 typedef YYTYPE_INT8 yytype_int8;
263 #else
264 typedef signed char yytype_int8;
265 #endif
266
267 #ifdef YYTYPE_UINT16
268 typedef YYTYPE_UINT16 yytype_uint16;
269 #else
270 typedef unsigned short int yytype_uint16;
271 #endif
272
273 #ifdef YYTYPE_INT16
274 typedef YYTYPE_INT16 yytype_int16;
275 #else
276 typedef short int yytype_int16;
277 #endif
278
279 #ifndef YYSIZE_T
280 # ifdef __SIZE_TYPE__
281 # define YYSIZE_T __SIZE_TYPE__
282 # elif defined size_t
283 # define YYSIZE_T size_t
284 # elif ! defined YYSIZE_T
285 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
286 # define YYSIZE_T size_t
287 # else
288 # define YYSIZE_T unsigned int
289 # endif
290 #endif
291
292 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
293
294 #ifndef YY_
295 # if defined YYENABLE_NLS && YYENABLE_NLS
296 # if ENABLE_NLS
297 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
298 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
299 # endif
300 # endif
301 # ifndef YY_
302 # define YY_(Msgid) Msgid
303 # endif
304 #endif
305
306 #ifndef YY_ATTRIBUTE
307 # if (defined __GNUC__ \
308 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
309 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
310 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
311 # else
312 # define YY_ATTRIBUTE(Spec) /* empty */
313 # endif
314 #endif
315
316 #ifndef YY_ATTRIBUTE_PURE
317 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
318 #endif
319
320 #ifndef YY_ATTRIBUTE_UNUSED
321 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
322 #endif
323
324 #if !defined _Noreturn \
325 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
326 # if defined _MSC_VER && 1200 <= _MSC_VER
327 # define _Noreturn __declspec (noreturn)
328 # else
329 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
330 # endif
331 #endif
332
333 /* Suppress unused-variable warnings by "using" E. */
334 #if ! defined lint || defined __GNUC__
335 # define YYUSE(E) ((void) (E))
336 #else
337 # define YYUSE(E) /* empty */
338 #endif
339
340 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
341 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
342 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
343 _Pragma ("GCC diagnostic push") \
344 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
345 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
346 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
347 _Pragma ("GCC diagnostic pop")
348 #else
349 # define YY_INITIAL_VALUE(Value) Value
350 #endif
351 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
352 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
353 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
354 #endif
355 #ifndef YY_INITIAL_VALUE
356 # define YY_INITIAL_VALUE(Value) /* Nothing. */
357 #endif
358
359
360 #if ! defined yyoverflow || YYERROR_VERBOSE
361
362 /* The parser invokes alloca or malloc; define the necessary symbols. */
363
364 # ifdef YYSTACK_USE_ALLOCA
365 # if YYSTACK_USE_ALLOCA
366 # ifdef __GNUC__
367 # define YYSTACK_ALLOC __builtin_alloca
368 # elif defined __BUILTIN_VA_ARG_INCR
369 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
370 # elif defined _AIX
371 # define YYSTACK_ALLOC __alloca
372 # elif defined _MSC_VER
373 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
374 # define alloca _alloca
375 # else
376 # define YYSTACK_ALLOC alloca
377 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
378 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
379 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
380 # ifndef EXIT_SUCCESS
381 # define EXIT_SUCCESS 0
382 # endif
383 # endif
384 # endif
385 # endif
386 # endif
387
388 # ifdef YYSTACK_ALLOC
389 /* Pacify GCC's 'empty if-body' warning. */
390 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
391 # ifndef YYSTACK_ALLOC_MAXIMUM
392 /* The OS might guarantee only one guard page at the bottom of the stack,
393 and a page size can be as small as 4096 bytes. So we cannot safely
394 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
395 to allow for a few compiler-allocated temporary stack slots. */
396 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
397 # endif
398 # else
399 # define YYSTACK_ALLOC YYMALLOC
400 # define YYSTACK_FREE YYFREE
401 # ifndef YYSTACK_ALLOC_MAXIMUM
402 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
403 # endif
404 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
405 && ! ((defined YYMALLOC || defined malloc) \
406 && (defined YYFREE || defined free)))
407 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
408 # ifndef EXIT_SUCCESS
409 # define EXIT_SUCCESS 0
410 # endif
411 # endif
412 # ifndef YYMALLOC
413 # define YYMALLOC malloc
414 # if ! defined malloc && ! defined EXIT_SUCCESS
415 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
416 # endif
417 # endif
418 # ifndef YYFREE
419 # define YYFREE free
420 # if ! defined free && ! defined EXIT_SUCCESS
421 void free (void *); /* INFRINGES ON USER NAME SPACE */
422 # endif
423 # endif
424 # endif
425 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
426
427
428 #if (! defined yyoverflow \
429 && (! defined __cplusplus \
430 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
431
432 /* A type that is properly aligned for any stack member. */
433 union yyalloc
434 {
435 yytype_int16 yyss_alloc;
436 YYSTYPE yyvs_alloc;
437 };
438
439 /* The size of the maximum gap between one aligned stack and the next. */
440 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
441
442 /* The size of an array large to enough to hold all stacks, each with
443 N elements. */
444 # define YYSTACK_BYTES(N) \
445 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
446 + YYSTACK_GAP_MAXIMUM)
447
448 # define YYCOPY_NEEDED 1
449
450 /* Relocate STACK from its old location to the new one. The
451 local variables YYSIZE and YYSTACKSIZE give the old and new number of
452 elements in the stack, and YYPTR gives the new location of the
453 stack. Advance YYPTR to a properly aligned location for the next
454 stack. */
455 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
456 do \
457 { \
458 YYSIZE_T yynewbytes; \
459 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
460 Stack = &yyptr->Stack_alloc; \
461 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
462 yyptr += yynewbytes / sizeof (*yyptr); \
463 } \
464 while (0)
465
466 #endif
467
468 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
469 /* Copy COUNT objects from SRC to DST. The source and destination do
470 not overlap. */
471 # ifndef YYCOPY
472 # if defined __GNUC__ && 1 < __GNUC__
473 # define YYCOPY(Dst, Src, Count) \
474 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
475 # else
476 # define YYCOPY(Dst, Src, Count) \
477 do \
478 { \
479 YYSIZE_T yyi; \
480 for (yyi = 0; yyi < (Count); yyi++) \
481 (Dst)[yyi] = (Src)[yyi]; \
482 } \
483 while (0)
484 # endif
485 # endif
486 #endif /* !YYCOPY_NEEDED */
487
488 /* YYFINAL -- State number of the termination state. */
489 #define YYFINAL 2
490 /* YYLAST -- Last index in YYTABLE. */
491 #define YYLAST 345
492
493 /* YYNTOKENS -- Number of terminals. */
494 #define YYNTOKENS 31
495 /* YYNNTS -- Number of nonterminals. */
496 #define YYNNTS 8
497 /* YYNRULES -- Number of rules. */
498 #define YYNRULES 89
499 /* YYNSTATES -- Number of states. */
500 #define YYNSTATES 244
501
502 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
503 by yylex, with out-of-bounds checking. */
504 #define YYUNDEFTOK 2
505 #define YYMAXUTOK 258
506
507 #define YYTRANSLATE(YYX) \
508 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
509
510 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
511 as returned by yylex, without out-of-bounds checking. */
512 static const yytype_uint8 yytranslate[] =
513 {
514 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 29, 9, 2, 11, 28, 17, 10,
518 7, 8, 26, 25, 2, 4, 2, 27, 2, 13,
519 16, 15, 22, 23, 14, 2, 2, 2, 2, 2,
520 6, 30, 5, 19, 21, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 18, 2, 2, 2,
523 2, 2, 2, 2, 20, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 24, 2, 12, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 1, 2, 3
540 };
541
542 #if YYDEBUG
543 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
544 static const yytype_uint16 yyrline[] =
545 {
546 0, 186, 186, 186, 188, 249, 261, 263, 265, 266,
547 267, 269, 270, 272, 273, 274, 275, 276, 277, 278,
548 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
549 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
550 299, 300, 301, 302, 303, 304, 305, 306, 307, 308,
551 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
552 319, 320, 321, 322, 323, 324, 325, 326, 327, 328,
553 329, 330, 331, 332, 333, 334, 335, 336, 337, 338,
554 339, 340, 341, 342, 343, 344, 345, 346, 347, 349
555 };
556 #endif
557
558 #if YYDEBUG || YYERROR_VERBOSE || 0
559 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
560 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
561 static const char *const yytname[] =
562 {
563 "$end", "error", "$undefined", "LEXERLEAF", "'-'", "'>'", "'<'", "'('",
564 "')'", "'\"'", "'\\''", "'$'", "'~'", "'1'", "'6'", "'3'", "'2'", "'&'",
565 "'V'", "'?'", "'^'", "'@'", "'4'", "'5'", "'|'", "'+'", "'*'", "'/'",
566 "'%'", "'!'", "'='", "$accept", "input", "optimization", "template",
567 "expr3", "expr", "expr2", "replacement", YY_NULLPTR
568 };
569 #endif
570
571 # ifdef YYPRINT
572 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
573 (internal) symbol number NUM (which must be that of a token). */
574 static const yytype_uint16 yytoknum[] =
575 {
576 0, 256, 257, 258, 45, 62, 60, 40, 41, 34,
577 39, 36, 126, 49, 54, 51, 50, 38, 86, 63,
578 94, 64, 52, 53, 124, 43, 42, 47, 37, 33,
579 61
580 };
581 # endif
582
583 #define YYPACT_NINF -20
584
585 #define yypact_value_is_default(Yystate) \
586 (!!((Yystate) == (-20)))
587
588 #define YYTABLE_NINF -1
589
590 #define yytable_value_is_error(Yytable_value) \
591 0
592
593 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
594 STATE-NUM. */
595 static const yytype_int16 yypact[] =
596 {
597 -20, 10, -20, -20, 1, 210, 210, 210, -20, 3,
598 -20, 17, -20, -10, -2, 29, 63, 120, 192, 89,
599 -20, 83, 31, 34, 46, 67, 65, 68, 74, 72,
600 77, 87, 81, 101, 102, 105, 106, 115, 25, 125,
601 134, 141, 116, 118, -20, 188, 70, 162, 15, 231,
602 54, 240, -1, 249, 258, 267, 276, 51, 109, -20,
603 -20, -20, 107, -20, 15, 15, 15, 15, 15, 15,
604 15, 15, 15, 15, 15, 152, 132, 15, 153, 139,
605 156, 157, 160, 163, 15, 15, 164, 167, -20, 285,
606 166, 168, -20, 294, 173, 172, -20, -20, 175, 174,
607 -20, 178, 180, 303, -20, 190, 186, -20, 202, 205,
608 312, -20, 204, 207, -20, 211, 208, -20, 212, 216,
609 -20, 219, 220, -20, 321, 330, -20, -20, -20, -20,
610 -20, -20, -20, -20, -20, -20, -20, -20, -20, 15,
611 15, -20, 15, 15, 15, 15, 15, 15, -20, -20,
612 15, 15, 221, 226, -20, 15, 15, 223, 229, -20,
613 15, 15, 15, 15, 15, 15, 234, 235, -20, 15,
614 15, 15, 15, 243, 238, -20, 15, 15, 15, 15,
615 15, 15, 15, 15, 246, 247, -20, 252, 253, -20,
616 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
617 15, 15, -20, -20, 15, 15, -20, -20, -20, -20,
618 -20, -20, 15, 15, -20, -20, -20, -20, 15, 15,
619 -20, -20, -20, -20, -20, -20, -20, -20, 15, 15,
620 15, 15, -20, -20, -20, -20, -20, -20, -20, -20,
621 -20, -20, -20, -20
622 };
623
624 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
625 Performed when YYTABLE does not specify something else to do. Zero
626 means the default is an error. */
627 static const yytype_uint8 yydefact[] =
628 {
629 2, 0, 1, 6, 0, 0, 0, 0, 3, 0,
630 7, 0, 12, 0, 0, 0, 0, 0, 0, 0,
631 11, 88, 0, 0, 0, 0, 0, 0, 0, 0,
632 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
633 0, 0, 0, 0, 85, 0, 0, 0, 0, 0,
634 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
635 9, 10, 0, 5, 0, 0, 0, 0, 0, 0,
636 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
637 0, 0, 0, 0, 0, 0, 0, 0, 47, 0,
638 0, 0, 59, 0, 0, 0, 62, 13, 0, 0,
639 14, 0, 0, 0, 35, 0, 0, 41, 0, 0,
640 0, 38, 0, 0, 44, 0, 0, 50, 0, 0,
641 53, 0, 0, 56, 0, 0, 89, 4, 65, 66,
642 17, 18, 19, 20, 21, 22, 23, 24, 25, 0,
643 0, 30, 0, 0, 0, 0, 0, 0, 86, 87,
644 0, 0, 0, 0, 79, 0, 0, 0, 0, 82,
645 0, 0, 0, 0, 0, 0, 0, 0, 73, 0,
646 0, 0, 0, 0, 0, 76, 0, 0, 0, 0,
647 0, 0, 0, 0, 0, 0, 67, 0, 0, 70,
648 27, 32, 26, 31, 28, 33, 29, 34, 48, 49,
649 0, 0, 60, 61, 0, 0, 63, 64, 15, 16,
650 36, 37, 0, 0, 42, 43, 39, 40, 0, 0,
651 45, 46, 51, 52, 54, 55, 57, 58, 0, 0,
652 0, 0, 80, 81, 83, 84, 74, 75, 77, 78,
653 68, 69, 71, 72
654 };
655
656 /* YYPGOTO[NTERM-NUM]. */
657 static const yytype_int8 yypgoto[] =
658 {
659 -20, -20, -20, -20, 0, -19, 53, -20
660 };
661
662 /* YYDEFGOTO[NTERM-NUM]. */
663 static const yytype_int8 yydefgoto[] =
664 {
665 -1, 1, 8, 9, 20, 21, 22, 127
666 };
667
668 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
669 positive, shift that token. If negative, reduce the rule whose
670 number is the opposite. If YYTABLE_NINF, syntax error. */
671 static const yytype_uint8 yytable[] =
672 {
673 44, 10, 12, 27, 11, 28, 5, 25, 6, 7,
674 2, 29, 108, 30, 109, 3, 4, 5, 12, 6,
675 7, 26, 5, 110, 6, 7, 88, 92, 96, 97,
676 100, 104, 107, 111, 114, 117, 120, 123, 75, 59,
677 76, 77, 31, 60, 32, 128, 129, 130, 131, 132,
678 133, 134, 135, 136, 137, 138, 61, 12, 141, 23,
679 24, 5, 126, 6, 7, 148, 149, 101, 63, 102,
680 154, 103, 62, 12, 159, 89, 33, 5, 34, 6,
681 7, 124, 64, 90, 168, 91, 66, 45, 46, 47,
682 65, 175, 12, 67, 48, 49, 5, 69, 6, 7,
683 50, 68, 42, 51, 43, 186, 189, 52, 53, 54,
684 55, 56, 57, 58, 5, 70, 6, 7, 71, 72,
685 190, 191, 73, 192, 193, 194, 195, 196, 197, 74,
686 84, 198, 199, 35, 85, 36, 202, 203, 78, 125,
687 79, 206, 207, 208, 209, 210, 211, 80, 140, 81,
688 214, 215, 216, 217, 82, 143, 83, 220, 221, 222,
689 223, 224, 225, 226, 227, 12, 139, 142, 93, 5,
690 144, 6, 7, 145, 146, 94, 0, 95, 150, 147,
691 155, 232, 233, 151, 156, 234, 235, 160, 161, 162,
692 163, 12, 164, 236, 237, 5, 165, 6, 7, 238,
693 239, 86, 170, 87, 169, 37, 0, 38, 39, 240,
694 241, 242, 243, 12, 40, 41, 171, 5, 176, 6,
695 7, 172, 13, 177, 179, 178, 180, 14, 15, 16,
696 17, 18, 181, 182, 12, 200, 183, 204, 5, 19,
697 6, 7, 201, 12, 98, 205, 99, 5, 212, 6,
698 7, 213, 12, 105, 219, 106, 5, 218, 6, 7,
699 228, 12, 112, 229, 113, 5, 230, 6, 7, 231,
700 12, 115, 0, 116, 5, 0, 6, 7, 0, 12,
701 118, 0, 119, 5, 0, 6, 7, 0, 12, 121,
702 0, 122, 5, 0, 6, 7, 0, 12, 152, 0,
703 153, 5, 0, 6, 7, 0, 12, 157, 0, 158,
704 5, 0, 6, 7, 0, 12, 166, 0, 167, 5,
705 0, 6, 7, 0, 12, 173, 0, 174, 5, 0,
706 6, 7, 0, 12, 184, 0, 185, 5, 0, 6,
707 7, 0, 0, 187, 0, 188
708 };
709
710 static const yytype_int16 yycheck[] =
711 {
712 19, 1, 3, 13, 3, 15, 7, 4, 9, 10,
713 0, 13, 13, 15, 15, 5, 6, 7, 3, 9,
714 10, 4, 7, 24, 9, 10, 45, 46, 47, 48,
715 49, 50, 51, 52, 53, 54, 55, 56, 13, 8,
716 15, 16, 13, 9, 15, 64, 65, 66, 67, 68,
717 69, 70, 71, 72, 73, 74, 10, 3, 77, 6,
718 7, 7, 62, 9, 10, 84, 85, 13, 3, 15,
719 89, 17, 5, 3, 93, 5, 13, 7, 15, 9,
720 10, 30, 14, 13, 103, 15, 14, 4, 5, 6,
721 16, 110, 3, 16, 11, 12, 7, 16, 9, 10,
722 17, 14, 13, 20, 15, 124, 125, 24, 25, 26,
723 27, 28, 29, 30, 7, 14, 9, 10, 16, 14,
724 139, 140, 16, 142, 143, 144, 145, 146, 147, 14,
725 14, 150, 151, 13, 16, 15, 155, 156, 13, 30,
726 15, 160, 161, 162, 163, 164, 165, 13, 16, 15,
727 169, 170, 171, 172, 13, 16, 15, 176, 177, 178,
728 179, 180, 181, 182, 183, 3, 14, 14, 6, 7,
729 14, 9, 10, 16, 14, 13, -1, 15, 14, 16,
730 14, 200, 201, 16, 16, 204, 205, 14, 16, 14,
731 16, 3, 14, 212, 213, 7, 16, 9, 10, 218,
732 219, 13, 16, 15, 14, 13, -1, 15, 16, 228,
733 229, 230, 231, 3, 22, 23, 14, 7, 14, 9,
734 10, 16, 12, 16, 16, 14, 14, 17, 18, 19,
735 20, 21, 16, 14, 3, 14, 16, 14, 7, 29,
736 9, 10, 16, 3, 13, 16, 15, 7, 14, 9,
737 10, 16, 3, 13, 16, 15, 7, 14, 9, 10,
738 14, 3, 13, 16, 15, 7, 14, 9, 10, 16,
739 3, 13, -1, 15, 7, -1, 9, 10, -1, 3,
740 13, -1, 15, 7, -1, 9, 10, -1, 3, 13,
741 -1, 15, 7, -1, 9, 10, -1, 3, 13, -1,
742 15, 7, -1, 9, 10, -1, 3, 13, -1, 15,
743 7, -1, 9, 10, -1, 3, 13, -1, 15, 7,
744 -1, 9, 10, -1, 3, 13, -1, 15, 7, -1,
745 9, 10, -1, 3, 13, -1, 15, 7, -1, 9,
746 10, -1, -1, 13, -1, 15
747 };
748
749 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
750 symbol of state STATE-NUM. */
751 static const yytype_uint8 yystos[] =
752 {
753 0, 32, 0, 5, 6, 7, 9, 10, 33, 34,
754 35, 3, 3, 12, 17, 18, 19, 20, 21, 29,
755 35, 36, 37, 37, 37, 4, 4, 13, 15, 13,
756 15, 13, 15, 13, 15, 13, 15, 13, 15, 16,
757 22, 23, 13, 15, 36, 4, 5, 6, 11, 12,
758 17, 20, 24, 25, 26, 27, 28, 29, 30, 8,
759 9, 10, 5, 3, 14, 16, 14, 16, 14, 16,
760 14, 16, 14, 16, 14, 13, 15, 16, 13, 15,
761 13, 15, 13, 15, 14, 16, 13, 15, 36, 5,
762 13, 15, 36, 6, 13, 15, 36, 36, 13, 15,
763 36, 13, 15, 17, 36, 13, 15, 36, 13, 15,
764 24, 36, 13, 15, 36, 13, 15, 36, 13, 15,
765 36, 13, 15, 36, 30, 30, 35, 38, 36, 36,
766 36, 36, 36, 36, 36, 36, 36, 36, 36, 14,
767 16, 36, 14, 16, 14, 16, 14, 16, 36, 36,
768 14, 16, 13, 15, 36, 14, 16, 13, 15, 36,
769 14, 16, 14, 16, 14, 16, 13, 15, 36, 14,
770 16, 14, 16, 13, 15, 36, 14, 16, 14, 16,
771 14, 16, 14, 16, 13, 15, 36, 13, 15, 36,
772 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
773 14, 16, 36, 36, 14, 16, 36, 36, 36, 36,
774 36, 36, 14, 16, 36, 36, 36, 36, 14, 16,
775 36, 36, 36, 36, 36, 36, 36, 36, 14, 16,
776 14, 16, 36, 36, 36, 36, 36, 36, 36, 36,
777 36, 36, 36, 36
778 };
779
780 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
781 static const yytype_uint8 yyr1[] =
782 {
783 0, 31, 32, 32, 33, 33, 33, 34, 35, 35,
784 35, 36, 36, 37, 37, 37, 37, 37, 37, 37,
785 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
786 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
787 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
788 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
789 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
790 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
791 37, 37, 37, 37, 37, 37, 37, 37, 37, 38
792 };
793
794 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
795 static const yytype_uint8 yyr2[] =
796 {
797 0, 2, 0, 2, 4, 4, 1, 1, 3, 3,
798 3, 1, 1, 3, 3, 5, 5, 4, 4, 4,
799 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,
800 4, 5, 5, 5, 5, 3, 5, 5, 3, 5,
801 5, 3, 5, 5, 3, 5, 5, 3, 5, 5,
802 3, 5, 5, 3, 5, 5, 3, 5, 5, 3,
803 5, 5, 3, 5, 5, 4, 4, 4, 6, 6,
804 4, 6, 6, 4, 6, 6, 4, 6, 6, 4,
805 6, 6, 4, 6, 6, 2, 4, 4, 1, 1
806 };
807
808
809 #define yyerrok (yyerrstatus = 0)
810 #define yyclearin (yychar = YYEMPTY)
811 #define YYEMPTY (-2)
812 #define YYEOF 0
813
814 #define YYACCEPT goto yyacceptlab
815 #define YYABORT goto yyabortlab
816 #define YYERROR goto yyerrorlab
817
818
819 #define YYRECOVERING() (!!yyerrstatus)
820
821 #define YYBACKUP(Token, Value) \
822 do \
823 if (yychar == YYEMPTY) \
824 { \
825 yychar = (Token); \
826 yylval = (Value); \
827 YYPOPSTACK (yylen); \
828 yystate = *yyssp; \
829 goto yybackup; \
830 } \
831 else \
832 { \
833 yyerror (YY_("syntax error: cannot back up")); \
834 YYERROR; \
835 } \
836 while (0)
837
838 /* Error token number */
839 #define YYTERROR 1
840 #define YYERRCODE 256
841
842
843
844 /* Enable debugging if requested. */
845 #if YYDEBUG
846
847 # ifndef YYFPRINTF
848 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
849 # define YYFPRINTF fprintf
850 # endif
851
852 # define YYDPRINTF(Args) \
853 do { \
854 if (yydebug) \
855 YYFPRINTF Args; \
856 } while (0)
857
858 /* This macro is provided for backward compatibility. */
859 #ifndef YY_LOCATION_PRINT
860 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
861 #endif
862
863
864 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
865 do { \
866 if (yydebug) \
867 { \
868 YYFPRINTF (stderr, "%s ", Title); \
869 yy_symbol_print (stderr, \
870 Type, Value); \
871 YYFPRINTF (stderr, "\n"); \
872 } \
873 } while (0)
874
875
876 /*----------------------------------------.
877 | Print this symbol's value on YYOUTPUT. |
878 `----------------------------------------*/
879
880 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)881 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
882 {
883 FILE *yyo = yyoutput;
884 YYUSE (yyo);
885 if (!yyvaluep)
886 return;
887 # ifdef YYPRINT
888 if (yytype < YYNTOKENS)
889 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
890 # endif
891 YYUSE (yytype);
892 }
893
894
895 /*--------------------------------.
896 | Print this symbol on YYOUTPUT. |
897 `--------------------------------*/
898
899 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)900 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
901 {
902 YYFPRINTF (yyoutput, "%s %s (",
903 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
904
905 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
906 YYFPRINTF (yyoutput, ")");
907 }
908
909 /*------------------------------------------------------------------.
910 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
911 | TOP (included). |
912 `------------------------------------------------------------------*/
913
914 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)915 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
916 {
917 YYFPRINTF (stderr, "Stack now");
918 for (; yybottom <= yytop; yybottom++)
919 {
920 int yybot = *yybottom;
921 YYFPRINTF (stderr, " %d", yybot);
922 }
923 YYFPRINTF (stderr, "\n");
924 }
925
926 # define YY_STACK_PRINT(Bottom, Top) \
927 do { \
928 if (yydebug) \
929 yy_stack_print ((Bottom), (Top)); \
930 } while (0)
931
932
933 /*------------------------------------------------.
934 | Report that the YYRULE is going to be reduced. |
935 `------------------------------------------------*/
936
937 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)938 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
939 {
940 unsigned long int yylno = yyrline[yyrule];
941 int yynrhs = yyr2[yyrule];
942 int yyi;
943 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
944 yyrule - 1, yylno);
945 /* The symbols being reduced. */
946 for (yyi = 0; yyi < yynrhs; yyi++)
947 {
948 YYFPRINTF (stderr, " $%d = ", yyi + 1);
949 yy_symbol_print (stderr,
950 yystos[yyssp[yyi + 1 - yynrhs]],
951 &(yyvsp[(yyi + 1) - (yynrhs)])
952 );
953 YYFPRINTF (stderr, "\n");
954 }
955 }
956
957 # define YY_REDUCE_PRINT(Rule) \
958 do { \
959 if (yydebug) \
960 yy_reduce_print (yyssp, yyvsp, Rule); \
961 } while (0)
962
963 /* Nonzero means print parse trace. It is left uninitialized so that
964 multiple parsers can coexist. */
965 int yydebug;
966 #else /* !YYDEBUG */
967 # define YYDPRINTF(Args)
968 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
969 # define YY_STACK_PRINT(Bottom, Top)
970 # define YY_REDUCE_PRINT(Rule)
971 #endif /* !YYDEBUG */
972
973
974 /* YYINITDEPTH -- initial size of the parser's stacks. */
975 #ifndef YYINITDEPTH
976 # define YYINITDEPTH 200
977 #endif
978
979 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
980 if the built-in stack extension method is used).
981
982 Do not make this value too large; the results are undefined if
983 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
984 evaluated with infinite-precision integer arithmetic. */
985
986 #ifndef YYMAXDEPTH
987 # define YYMAXDEPTH 10000
988 #endif
989
990
991 #if YYERROR_VERBOSE
992
993 # ifndef yystrlen
994 # if defined __GLIBC__ && defined _STRING_H
995 # define yystrlen strlen
996 # else
997 /* Return the length of YYSTR. */
998 static YYSIZE_T
yystrlen(const char * yystr)999 yystrlen (const char *yystr)
1000 {
1001 YYSIZE_T yylen;
1002 for (yylen = 0; yystr[yylen]; yylen++)
1003 continue;
1004 return yylen;
1005 }
1006 # endif
1007 # endif
1008
1009 # ifndef yystpcpy
1010 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1011 # define yystpcpy stpcpy
1012 # else
1013 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1014 YYDEST. */
1015 static char *
yystpcpy(char * yydest,const char * yysrc)1016 yystpcpy (char *yydest, const char *yysrc)
1017 {
1018 char *yyd = yydest;
1019 const char *yys = yysrc;
1020
1021 while ((*yyd++ = *yys++) != '\0')
1022 continue;
1023
1024 return yyd - 1;
1025 }
1026 # endif
1027 # endif
1028
1029 # ifndef yytnamerr
1030 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1031 quotes and backslashes, so that it's suitable for yyerror. The
1032 heuristic is that double-quoting is unnecessary unless the string
1033 contains an apostrophe, a comma, or backslash (other than
1034 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1035 null, do not copy; instead, return the length of what the result
1036 would have been. */
1037 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1038 yytnamerr (char *yyres, const char *yystr)
1039 {
1040 if (*yystr == '"')
1041 {
1042 YYSIZE_T yyn = 0;
1043 char const *yyp = yystr;
1044
1045 for (;;)
1046 switch (*++yyp)
1047 {
1048 case '\'':
1049 case ',':
1050 goto do_not_strip_quotes;
1051
1052 case '\\':
1053 if (*++yyp != '\\')
1054 goto do_not_strip_quotes;
1055 /* Fall through. */
1056 default:
1057 if (yyres)
1058 yyres[yyn] = *yyp;
1059 yyn++;
1060 break;
1061
1062 case '"':
1063 if (yyres)
1064 yyres[yyn] = '\0';
1065 return yyn;
1066 }
1067 do_not_strip_quotes: ;
1068 }
1069
1070 if (! yyres)
1071 return yystrlen (yystr);
1072
1073 return yystpcpy (yyres, yystr) - yyres;
1074 }
1075 # endif
1076
1077 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1078 about the unexpected token YYTOKEN for the state stack whose top is
1079 YYSSP.
1080
1081 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1082 not large enough to hold the message. In that case, also set
1083 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1084 required number of bytes is too large to store. */
1085 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1086 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1087 yytype_int16 *yyssp, int yytoken)
1088 {
1089 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1090 YYSIZE_T yysize = yysize0;
1091 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1092 /* Internationalized format string. */
1093 const char *yyformat = YY_NULLPTR;
1094 /* Arguments of yyformat. */
1095 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1096 /* Number of reported tokens (one for the "unexpected", one per
1097 "expected"). */
1098 int yycount = 0;
1099
1100 /* There are many possibilities here to consider:
1101 - If this state is a consistent state with a default action, then
1102 the only way this function was invoked is if the default action
1103 is an error action. In that case, don't check for expected
1104 tokens because there are none.
1105 - The only way there can be no lookahead present (in yychar) is if
1106 this state is a consistent state with a default action. Thus,
1107 detecting the absence of a lookahead is sufficient to determine
1108 that there is no unexpected or expected token to report. In that
1109 case, just report a simple "syntax error".
1110 - Don't assume there isn't a lookahead just because this state is a
1111 consistent state with a default action. There might have been a
1112 previous inconsistent state, consistent state with a non-default
1113 action, or user semantic action that manipulated yychar.
1114 - Of course, the expected token list depends on states to have
1115 correct lookahead information, and it depends on the parser not
1116 to perform extra reductions after fetching a lookahead from the
1117 scanner and before detecting a syntax error. Thus, state merging
1118 (from LALR or IELR) and default reductions corrupt the expected
1119 token list. However, the list is correct for canonical LR with
1120 one exception: it will still contain any token that will not be
1121 accepted due to an error action in a later state.
1122 */
1123 if (yytoken != YYEMPTY)
1124 {
1125 int yyn = yypact[*yyssp];
1126 yyarg[yycount++] = yytname[yytoken];
1127 if (!yypact_value_is_default (yyn))
1128 {
1129 /* Start YYX at -YYN if negative to avoid negative indexes in
1130 YYCHECK. In other words, skip the first -YYN actions for
1131 this state because they are default actions. */
1132 int yyxbegin = yyn < 0 ? -yyn : 0;
1133 /* Stay within bounds of both yycheck and yytname. */
1134 int yychecklim = YYLAST - yyn + 1;
1135 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1136 int yyx;
1137
1138 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1139 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1140 && !yytable_value_is_error (yytable[yyx + yyn]))
1141 {
1142 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1143 {
1144 yycount = 1;
1145 yysize = yysize0;
1146 break;
1147 }
1148 yyarg[yycount++] = yytname[yyx];
1149 {
1150 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1151 if (! (yysize <= yysize1
1152 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1153 return 2;
1154 yysize = yysize1;
1155 }
1156 }
1157 }
1158 }
1159
1160 switch (yycount)
1161 {
1162 # define YYCASE_(N, S) \
1163 case N: \
1164 yyformat = S; \
1165 break
1166 YYCASE_(0, YY_("syntax error"));
1167 YYCASE_(1, YY_("syntax error, unexpected %s"));
1168 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1169 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1170 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1171 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1172 # undef YYCASE_
1173 }
1174
1175 {
1176 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1177 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1178 return 2;
1179 yysize = yysize1;
1180 }
1181
1182 if (*yymsg_alloc < yysize)
1183 {
1184 *yymsg_alloc = 2 * yysize;
1185 if (! (yysize <= *yymsg_alloc
1186 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1187 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1188 return 1;
1189 }
1190
1191 /* Avoid sprintf, as that infringes on the user's name space.
1192 Don't have undefined behavior even if the translation
1193 produced a string with the wrong number of "%s"s. */
1194 {
1195 char *yyp = *yymsg;
1196 int yyi = 0;
1197 while ((*yyp = *yyformat) != '\0')
1198 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1199 {
1200 yyp += yytnamerr (yyp, yyarg[yyi++]);
1201 yyformat += 2;
1202 }
1203 else
1204 {
1205 yyp++;
1206 yyformat++;
1207 }
1208 }
1209 return 0;
1210 }
1211 #endif /* YYERROR_VERBOSE */
1212
1213 /*-----------------------------------------------.
1214 | Release the memory associated to this symbol. |
1215 `-----------------------------------------------*/
1216
1217 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1218 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1219 {
1220 YYUSE (yyvaluep);
1221 if (!yymsg)
1222 yymsg = "Deleting";
1223 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1224
1225 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1226 YYUSE (yytype);
1227 YY_IGNORE_MAYBE_UNINITIALIZED_END
1228 }
1229
1230
1231
1232
1233 /* The lookahead symbol. */
1234 int yychar;
1235
1236 /* The semantic value of the lookahead symbol. */
1237 YYSTYPE yylval;
1238 /* Number of syntax errors so far. */
1239 int yynerrs;
1240
1241
1242 /*----------.
1243 | yyparse. |
1244 `----------*/
1245
1246 int
yyparse(void)1247 yyparse (void)
1248 {
1249 int yystate;
1250 /* Number of tokens to shift before error messages enabled. */
1251 int yyerrstatus;
1252
1253 /* The stacks and their tools:
1254 'yyss': related to states.
1255 'yyvs': related to semantic values.
1256
1257 Refer to the stacks through separate pointers, to allow yyoverflow
1258 to reallocate them elsewhere. */
1259
1260 /* The state stack. */
1261 yytype_int16 yyssa[YYINITDEPTH];
1262 yytype_int16 *yyss;
1263 yytype_int16 *yyssp;
1264
1265 /* The semantic value stack. */
1266 YYSTYPE yyvsa[YYINITDEPTH];
1267 YYSTYPE *yyvs;
1268 YYSTYPE *yyvsp;
1269
1270 YYSIZE_T yystacksize;
1271
1272 int yyn;
1273 int yyresult;
1274 /* Lookahead token as an internal (translated) token number. */
1275 int yytoken = 0;
1276 /* The variables used to return semantic value and location from the
1277 action routines. */
1278 YYSTYPE yyval;
1279
1280 #if YYERROR_VERBOSE
1281 /* Buffer for error messages, and its allocated size. */
1282 char yymsgbuf[128];
1283 char *yymsg = yymsgbuf;
1284 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1285 #endif
1286
1287 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1288
1289 /* The number of symbols on the RHS of the reduced rule.
1290 Keep to zero when no symbol should be popped. */
1291 int yylen = 0;
1292
1293 yyssp = yyss = yyssa;
1294 yyvsp = yyvs = yyvsa;
1295 yystacksize = YYINITDEPTH;
1296
1297 YYDPRINTF ((stderr, "Starting parse\n"));
1298
1299 yystate = 0;
1300 yyerrstatus = 0;
1301 yynerrs = 0;
1302 yychar = YYEMPTY; /* Cause a token to be read. */
1303 goto yysetstate;
1304
1305 /*------------------------------------------------------------.
1306 | yynewstate -- Push a new state, which is found in yystate. |
1307 `------------------------------------------------------------*/
1308 yynewstate:
1309 /* In all cases, when you get here, the value and location stacks
1310 have just been pushed. So pushing a state here evens the stacks. */
1311 yyssp++;
1312
1313 yysetstate:
1314 *yyssp = yystate;
1315
1316 if (yyss + yystacksize - 1 <= yyssp)
1317 {
1318 /* Get the current used size of the three stacks, in elements. */
1319 YYSIZE_T yysize = yyssp - yyss + 1;
1320
1321 #ifdef yyoverflow
1322 {
1323 /* Give user a chance to reallocate the stack. Use copies of
1324 these so that the &'s don't force the real ones into
1325 memory. */
1326 YYSTYPE *yyvs1 = yyvs;
1327 yytype_int16 *yyss1 = yyss;
1328
1329 /* Each stack pointer address is followed by the size of the
1330 data in use in that stack, in bytes. This used to be a
1331 conditional around just the two extra args, but that might
1332 be undefined if yyoverflow is a macro. */
1333 yyoverflow (YY_("memory exhausted"),
1334 &yyss1, yysize * sizeof (*yyssp),
1335 &yyvs1, yysize * sizeof (*yyvsp),
1336 &yystacksize);
1337
1338 yyss = yyss1;
1339 yyvs = yyvs1;
1340 }
1341 #else /* no yyoverflow */
1342 # ifndef YYSTACK_RELOCATE
1343 goto yyexhaustedlab;
1344 # else
1345 /* Extend the stack our own way. */
1346 if (YYMAXDEPTH <= yystacksize)
1347 goto yyexhaustedlab;
1348 yystacksize *= 2;
1349 if (YYMAXDEPTH < yystacksize)
1350 yystacksize = YYMAXDEPTH;
1351
1352 {
1353 yytype_int16 *yyss1 = yyss;
1354 union yyalloc *yyptr =
1355 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1356 if (! yyptr)
1357 goto yyexhaustedlab;
1358 YYSTACK_RELOCATE (yyss_alloc, yyss);
1359 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1360 # undef YYSTACK_RELOCATE
1361 if (yyss1 != yyssa)
1362 YYSTACK_FREE (yyss1);
1363 }
1364 # endif
1365 #endif /* no yyoverflow */
1366
1367 yyssp = yyss + yysize - 1;
1368 yyvsp = yyvs + yysize - 1;
1369
1370 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1371 (unsigned long int) yystacksize));
1372
1373 if (yyss + yystacksize - 1 <= yyssp)
1374 YYABORT;
1375 }
1376
1377 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1378
1379 if (yystate == YYFINAL)
1380 YYACCEPT;
1381
1382 goto yybackup;
1383
1384 /*-----------.
1385 | yybackup. |
1386 `-----------*/
1387 yybackup:
1388
1389 /* Do appropriate processing given the current state. Read a
1390 lookahead token if we need one and don't already have one. */
1391
1392 /* First try to decide what to do without reference to lookahead token. */
1393 yyn = yypact[yystate];
1394 if (yypact_value_is_default (yyn))
1395 goto yydefault;
1396
1397 /* Not known => get a lookahead token if don't already have one. */
1398
1399 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1400 if (yychar == YYEMPTY)
1401 {
1402 YYDPRINTF ((stderr, "Reading a token: "));
1403 yychar = yylex ();
1404 }
1405
1406 if (yychar <= YYEOF)
1407 {
1408 yychar = yytoken = YYEOF;
1409 YYDPRINTF ((stderr, "Now at end of input.\n"));
1410 }
1411 else
1412 {
1413 yytoken = YYTRANSLATE (yychar);
1414 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1415 }
1416
1417 /* If the proper action on seeing token YYTOKEN is to reduce or to
1418 detect an error, take that action. */
1419 yyn += yytoken;
1420 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1421 goto yydefault;
1422 yyn = yytable[yyn];
1423 if (yyn <= 0)
1424 {
1425 if (yytable_value_is_error (yyn))
1426 goto yyerrlab;
1427 yyn = -yyn;
1428 goto yyreduce;
1429 }
1430
1431 /* Count tokens shifted since error; after three, turn off error
1432 status. */
1433 if (yyerrstatus)
1434 yyerrstatus--;
1435
1436 /* Shift the lookahead token. */
1437 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1438
1439 /* Discard the shifted token. */
1440 yychar = YYEMPTY;
1441
1442 yystate = yyn;
1443 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1444 *++yyvsp = yylval;
1445 YY_IGNORE_MAYBE_UNINITIALIZED_END
1446
1447 goto yynewstate;
1448
1449
1450 /*-----------------------------------------------------------.
1451 | yydefault -- do the default action for the current state. |
1452 `-----------------------------------------------------------*/
1453 yydefault:
1454 yyn = yydefact[yystate];
1455 if (yyn == 0)
1456 goto yyerrlab;
1457 goto yyreduce;
1458
1459
1460 /*-----------------------------.
1461 | yyreduce -- Do a reduction. |
1462 `-----------------------------*/
1463 yyreduce:
1464 /* yyn is the number of a rule to reduce with. */
1465 yylen = yyr2[yyn];
1466
1467 /* If YYLEN is nonzero, implement the default value of the action:
1468 '$$ = $1'.
1469
1470 Otherwise, the following line sets YYVAL to garbage.
1471 This behavior is undocumented and Bison
1472 users should not rely upon it. Assigning to YYVAL
1473 unconditionally makes the parser a bit smaller, and it avoids a
1474 GCC warning that YYVAL may be used uninitialized. */
1475 yyval = yyvsp[1-yylen];
1476
1477
1478 YY_REDUCE_PRINT (yyn);
1479 switch (yyn)
1480 {
1481 case 4:
1482 #line 189 "oil.y" /* yacc.c:1646 */
1483 {
1484 static YYSTYPE tempmem[10];
1485 static int replcount[10];
1486 /* Handle splitting the file. */
1487 if(splitcount) splitcount--;
1488 if(!splitcount && !inloop)
1489 {
1490 splitcount=SPLITMAX;
1491 splitend();
1492 ++filenumber;
1493 splitstart();
1494 }
1495 /* This is where we actually generate the optimizer code. */
1496 /* Tree-shape and is-constant conditions */
1497 printf(" checknodeactbits(np);\n");
1498 if(treeshapecond((yyvsp[-3]),1)) printf(" if(1"); printf(")\n do\n {\n");
1499 /* Nodesame and cxdata conditions */
1500 {
1501 int i=10;
1502 YYSTYPE temp;
1503 while(--i)
1504 {
1505 temp=treenscheck((yyvsp[-3]),0,i);
1506 if(temp)
1507 {
1508 printf(" x%d=np",i);
1509 gennodepath(temp->depth,temp->path);
1510 printf("->constant; c%d=np",i);
1511 gennodepath(temp->depth,temp->path);
1512 printf("->optdata;\n");
1513 }
1514 tempmem[i]=temp;
1515 replcount[i]=0; /* we need to zero this somewhere, may as well be here */
1516 }
1517 treecxcond((yyvsp[-3]));
1518 }
1519 /* If we reach this point in the generated code, we have an optimizer
1520 template match. */
1521 printf(" OPTING(%s_%d);\n",optname,++optnumber);
1522
1523 /* We now need to replace np with its replacement. This is done by creating
1524 a new nodetree, copying across tempmem'd nodes where necessary, and then
1525 substituting one for the other. (This is an inefficient but general way
1526 to do this.) One special case is needed; because pointers into the root
1527 node need to continue pointing there, the temporary node tp is copied
1528 member-for-member and then freed again. The root width can change (this
1529 is a deviation from previous code), in order to prevent a bug where the
1530 new root happens to be a unary. (This means we can get a 16-bit unary
1531 applied to 32-bit data; but the optimiser is meant to ensure that this is
1532 not problematic.) */
1533 printf(" tp=newnode();\n");
1534 treerepcount((yyvsp[0]),replcount);
1535 treerepgen((yyvsp[0]),tempmem,replcount);
1536 printf(" nodefree(np->lval); nodefree(np->rval);\n");
1537 printf(" *np=*tp; free(tp);\n");
1538 printf(" } while(0);\n\n");
1539 /* Free the template and replacement now they're finished being used. */
1540 treefree((yyvsp[-3]));
1541 treefree((yyvsp[0]));
1542 }
1543 #line 1544 "src/oil-oil.c" /* yacc.c:1646 */
1544 break;
1545
1546 case 5:
1547 #line 250 "oil.y" /* yacc.c:1646 */
1548 {
1549 if(!(yyvsp[-2])->mustbemesh||!(yyvsp[0])->mustbemesh)
1550 {
1551 yyerror("syntax error in <#..#()->()> construct");
1552 free((yyvsp[-2])); free((yyvsp[0]));
1553 YYERROR;
1554 }
1555 printf(" r=%luLU; while(r<=%luLU) {\n",(yyvsp[-2])->c,(yyvsp[0])->c);
1556 free((yyvsp[-2])); free((yyvsp[0]));
1557 inloop=1;
1558 }
1559 #line 1560 "src/oil-oil.c" /* yacc.c:1646 */
1560 break;
1561
1562 case 6:
1563 #line 261 "oil.y" /* yacc.c:1646 */
1564 {printf(" r++;\n }\n"); inloop=0;}
1565 #line 1566 "src/oil-oil.c" /* yacc.c:1646 */
1566 break;
1567
1568 case 8:
1569 #line 265 "oil.y" /* yacc.c:1646 */
1570 {(yyval)=(yyvsp[-1]);}
1571 #line 1572 "src/oil-oil.c" /* yacc.c:1646 */
1572 break;
1573
1574 case 9:
1575 #line 266 "oil.y" /* yacc.c:1646 */
1576 {(yyval)=(yyvsp[-1]);}
1577 #line 1578 "src/oil-oil.c" /* yacc.c:1646 */
1578 break;
1579
1580 case 10:
1581 #line 267 "oil.y" /* yacc.c:1646 */
1582 {(yyval)=(yyvsp[-1]);}
1583 #line 1584 "src/oil-oil.c" /* yacc.c:1646 */
1584 break;
1585
1586 case 13:
1587 #line 272 "oil.y" /* yacc.c:1646 */
1588 {BINARYEXPR("MINGLE",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1589 #line 1590 "src/oil-oil.c" /* yacc.c:1646 */
1590 break;
1591
1592 case 14:
1593 #line 273 "oil.y" /* yacc.c:1646 */
1594 {BINARYEXPR("SELECT",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1595 #line 1596 "src/oil-oil.c" /* yacc.c:1646 */
1596 break;
1597
1598 case 15:
1599 #line 274 "oil.y" /* yacc.c:1646 */
1600 {BINARYEXPR("SELECT",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1601 #line 1602 "src/oil-oil.c" /* yacc.c:1646 */
1602 break;
1603
1604 case 16:
1605 #line 275 "oil.y" /* yacc.c:1646 */
1606 {BINARYEXPR("SELECT",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1607 #line 1608 "src/oil-oil.c" /* yacc.c:1646 */
1608 break;
1609
1610 case 17:
1611 #line 276 "oil.y" /* yacc.c:1646 */
1612 {UNARYEXPR("AND",(yyval),(yyvsp[0]),0,1);}
1613 #line 1614 "src/oil-oil.c" /* yacc.c:1646 */
1614 break;
1615
1616 case 18:
1617 #line 277 "oil.y" /* yacc.c:1646 */
1618 {UNARYEXPR("AND",(yyval),(yyvsp[0]),1,1);}
1619 #line 1620 "src/oil-oil.c" /* yacc.c:1646 */
1620 break;
1621
1622 case 19:
1623 #line 278 "oil.y" /* yacc.c:1646 */
1624 {UNARYEXPR("OR",(yyval),(yyvsp[0]),0,1);}
1625 #line 1626 "src/oil-oil.c" /* yacc.c:1646 */
1626 break;
1627
1628 case 20:
1629 #line 279 "oil.y" /* yacc.c:1646 */
1630 {UNARYEXPR("OR",(yyval),(yyvsp[0]),1,1);}
1631 #line 1632 "src/oil-oil.c" /* yacc.c:1646 */
1632 break;
1633
1634 case 21:
1635 #line 280 "oil.y" /* yacc.c:1646 */
1636 {UNARYEXPR("XOR",(yyval),(yyvsp[0]),0,1);}
1637 #line 1638 "src/oil-oil.c" /* yacc.c:1646 */
1638 break;
1639
1640 case 22:
1641 #line 281 "oil.y" /* yacc.c:1646 */
1642 {UNARYEXPR("XOR",(yyval),(yyvsp[0]),1,1);}
1643 #line 1644 "src/oil-oil.c" /* yacc.c:1646 */
1644 break;
1645
1646 case 23:
1647 #line 282 "oil.y" /* yacc.c:1646 */
1648 {UNARYEXPR("FIN",(yyval),(yyvsp[0]),0,1);}
1649 #line 1650 "src/oil-oil.c" /* yacc.c:1646 */
1650 break;
1651
1652 case 24:
1653 #line 283 "oil.y" /* yacc.c:1646 */
1654 {UNARYEXPR("FIN",(yyval),(yyvsp[0]),1,1);}
1655 #line 1656 "src/oil-oil.c" /* yacc.c:1646 */
1656 break;
1657
1658 case 25:
1659 #line 284 "oil.y" /* yacc.c:1646 */
1660 {UNARYEXPR("WHIRL",(yyval),(yyvsp[0]),0,1);}
1661 #line 1662 "src/oil-oil.c" /* yacc.c:1646 */
1662 break;
1663
1664 case 26:
1665 #line 285 "oil.y" /* yacc.c:1646 */
1666 {UNARYEXPR("WHIRL2",(yyval),(yyvsp[0]),0,1);}
1667 #line 1668 "src/oil-oil.c" /* yacc.c:1646 */
1668 break;
1669
1670 case 27:
1671 #line 286 "oil.y" /* yacc.c:1646 */
1672 {UNARYEXPR("WHIRL3",(yyval),(yyvsp[0]),0,1);}
1673 #line 1674 "src/oil-oil.c" /* yacc.c:1646 */
1674 break;
1675
1676 case 28:
1677 #line 287 "oil.y" /* yacc.c:1646 */
1678 {UNARYEXPR("WHIRL4",(yyval),(yyvsp[0]),0,1);}
1679 #line 1680 "src/oil-oil.c" /* yacc.c:1646 */
1680 break;
1681
1682 case 29:
1683 #line 288 "oil.y" /* yacc.c:1646 */
1684 {UNARYEXPR("WHIRL5",(yyval),(yyvsp[0]),0,1);}
1685 #line 1686 "src/oil-oil.c" /* yacc.c:1646 */
1686 break;
1687
1688 case 30:
1689 #line 289 "oil.y" /* yacc.c:1646 */
1690 {UNARYEXPR("WHIRL",(yyval),(yyvsp[0]),1,1);}
1691 #line 1692 "src/oil-oil.c" /* yacc.c:1646 */
1692 break;
1693
1694 case 31:
1695 #line 290 "oil.y" /* yacc.c:1646 */
1696 {UNARYEXPR("WHIRL2",(yyval),(yyvsp[0]),1,1);}
1697 #line 1698 "src/oil-oil.c" /* yacc.c:1646 */
1698 break;
1699
1700 case 32:
1701 #line 291 "oil.y" /* yacc.c:1646 */
1702 {UNARYEXPR("WHIRL3",(yyval),(yyvsp[0]),1,1);}
1703 #line 1704 "src/oil-oil.c" /* yacc.c:1646 */
1704 break;
1705
1706 case 33:
1707 #line 292 "oil.y" /* yacc.c:1646 */
1708 {UNARYEXPR("WHIRL4",(yyval),(yyvsp[0]),1,1);}
1709 #line 1710 "src/oil-oil.c" /* yacc.c:1646 */
1710 break;
1711
1712 case 34:
1713 #line 293 "oil.y" /* yacc.c:1646 */
1714 {UNARYEXPR("WHIRL5",(yyval),(yyvsp[0]),1,1);}
1715 #line 1716 "src/oil-oil.c" /* yacc.c:1646 */
1716 break;
1717
1718 case 35:
1719 #line 294 "oil.y" /* yacc.c:1646 */
1720 {BINARYEXPR("C_AND",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1721 #line 1722 "src/oil-oil.c" /* yacc.c:1646 */
1722 break;
1723
1724 case 36:
1725 #line 295 "oil.y" /* yacc.c:1646 */
1726 {BINARYEXPR("C_AND",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1727 #line 1728 "src/oil-oil.c" /* yacc.c:1646 */
1728 break;
1729
1730 case 37:
1731 #line 296 "oil.y" /* yacc.c:1646 */
1732 {BINARYEXPR("C_AND",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1733 #line 1734 "src/oil-oil.c" /* yacc.c:1646 */
1734 break;
1735
1736 case 38:
1737 #line 297 "oil.y" /* yacc.c:1646 */
1738 {BINARYEXPR("C_OR",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1739 #line 1740 "src/oil-oil.c" /* yacc.c:1646 */
1740 break;
1741
1742 case 39:
1743 #line 298 "oil.y" /* yacc.c:1646 */
1744 {BINARYEXPR("C_OR",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1745 #line 1746 "src/oil-oil.c" /* yacc.c:1646 */
1746 break;
1747
1748 case 40:
1749 #line 299 "oil.y" /* yacc.c:1646 */
1750 {BINARYEXPR("C_OR",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1751 #line 1752 "src/oil-oil.c" /* yacc.c:1646 */
1752 break;
1753
1754 case 41:
1755 #line 300 "oil.y" /* yacc.c:1646 */
1756 {BINARYEXPR("C_XOR",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1757 #line 1758 "src/oil-oil.c" /* yacc.c:1646 */
1758 break;
1759
1760 case 42:
1761 #line 301 "oil.y" /* yacc.c:1646 */
1762 {BINARYEXPR("C_XOR",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1763 #line 1764 "src/oil-oil.c" /* yacc.c:1646 */
1764 break;
1765
1766 case 43:
1767 #line 302 "oil.y" /* yacc.c:1646 */
1768 {BINARYEXPR("C_XOR",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1769 #line 1770 "src/oil-oil.c" /* yacc.c:1646 */
1770 break;
1771
1772 case 44:
1773 #line 303 "oil.y" /* yacc.c:1646 */
1774 {BINARYEXPR("C_PLUS",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1775 #line 1776 "src/oil-oil.c" /* yacc.c:1646 */
1776 break;
1777
1778 case 45:
1779 #line 304 "oil.y" /* yacc.c:1646 */
1780 {BINARYEXPR("C_PLUS",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1781 #line 1782 "src/oil-oil.c" /* yacc.c:1646 */
1782 break;
1783
1784 case 46:
1785 #line 305 "oil.y" /* yacc.c:1646 */
1786 {BINARYEXPR("C_PLUS",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1787 #line 1788 "src/oil-oil.c" /* yacc.c:1646 */
1788 break;
1789
1790 case 47:
1791 #line 306 "oil.y" /* yacc.c:1646 */
1792 {BINARYEXPR("C_MINUS",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1793 #line 1794 "src/oil-oil.c" /* yacc.c:1646 */
1794 break;
1795
1796 case 48:
1797 #line 307 "oil.y" /* yacc.c:1646 */
1798 {BINARYEXPR("C_MINUS",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1799 #line 1800 "src/oil-oil.c" /* yacc.c:1646 */
1800 break;
1801
1802 case 49:
1803 #line 308 "oil.y" /* yacc.c:1646 */
1804 {BINARYEXPR("C_MINUS",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1805 #line 1806 "src/oil-oil.c" /* yacc.c:1646 */
1806 break;
1807
1808 case 50:
1809 #line 309 "oil.y" /* yacc.c:1646 */
1810 {BINARYEXPR("C_TIMES",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1811 #line 1812 "src/oil-oil.c" /* yacc.c:1646 */
1812 break;
1813
1814 case 51:
1815 #line 310 "oil.y" /* yacc.c:1646 */
1816 {BINARYEXPR("C_TIMES",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1817 #line 1818 "src/oil-oil.c" /* yacc.c:1646 */
1818 break;
1819
1820 case 52:
1821 #line 311 "oil.y" /* yacc.c:1646 */
1822 {BINARYEXPR("C_TIMES",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1823 #line 1824 "src/oil-oil.c" /* yacc.c:1646 */
1824 break;
1825
1826 case 53:
1827 #line 312 "oil.y" /* yacc.c:1646 */
1828 {BINARYEXPR("C_DIVIDEBY",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1829 #line 1830 "src/oil-oil.c" /* yacc.c:1646 */
1830 break;
1831
1832 case 54:
1833 #line 313 "oil.y" /* yacc.c:1646 */
1834 {BINARYEXPR("C_DIVIDEBY",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1835 #line 1836 "src/oil-oil.c" /* yacc.c:1646 */
1836 break;
1837
1838 case 55:
1839 #line 314 "oil.y" /* yacc.c:1646 */
1840 {BINARYEXPR("C_DIVIDEBY",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1841 #line 1842 "src/oil-oil.c" /* yacc.c:1646 */
1842 break;
1843
1844 case 56:
1845 #line 315 "oil.y" /* yacc.c:1646 */
1846 {BINARYEXPR("C_MODULUS",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1847 #line 1848 "src/oil-oil.c" /* yacc.c:1646 */
1848 break;
1849
1850 case 57:
1851 #line 316 "oil.y" /* yacc.c:1646 */
1852 {BINARYEXPR("C_MODULUS",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1853 #line 1854 "src/oil-oil.c" /* yacc.c:1646 */
1854 break;
1855
1856 case 58:
1857 #line 317 "oil.y" /* yacc.c:1646 */
1858 {BINARYEXPR("C_MODULUS",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1859 #line 1860 "src/oil-oil.c" /* yacc.c:1646 */
1860 break;
1861
1862 case 59:
1863 #line 318 "oil.y" /* yacc.c:1646 */
1864 {BINARYEXPR("C_GREATER",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1865 #line 1866 "src/oil-oil.c" /* yacc.c:1646 */
1866 break;
1867
1868 case 60:
1869 #line 319 "oil.y" /* yacc.c:1646 */
1870 {BINARYEXPR("C_GREATER",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1871 #line 1872 "src/oil-oil.c" /* yacc.c:1646 */
1872 break;
1873
1874 case 61:
1875 #line 320 "oil.y" /* yacc.c:1646 */
1876 {BINARYEXPR("C_GREATER",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1877 #line 1878 "src/oil-oil.c" /* yacc.c:1646 */
1878 break;
1879
1880 case 62:
1881 #line 321 "oil.y" /* yacc.c:1646 */
1882 {BINARYEXPR("C_LESS",(yyval),(yyvsp[-2]),(yyvsp[0]),1);}
1883 #line 1884 "src/oil-oil.c" /* yacc.c:1646 */
1884 break;
1885
1886 case 63:
1887 #line 322 "oil.y" /* yacc.c:1646 */
1888 {BINARYEXPR("C_LESS",(yyval),(yyvsp[-4]),(yyvsp[0]),0);}
1889 #line 1890 "src/oil-oil.c" /* yacc.c:1646 */
1890 break;
1891
1892 case 64:
1893 #line 323 "oil.y" /* yacc.c:1646 */
1894 {BINARYEXPR("C_LESS",(yyval),(yyvsp[-4]),(yyvsp[0]),1);}
1895 #line 1896 "src/oil-oil.c" /* yacc.c:1646 */
1896 break;
1897
1898 case 65:
1899 #line 324 "oil.y" /* yacc.c:1646 */
1900 {UNARYEXPR("C_NOT",(yyval),(yyvsp[0]),0,1);}
1901 #line 1902 "src/oil-oil.c" /* yacc.c:1646 */
1902 break;
1903
1904 case 66:
1905 #line 325 "oil.y" /* yacc.c:1646 */
1906 {UNARYEXPR("C_NOT",(yyval),(yyvsp[0]),1,1);}
1907 #line 1908 "src/oil-oil.c" /* yacc.c:1646 */
1908 break;
1909
1910 case 67:
1911 #line 326 "oil.y" /* yacc.c:1646 */
1912 {BINARYEXPR("C_NOTEQUAL",(yyval),(yyvsp[-3]),(yyvsp[0]),0);}
1913 #line 1914 "src/oil-oil.c" /* yacc.c:1646 */
1914 break;
1915
1916 case 68:
1917 #line 327 "oil.y" /* yacc.c:1646 */
1918 {BINARYEXPR("C_NOTEQUAL",(yyval),(yyvsp[-5]),(yyvsp[0]),0);}
1919 #line 1920 "src/oil-oil.c" /* yacc.c:1646 */
1920 break;
1921
1922 case 69:
1923 #line 328 "oil.y" /* yacc.c:1646 */
1924 {BINARYEXPR("C_NOTEQUAL",(yyval),(yyvsp[-5]),(yyvsp[0]),1);}
1925 #line 1926 "src/oil-oil.c" /* yacc.c:1646 */
1926 break;
1927
1928 case 70:
1929 #line 329 "oil.y" /* yacc.c:1646 */
1930 {BINARYEXPR("C_ISEQUAL",(yyval),(yyvsp[-3]),(yyvsp[0]),0);}
1931 #line 1932 "src/oil-oil.c" /* yacc.c:1646 */
1932 break;
1933
1934 case 71:
1935 #line 330 "oil.y" /* yacc.c:1646 */
1936 {BINARYEXPR("C_ISEQUAL",(yyval),(yyvsp[-5]),(yyvsp[0]),0);}
1937 #line 1938 "src/oil-oil.c" /* yacc.c:1646 */
1938 break;
1939
1940 case 72:
1941 #line 331 "oil.y" /* yacc.c:1646 */
1942 {BINARYEXPR("C_ISEQUAL",(yyval),(yyvsp[-5]),(yyvsp[0]),1);}
1943 #line 1944 "src/oil-oil.c" /* yacc.c:1646 */
1944 break;
1945
1946 case 73:
1947 #line 332 "oil.y" /* yacc.c:1646 */
1948 {BINARYEXPR("C_LOGICALAND",(yyval),(yyvsp[-3]),(yyvsp[0]),0);}
1949 #line 1950 "src/oil-oil.c" /* yacc.c:1646 */
1950 break;
1951
1952 case 74:
1953 #line 333 "oil.y" /* yacc.c:1646 */
1954 {BINARYEXPR("C_LOGICALAND",(yyval),(yyvsp[-5]),(yyvsp[0]),0);}
1955 #line 1956 "src/oil-oil.c" /* yacc.c:1646 */
1956 break;
1957
1958 case 75:
1959 #line 334 "oil.y" /* yacc.c:1646 */
1960 {BINARYEXPR("C_LOGICALAND",(yyval),(yyvsp[-5]),(yyvsp[0]),1);}
1961 #line 1962 "src/oil-oil.c" /* yacc.c:1646 */
1962 break;
1963
1964 case 76:
1965 #line 335 "oil.y" /* yacc.c:1646 */
1966 {BINARYEXPR("C_LOGICALOR",(yyval),(yyvsp[-3]),(yyvsp[0]),0);}
1967 #line 1968 "src/oil-oil.c" /* yacc.c:1646 */
1968 break;
1969
1970 case 77:
1971 #line 336 "oil.y" /* yacc.c:1646 */
1972 {BINARYEXPR("C_LOGICALOR",(yyval),(yyvsp[-5]),(yyvsp[0]),0);}
1973 #line 1974 "src/oil-oil.c" /* yacc.c:1646 */
1974 break;
1975
1976 case 78:
1977 #line 337 "oil.y" /* yacc.c:1646 */
1978 {BINARYEXPR("C_LOGICALOR",(yyval),(yyvsp[-5]),(yyvsp[0]),1);}
1979 #line 1980 "src/oil-oil.c" /* yacc.c:1646 */
1980 break;
1981
1982 case 79:
1983 #line 338 "oil.y" /* yacc.c:1646 */
1984 {BINARYEXPR("C_RSHIFTBY",(yyval),(yyvsp[-3]),(yyvsp[0]),1);}
1985 #line 1986 "src/oil-oil.c" /* yacc.c:1646 */
1986 break;
1987
1988 case 80:
1989 #line 339 "oil.y" /* yacc.c:1646 */
1990 {BINARYEXPR("C_RSHIFTBY",(yyval),(yyvsp[-5]),(yyvsp[0]),0);}
1991 #line 1992 "src/oil-oil.c" /* yacc.c:1646 */
1992 break;
1993
1994 case 81:
1995 #line 340 "oil.y" /* yacc.c:1646 */
1996 {BINARYEXPR("C_RSHIFTBY",(yyval),(yyvsp[-5]),(yyvsp[0]),1);}
1997 #line 1998 "src/oil-oil.c" /* yacc.c:1646 */
1998 break;
1999
2000 case 82:
2001 #line 341 "oil.y" /* yacc.c:1646 */
2002 {BINARYEXPR("C_LSHIFTBY",(yyval),(yyvsp[-3]),(yyvsp[0]),1);}
2003 #line 2004 "src/oil-oil.c" /* yacc.c:1646 */
2004 break;
2005
2006 case 83:
2007 #line 342 "oil.y" /* yacc.c:1646 */
2008 {BINARYEXPR("C_LSHIFTBY",(yyval),(yyvsp[-5]),(yyvsp[0]),0);}
2009 #line 2010 "src/oil-oil.c" /* yacc.c:1646 */
2010 break;
2011
2012 case 84:
2013 #line 343 "oil.y" /* yacc.c:1646 */
2014 {BINARYEXPR("C_LSHIFTBY",(yyval),(yyvsp[-5]),(yyvsp[0]),1);}
2015 #line 2016 "src/oil-oil.c" /* yacc.c:1646 */
2016 break;
2017
2018 case 85:
2019 #line 344 "oil.y" /* yacc.c:1646 */
2020 {UNARYEXPR("C_LOGICALNOT",(yyval),(yyvsp[0]),0,0);}
2021 #line 2022 "src/oil-oil.c" /* yacc.c:1646 */
2022 break;
2023
2024 case 86:
2025 #line 345 "oil.y" /* yacc.c:1646 */
2026 {UNARYEXPR("C_LOGICALNOT",(yyval),(yyvsp[0]),0,0);}
2027 #line 2028 "src/oil-oil.c" /* yacc.c:1646 */
2028 break;
2029
2030 case 87:
2031 #line 346 "oil.y" /* yacc.c:1646 */
2032 {UNARYEXPR("C_LOGICALNOT",(yyval),(yyvsp[0]),1,0);}
2033 #line 2034 "src/oil-oil.c" /* yacc.c:1646 */
2034 break;
2035
2036
2037 #line 2038 "src/oil-oil.c" /* yacc.c:1646 */
2038 default: break;
2039 }
2040 /* User semantic actions sometimes alter yychar, and that requires
2041 that yytoken be updated with the new translation. We take the
2042 approach of translating immediately before every use of yytoken.
2043 One alternative is translating here after every semantic action,
2044 but that translation would be missed if the semantic action invokes
2045 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2046 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2047 incorrect destructor might then be invoked immediately. In the
2048 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2049 to an incorrect destructor call or verbose syntax error message
2050 before the lookahead is translated. */
2051 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2052
2053 YYPOPSTACK (yylen);
2054 yylen = 0;
2055 YY_STACK_PRINT (yyss, yyssp);
2056
2057 *++yyvsp = yyval;
2058
2059 /* Now 'shift' the result of the reduction. Determine what state
2060 that goes to, based on the state we popped back to and the rule
2061 number reduced by. */
2062
2063 yyn = yyr1[yyn];
2064
2065 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2066 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2067 yystate = yytable[yystate];
2068 else
2069 yystate = yydefgoto[yyn - YYNTOKENS];
2070
2071 goto yynewstate;
2072
2073
2074 /*--------------------------------------.
2075 | yyerrlab -- here on detecting error. |
2076 `--------------------------------------*/
2077 yyerrlab:
2078 /* Make sure we have latest lookahead translation. See comments at
2079 user semantic actions for why this is necessary. */
2080 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2081
2082 /* If not already recovering from an error, report this error. */
2083 if (!yyerrstatus)
2084 {
2085 ++yynerrs;
2086 #if ! YYERROR_VERBOSE
2087 yyerror (YY_("syntax error"));
2088 #else
2089 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2090 yyssp, yytoken)
2091 {
2092 char const *yymsgp = YY_("syntax error");
2093 int yysyntax_error_status;
2094 yysyntax_error_status = YYSYNTAX_ERROR;
2095 if (yysyntax_error_status == 0)
2096 yymsgp = yymsg;
2097 else if (yysyntax_error_status == 1)
2098 {
2099 if (yymsg != yymsgbuf)
2100 YYSTACK_FREE (yymsg);
2101 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2102 if (!yymsg)
2103 {
2104 yymsg = yymsgbuf;
2105 yymsg_alloc = sizeof yymsgbuf;
2106 yysyntax_error_status = 2;
2107 }
2108 else
2109 {
2110 yysyntax_error_status = YYSYNTAX_ERROR;
2111 yymsgp = yymsg;
2112 }
2113 }
2114 yyerror (yymsgp);
2115 if (yysyntax_error_status == 2)
2116 goto yyexhaustedlab;
2117 }
2118 # undef YYSYNTAX_ERROR
2119 #endif
2120 }
2121
2122
2123
2124 if (yyerrstatus == 3)
2125 {
2126 /* If just tried and failed to reuse lookahead token after an
2127 error, discard it. */
2128
2129 if (yychar <= YYEOF)
2130 {
2131 /* Return failure if at end of input. */
2132 if (yychar == YYEOF)
2133 YYABORT;
2134 }
2135 else
2136 {
2137 yydestruct ("Error: discarding",
2138 yytoken, &yylval);
2139 yychar = YYEMPTY;
2140 }
2141 }
2142
2143 /* Else will try to reuse lookahead token after shifting the error
2144 token. */
2145 goto yyerrlab1;
2146
2147
2148 /*---------------------------------------------------.
2149 | yyerrorlab -- error raised explicitly by YYERROR. |
2150 `---------------------------------------------------*/
2151 yyerrorlab:
2152
2153 /* Pacify compilers like GCC when the user code never invokes
2154 YYERROR and the label yyerrorlab therefore never appears in user
2155 code. */
2156 if (/*CONSTCOND*/ 0)
2157 goto yyerrorlab;
2158
2159 /* Do not reclaim the symbols of the rule whose action triggered
2160 this YYERROR. */
2161 YYPOPSTACK (yylen);
2162 yylen = 0;
2163 YY_STACK_PRINT (yyss, yyssp);
2164 yystate = *yyssp;
2165 goto yyerrlab1;
2166
2167
2168 /*-------------------------------------------------------------.
2169 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2170 `-------------------------------------------------------------*/
2171 yyerrlab1:
2172 yyerrstatus = 3; /* Each real token shifted decrements this. */
2173
2174 for (;;)
2175 {
2176 yyn = yypact[yystate];
2177 if (!yypact_value_is_default (yyn))
2178 {
2179 yyn += YYTERROR;
2180 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2181 {
2182 yyn = yytable[yyn];
2183 if (0 < yyn)
2184 break;
2185 }
2186 }
2187
2188 /* Pop the current state because it cannot handle the error token. */
2189 if (yyssp == yyss)
2190 YYABORT;
2191
2192
2193 yydestruct ("Error: popping",
2194 yystos[yystate], yyvsp);
2195 YYPOPSTACK (1);
2196 yystate = *yyssp;
2197 YY_STACK_PRINT (yyss, yyssp);
2198 }
2199
2200 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2201 *++yyvsp = yylval;
2202 YY_IGNORE_MAYBE_UNINITIALIZED_END
2203
2204
2205 /* Shift the error token. */
2206 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2207
2208 yystate = yyn;
2209 goto yynewstate;
2210
2211
2212 /*-------------------------------------.
2213 | yyacceptlab -- YYACCEPT comes here. |
2214 `-------------------------------------*/
2215 yyacceptlab:
2216 yyresult = 0;
2217 goto yyreturn;
2218
2219 /*-----------------------------------.
2220 | yyabortlab -- YYABORT comes here. |
2221 `-----------------------------------*/
2222 yyabortlab:
2223 yyresult = 1;
2224 goto yyreturn;
2225
2226 #if !defined yyoverflow || YYERROR_VERBOSE
2227 /*-------------------------------------------------.
2228 | yyexhaustedlab -- memory exhaustion comes here. |
2229 `-------------------------------------------------*/
2230 yyexhaustedlab:
2231 yyerror (YY_("memory exhausted"));
2232 yyresult = 2;
2233 /* Fall through. */
2234 #endif
2235
2236 yyreturn:
2237 if (yychar != YYEMPTY)
2238 {
2239 /* Make sure we have latest lookahead translation. See comments at
2240 user semantic actions for why this is necessary. */
2241 yytoken = YYTRANSLATE (yychar);
2242 yydestruct ("Cleanup: discarding lookahead",
2243 yytoken, &yylval);
2244 }
2245 /* Do not reclaim the symbols of the rule whose action triggered
2246 this YYABORT or YYACCEPT. */
2247 YYPOPSTACK (yylen);
2248 YY_STACK_PRINT (yyss, yyssp);
2249 while (yyssp != yyss)
2250 {
2251 yydestruct ("Cleanup: popping",
2252 yystos[*yyssp], yyvsp);
2253 YYPOPSTACK (1);
2254 }
2255 #ifndef yyoverflow
2256 if (yyss != yyssa)
2257 YYSTACK_FREE (yyss);
2258 #endif
2259 #if YYERROR_VERBOSE
2260 if (yymsg != yymsgbuf)
2261 YYSTACK_FREE (yymsg);
2262 #endif
2263 return yyresult;
2264 }
2265 #line 351 "oil.y" /* yacc.c:1906 */
2266
2267
2268 #define MAXTOFREE 1000
2269
2270 char* tofree[MAXTOFREE]={0};
2271 int tfi=0;
2272
yylex(void)2273 int yylex(void)
2274 {
2275 int c;
2276 unsigned long acc;
2277
2278 /* Whitespace is completely insignificant here, even inside && and other
2279 two-character operators. Just to be different, though, it /is/ significant
2280 inside constructs like .1 and #{1}2; in such cases, it isn't allowed. */
2281 c=countgetchar();
2282 while(isspace(c)) c=countgetchar();
2283 while(c==';'||c=='[')
2284 {
2285 /* Comments go from a semicolon/hybrid to the end of the line. */
2286 if(c==';')
2287 {
2288 c=countgetchar();
2289 while(c!='\n') c=countgetchar();
2290 while(isspace(c)) c=countgetchar();
2291 }
2292 /* Square brackets set the name for optimizations. */
2293 if(c=='[')
2294 {
2295 int i=0;
2296 c=countgetchar();
2297 while(c!=']')
2298 {
2299 optname[i++]=c;
2300 c=countgetchar();
2301 if(i==MAXOPTNAMELEN-1) {i=0; yyerror("optimization name too long");}
2302 }
2303 optnumber=0;
2304 optname[i]=0;
2305 c=countgetchar();
2306 while(isspace(c)) c=countgetchar();
2307 }
2308 }
2309 if(c==EOF) return 0;
2310 switch(c)
2311 {
2312 case '#':
2313 c=countgetchar();
2314 if(c!='{')
2315 {
2316 acc=0;
2317 while(isdigit(c))
2318 {
2319 acc*=10;
2320 acc+=(c-'0');
2321 c=countgetchar();
2322 }
2323 yylval=malloc(sizeof(struct ickstype));
2324 yylval->depth=0;
2325 yylval->path=0;
2326 yylval->condition="->constant==";
2327 yylval->nodetypename=0;
2328 yylval->usec=1;
2329 yylval->mustbemesh=1;
2330 yylval->cxneeded=0;
2331 yylval->c=acc;
2332 yylval->replnum=0;
2333 yylval->n1=0;
2334 yylval->n2=0;
2335 yylval->ublo=0;
2336 yylval->width32=1; /* generate MESH32 not MESH; we can still AND16 it,
2337 etc., if necessary */
2338 countungetc(c, stdin);
2339 return LEXERLEAF;
2340 }
2341 countungetc(c, stdin);
2342 c='#';
2343 /* fall through */
2344 case '_':
2345 case ':':
2346 case '.':
2347 yylval=malloc(sizeof(struct ickstype));
2348 yylval->depth=0;
2349 yylval->path=0;
2350 yylval->condition=0; /* _ or # */
2351 yylval->width32=1; /* should never matter, but you never
2352 know... */
2353 yylval->ublo=0;
2354 if(c==':') yylval->condition="->width==32";
2355 if(c=='.') {yylval->condition="->width==16"; yylval->width32=0;}
2356 yylval->nodetypename=0;
2357 yylval->usec=0;
2358 yylval->mustbemesh=c=='#';
2359 yylval->cxneeded=0;
2360 c=countgetchar();
2361 if(c=='{')
2362 {
2363 /* Create a new node to hold the c/x condition */
2364 yylval->n1=malloc(sizeof(struct ickstype));
2365 yylval->n1->depth=0;
2366 yylval->n1->path=0;
2367 {
2368 static char buf[512];
2369 int bi=0;
2370 c=countgetchar();
2371 while(c!='}')
2372 {
2373 buf[bi++]=c;
2374 if(bi==511) {yyerror("{quoted} string too long"); bi=0;}
2375 c=countgetchar();
2376 }
2377 buf[bi]=0;
2378 yylval->n1->condition=tofree[tfi++]=strdup(buf);
2379 if(tfi==MAXTOFREE) {yyerror("Too many {quoted} strings"); tfi--;}
2380 c=countgetchar();
2381 }
2382 yylval->n1->nodetypename=0;
2383 yylval->n1->usec=0;
2384 yylval->n1->mustbemesh=0;
2385 yylval->n1->cxneeded=1;
2386 yylval->n1->n1=0;
2387 yylval->n1->n2=0;
2388 yylval->n1->width32=yylval->width32;
2389 yylval->n1->ublo=0;
2390 }
2391 else yylval->n1=0;
2392 yylval->replnum=0;
2393 if(yylval->n1) yylval->n1->replnum=c-'0'; else yylval->replnum=c-'0';
2394 yylval->n2=0;
2395 return LEXERLEAF;
2396 default:
2397 return c;
2398 }
2399 }
2400
treedepthup(YYSTYPE v,bool i)2401 void treedepthup(YYSTYPE v, bool i)
2402 {
2403 if(!v) return;
2404 treedepthup(v->n1,i);
2405 treedepthup(v->n2,i);
2406 v->depth++;
2407 v->path<<=1;
2408 v->path|=i;
2409 if(v->depth>30) yyerror("Nesting too deep in template or replacement\n");
2410 }
2411
treefree(YYSTYPE v)2412 void treefree(YYSTYPE v)
2413 {
2414 if(!v) return;
2415 treefree(v->n1);
2416 treefree(v->n2);
2417 free(v);
2418 }
2419
gennodepath(unsigned depth,unsigned long path)2420 void gennodepath(unsigned depth, unsigned long path)
2421 {
2422 while(depth--)
2423 {
2424 if(path&1) printf("->rval"); else printf("->lval");
2425 path>>=1;
2426 }
2427 }
2428
treeshapecond(YYSTYPE v,bool firstopt)2429 bool treeshapecond(YYSTYPE v, bool firstopt)
2430 {
2431 if(!v) return firstopt;
2432 /* To prevent possibly dereferencing a null pointer, check the root ick_first */
2433 if(v->mustbemesh) /* it's a must-be-constant constraint */
2434 {
2435 printf(firstopt?" if((np":" &&\n (np");
2436 gennodepath(v->depth,v->path);
2437 printf("->opcode==MESH || np");
2438 gennodepath(v->depth,v->path);
2439 printf("->opcode==MESH32)");
2440 firstopt=0;
2441 }
2442 if(v->condition&&!v->cxneeded) /* it's a tree-shape constraint */
2443 {
2444 printf(firstopt?" if(np":" &&\n np");
2445 gennodepath(v->depth,v->path);
2446 printf("%s",v->condition);
2447 if(v->usec) printf("%luLU",v->c);
2448 firstopt=0;
2449 }
2450 if(v->ublo) /* generate a width check */
2451 {
2452 printf(firstopt?" if(np":" &&\n np");
2453 gennodepath(v->depth,v->path);
2454 printf("->width==%d",v->width32?32:16);
2455 firstopt=0;
2456 }
2457 firstopt=treeshapecond(v->n1,firstopt);
2458 return treeshapecond(v->n2,firstopt);
2459 }
2460
treenscheck(YYSTYPE v,YYSTYPE prev,int replnum)2461 YYSTYPE treenscheck(YYSTYPE v, YYSTYPE prev, int replnum)
2462 {
2463 if(!v) return prev;
2464 prev=treenscheck(v->n1,prev,replnum);
2465 prev=treenscheck(v->n2,prev,replnum);
2466 if(v->replnum!=replnum) return prev;
2467 if(prev)
2468 {
2469 printf(" if(!nodessame(np");
2470 gennodepath(prev->depth,prev->path);
2471 printf(",np");
2472 gennodepath(v->depth,v->path);
2473 printf(")) break;\n");
2474 }
2475 return v;
2476 }
2477
treecxcond(YYSTYPE v)2478 void treecxcond(YYSTYPE v)
2479 {
2480 if(!v) return;
2481 if(v->cxneeded&&strcmp(v->condition,"1"))
2482 {
2483 if(v->replnum)
2484 printf(" x=x%d; c=c%d; ",v->replnum,v->replnum);
2485 else
2486 {
2487 printf(" x=np");
2488 gennodepath(v->depth,v->path);
2489 printf("->constant;\n c=np");
2490 gennodepath(v->depth,v->path);
2491 printf("->optdata;\n ");
2492 }
2493 printf("if(!(%s)) break;\n",v->condition);
2494 }
2495 treecxcond(v->n1);
2496 treecxcond(v->n2);
2497 }
2498
treerepcount(YYSTYPE v,int * rc)2499 void treerepcount(YYSTYPE v, int* rc)
2500 {
2501 if(!v) return;
2502 if(!(v->nodetypename)&&v->replnum&&!(v->cxneeded)) rc[v->replnum]++;
2503 treerepcount(v->n1, rc);
2504 treerepcount(v->n2, rc);
2505 }
2506
treerepgen(YYSTYPE v,YYSTYPE * refs,int * rc)2507 void treerepgen(YYSTYPE v, YYSTYPE* refs, int* rc)
2508 {
2509 if(!v) return;
2510 /* We absolutely have to generate the root node ick_first here, because otherwise
2511 the nodes in question won't exist. */
2512 if(v->nodetypename) /* Generate an intermediate node */
2513 {
2514 printf(" MAYBENEWNODE(tp");
2515 gennodepath(v->depth,v->path);
2516 printf(");\n tp");
2517 gennodepath(v->depth,v->path);
2518 printf("->opcode=%s;\n tp",v->nodetypename);
2519 gennodepath(v->depth,v->path);
2520 printf("->width=%d;\n",v->width32?32:16);
2521 /* optdata will be filled in by checknodeactbits before the ick_next idiom is
2522 tested; constant is irrelevant, lval and rval are NULL at present and
2523 will be filled in by later recursions of this function, and I seriously
2524 hope that nextslat is never filled in by an optimizer idiom. */
2525 }
2526 else if(v->replnum&&!(v->cxneeded))
2527 {
2528 /* Copy a node from the template. The node ought not to be allocated at
2529 this point, so we can safely just ick_assign to it with a new malloced
2530 node. */
2531 if(refs[v->replnum])
2532 {
2533 if(rc[v->replnum]>1||!refs[v->replnum]->depth)
2534 {
2535 /* The node actually has to be copied, either because another copy is
2536 needed or because it's np itself that's being copied over. */
2537 rc[v->replnum]--;
2538 printf(" tp");
2539 gennodepath(v->depth,v->path);
2540 printf("=nodecopy(np");
2541 gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path);
2542 printf(");\n");
2543 }
2544 else
2545 {
2546 /* This can be optimized slightly by moving rather than copying,
2547 zeroing backlinks so that the node won't be freed. */
2548 rc[v->replnum]--;
2549 printf(" tp");
2550 gennodepath(v->depth,v->path);
2551 printf("=np");
2552 gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path);
2553 printf(";\n np");
2554 gennodepath(refs[v->replnum]->depth,refs[v->replnum]->path);
2555 printf("=0;\n");
2556 }
2557 }
2558 else yyerror("Replacement isn't in the template");
2559 }
2560 else if(v->cxneeded)
2561 {
2562 /* Generate a constant node based on an expression (#{expr}0). */
2563 printf(" MAYBENEWNODE(tp");
2564 gennodepath(v->depth,v->path);
2565 printf(");\n tp");
2566 gennodepath(v->depth,v->path);
2567 printf("->opcode=MESH32;\n tp");
2568 gennodepath(v->depth,v->path);
2569 printf("->width=32;\n tp");
2570 gennodepath(v->depth,v->path);
2571 printf("->constant=(%s);\n",v->condition);
2572 }
2573 else if(v->mustbemesh&&!v->n1)
2574 {
2575 /* Generate a constant node based on a constant (#65535). */
2576 printf(" MAYBENEWNODE(tp");
2577 gennodepath(v->depth,v->path);
2578 printf(");\n tp");
2579 gennodepath(v->depth,v->path);
2580 printf("->opcode=MESH32;\n tp");
2581 gennodepath(v->depth,v->path);
2582 printf("->width=32;\n tp");
2583 gennodepath(v->depth,v->path);
2584 printf("->constant=(%luLU);\n",v->c);
2585 }
2586 else if(v->mustbemesh&&v->n1)
2587 /* let this node's n1 handle it */ ;
2588 else
2589 yyerror("can't figure out how to generate a replacement node\n");
2590 treerepgen(v->n1,refs,rc);
2591 treerepgen(v->n2,refs,rc);
2592 }
2593
yyerror(char const * s)2594 int yyerror(char const *s)
2595 {
2596 fprintf(stderr,"Error at (%d:%d): \"%s\"\n",cgcrow,cgccol,s);
2597 return 0; /* this return value is ignored anyway */
2598 }
2599
2600 static int cgcpushback=0;
2601
countgetchar(void)2602 int countgetchar(void)
2603 {
2604 int c=getchar();
2605 if(cgcpushback) {cgcpushback=0; return c;}
2606 cgccol++;
2607 if(c=='\n') {cgccol=0; cgcrow++;}
2608 return c;
2609 }
2610
countungetc(int c,FILE * f)2611 int countungetc(int c, FILE* f)
2612 {
2613 ungetc(c,f);
2614 cgcpushback=1;
2615 return c;
2616 }
2617
splitstart(void)2618 void splitstart(void)
2619 {
2620 static char fname[]="oilout00.c";
2621 FILE *dummy; /* GCC 4 un-suppressable warning suck */
2622 if(filenumber>255)
2623 {
2624 filenumber=255;
2625 fprintf(stdout,"Input file too long.\n");
2626 }
2627 sprintf(fname,"oilout%02x.c",filenumber);
2628 dummy = freopen(fname,"w",stdout);
2629 puts("/* Automatically generated output, edit source and recompile to "
2630 "change */");
2631 printf("#include \"oil.h\"\n"
2632 "int optimize_pass1_%x(node *np)\n"
2633 "{"
2634 " int opted=0;\n"
2635 " unsigned long c,c1,c2,c3,c4,c5,c6,c7,c8,c9;\n"
2636 " unsigned long x,x1,x2,x3,x4,x5,x6,x7,x8,x9,r;\n"
2637 " int tempw;\n"
2638 " node *tp;\n", filenumber);
2639 }
2640
splitend(void)2641 void splitend(void)
2642 {
2643 /* Disabling warnings about unused variables. gcc will optimize this right
2644 out, and in any case the raise(SIGSEGV) will be unreachable (but will
2645 cause a pretty recognizable error because it'll be caught by the handler
2646 for SIGSEGV and output an internal error, with an obvious debug backtrace
2647 if -U is used). */
2648 printf(" c=c1=c2=c3=c4=c5=c6=c7=c8=c9=0;\n"
2649 " x=x1=x2=x3=x4=x5=x6=x7=x8=x9=r=0;\n"
2650 " if(c+c1+c2+c3+c4+c5+c6+c7+c8+c9+r+\n"
2651 " x+x1+x2+x3+x4+x5+x6+x7+x8+x9) raise(SIGSEGV);\n");
2652 printf(" return opted;\n}\n");
2653 /* do not close stdout; freopen implicitly closes it anyway, and explicitly
2654 closing it breaks on DOS */
2655 }
2656
main(void)2657 int main(void)
2658 {
2659 int e,i;
2660 FILE *dummy; /* GCC 4 un-suppressible warnings suck */
2661 /*
2662 " if(!np) return 0;\n"
2663 " if(np->lval) opted|=optimize_pass1(np->lval);\n"
2664 " if(np->rval) opted|=optimize_pass1(np->rval);\n"
2665 */
2666 splitstart();
2667 cgccol=0;
2668 cgcrow=1;
2669 e=yyparse();
2670 while(tfi--) free(tofree[tfi]);
2671 splitend();
2672 dummy = freopen("oilout-m.c","w",stdout);
2673 puts("/* Automatically generated output, edit source and recompile to "
2674 "change */");
2675 puts("#include \"config.h\"");
2676 puts("#include \"ick.h\"");
2677 i=filenumber+1;
2678 while(i--) printf("extern int optimize_pass1_%x(node*);\n",i);
2679 puts("int optimize_pass1(node* np)\n"
2680 "{\n"
2681 " int opted=0;\n"
2682 " if(!np) return 0;\n"
2683 " if(np->lval) opted|=optimize_pass1(np->lval);\n"
2684 " if(np->rval) opted|=optimize_pass1(np->rval);");
2685 i=filenumber+1;
2686 while(i--) printf(" opted|=optimize_pass1_%x(np);\n",i);
2687 puts(" return opted;\n"
2688 "}");
2689 return e;
2690 }
2691