#define YYBISON 1
#define YYBISON_VERSION "3.0.4"
#define YYSKELETON_NAME "yacc.c"
#define YYPURE 0
#define YYPUSH 0
#define YYPULL 1
#line 1 "gen-ops-parser.y"
#include <config.h>
#include <ctype.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#elif defined(HAVE_STRINGS_H)
# include <strings.h>
#endif
extern int yylex(void);
extern void yyrestart(FILE *file);
#ifdef YYTEXT_POINTER
extern char *yytext;
#else
extern char yytext[];
#endif
#define TASK_GEN_NONE 0
#define TASK_GEN_HEADER 1
#define TASK_GEN_TABLE 2
#define TASK_GEN_CF_TABLE 3
#define VALUE_FLAG_EMPTY 0
#define VALUE_FLAG_INT 1
#define VALUE_FLAG_LONG 2
#define VALUE_FLAG_FLOAT32 3
#define VALUE_FLAG_FLOAT64 4
#define VALUE_FLAG_NFLOAT 5
#define VALUE_FLAG_ANY 6
#define VALUE_FLAG_PTR 7
#define OP_TYPE_BRANCH 0x0001
#define OP_TYPE_CALL 0x0002
#define OP_TYPE_CALL_EXTERNAL 0x0004
#define OP_TYPE_ADDRESS_OF_LABEL 0x0008
#define OP_TYPE_JUMP_TABLE 0x0010
#define OP_TYPE_REG 0x0020
#define OP_NONE 0x00
#define OP_ADD 0x01
#define OP_SUB 0x02
#define OP_MUL 0x03
#define OP_DIV 0x04
#define OP_REM 0x05
#define OP_NEG 0x06
#define OP_AND 0x07
#define OP_OR 0x08
#define OP_XOR 0x09
#define OP_NOT 0x0A
#define OP_EQ 0x0B
#define OP_NE 0x0C
#define OP_LT 0x0D
#define OP_LE 0x0E
#define OP_GT 0x0F
#define OP_GE 0x10
#define OP_SHL 0x11
#define OP_SHR 0x12
#define OP_SHR_UN 0x13
#define OP_COPY 0x14
#define OP_ADDRESS_OF 0x15
#define SIG_NONE 0
#define SIG_i_i 1
#define SIG_i_ii 2
#define SIG_i_piii 3
#define SIG_i_iI 4
#define SIG_i_II 5
#define SIG_I_I 6
#define SIG_I_II 7
#define SIG_i_pIII 8
#define SIG_l_l 9
#define SIG_l_ll 10
#define SIG_i_plll 11
#define SIG_i_l 12
#define SIG_i_ll 13
#define SIG_l_lI 14
#define SIG_L_L 15
#define SIG_L_LL 16
#define SIG_i_pLLL 17
#define SIG_i_LL 18
#define SIG_L_LI 19
#define SIG_f_f 20
#define SIG_f_ff 21
#define SIG_i_f 22
#define SIG_i_ff 23
#define SIG_d_d 24
#define SIG_d_dd 25
#define SIG_i_d 26
#define SIG_i_dd 27
#define SIG_D_D 28
#define SIG_D_DD 29
#define SIG_i_D 30
#define SIG_i_DD 31
#define SIG_conv 32
#define SIG_conv_ovf 33
extern char *genops_filename;
extern long genops_linenum;
struct intrinsic_info
{
const char *flags;
int signature;
const char *intrinsic;
};
struct genops_opcode
{
struct genops_opcode *next;
const char *name;
int type;
int oper;
int dest_flags;
int input1_flags;
int input2_flags;
const char *expression;
struct intrinsic_info intrinsic_info;
};
struct genops_opcode_list
{
const char *declaration;
const char *define_start;
const char *counter_prefix_expr;
struct genops_opcode *first_opcode;
struct genops_opcode *last_opcode;
};
static int genops_task = TASK_GEN_NONE;
static FILE *genops_file = 0;
static int genops_file_needs_close = 0;
static int genops_gen_intrinsic_table = 0;
static const char *genops_intrinsic_decl = 0;
static const char *start_code_block = 0;
static const char *start_header_block = 0;
static const char *end_code_block = 0;
static const char *end_header_block = 0;
static struct genops_opcode_list *opcode_header = 0;
static void
genops_error_message(char *filename, long linenum, char *msg)
{
fprintf(stderr, "%s(%ld): %s\n", filename, linenum, msg);
}
static void
yyerror(char *msg)
{
genops_error_message(genops_filename, genops_linenum, msg);
}
static void
genops_create_opcode_header(const char *define_start, const char *declaration,
const char *counter_prefix_expr)
{
struct genops_opcode_list *header;
header = (struct genops_opcode_list *)malloc(sizeof(struct genops_opcode_list));
if(!header)
{
exit(1);
}
if(counter_prefix_expr && (strlen(counter_prefix_expr) == 0))
{
counter_prefix_expr = 0;
}
header->declaration = declaration;
header->define_start = define_start;
header->counter_prefix_expr = counter_prefix_expr;
header->first_opcode = 0;
header->last_opcode = 0;
opcode_header = header;
}
static struct genops_opcode *
genops_add_opcode(const char *name, int type, int oper, int dest_flags,
int input1_flags, int input2_flags, const char *expression,
const char *intrinsic_flags, int signature,
const char *intrinsic)
{
struct genops_opcode *opcode;
opcode = (struct genops_opcode *) malloc(sizeof(struct genops_opcode));
if(!opcode)
{
exit(1);
}
if(opcode_header->first_opcode == 0)
{
opcode_header->first_opcode = opcode;
}
if(opcode_header->last_opcode != 0)
{
opcode_header->last_opcode->next = opcode;
}
opcode_header->last_opcode = opcode;
opcode->next = 0;
opcode->name = name;
opcode->type = type;
opcode->oper = oper;
opcode->dest_flags = dest_flags;
opcode->input1_flags= input1_flags;
opcode->input2_flags= input2_flags;
opcode->expression = expression;
opcode->intrinsic_info.flags = intrinsic_flags;
opcode->intrinsic_info.signature = signature;
opcode->intrinsic_info.intrinsic = intrinsic;
return opcode;
}
static int
genops_output_flag(const char *flag, int needs_or)
{
if(needs_or) printf(" | ");
printf(flag);
return 1;
}
static int
genops_output_prefix_flag(const char *prefix, const char *flag, int needs_or)
{
if(needs_or) printf(" | ");
printf("%s%s", prefix, flag);
return 1;
}
static int
genops_output_type(int type, int needs_or)
{
if(type & OP_TYPE_BRANCH)
{
needs_or = genops_output_flag("JIT_OPCODE_IS_BRANCH", needs_or);
}
if(type & OP_TYPE_CALL)
{
needs_or = genops_output_flag("JIT_OPCODE_IS_CALL", needs_or);
}
if(type & OP_TYPE_CALL_EXTERNAL)
{
needs_or = genops_output_flag("JIT_OPCODE_IS_CALL_EXTERNAL", needs_or);
}
if(type & OP_TYPE_ADDRESS_OF_LABEL)
{
needs_or = genops_output_flag("JIT_OPCODE_IS_ADDROF_LABEL", needs_or);
}
if(type & OP_TYPE_JUMP_TABLE)
{
needs_or = genops_output_flag("JIT_OPCODE_IS_JUMP_TABLE", needs_or);
}
if(type & OP_TYPE_REG)
{
needs_or = genops_output_flag("JIT_OPCODE_IS_REG", needs_or);
}
return needs_or;
}
static int
genops_output_expression(const char *expression, int needs_or)
{
if(expression && (strlen(expression) > 0))
{
needs_or = genops_output_flag(expression, needs_or);
}
return needs_or;
}
static int
genops_output_oper(int oper, int needs_or)
{
switch(oper)
{
case OP_ADD:
{
return genops_output_flag
("JIT_OPCODE_OPER_ADD", needs_or);
}
break;
case OP_SUB:
{
return genops_output_flag
("JIT_OPCODE_OPER_SUB", needs_or);
}
break;
case OP_MUL:
{
return genops_output_flag
("JIT_OPCODE_OPER_MUL", needs_or);
}
break;
case OP_DIV:
{
return genops_output_flag
("JIT_OPCODE_OPER_DIV", needs_or);
}
break;
case OP_REM:
{
return genops_output_flag
("JIT_OPCODE_OPER_REM", needs_or);
}
break;
case OP_NEG:
{
return genops_output_flag
("JIT_OPCODE_OPER_NEG", needs_or);
}
break;
case OP_AND:
{
return genops_output_flag
("JIT_OPCODE_OPER_AND", needs_or);
}
break;
case OP_OR:
{
return genops_output_flag
("JIT_OPCODE_OPER_OR", needs_or);
}
break;
case OP_XOR:
{
return genops_output_flag
("JIT_OPCODE_OPER_XOR", needs_or);
}
break;
case OP_NOT:
{
return genops_output_flag
("JIT_OPCODE_OPER_NOT", needs_or);
}
break;
case OP_EQ:
{
return genops_output_flag
("JIT_OPCODE_OPER_EQ", needs_or);
}
break;
case OP_NE:
{
return genops_output_flag
("JIT_OPCODE_OPER_NE", needs_or);
}
break;
case OP_LT:
{
return genops_output_flag
("JIT_OPCODE_OPER_LT", needs_or);
}
break;
case OP_LE:
{
return genops_output_flag
("JIT_OPCODE_OPER_LE", needs_or);
}
break;
case OP_GT:
{
return genops_output_flag
("JIT_OPCODE_OPER_GT", needs_or);
}
break;
case OP_GE:
{
return genops_output_flag
("JIT_OPCODE_OPER_GE", needs_or);
}
break;
case OP_SHL:
{
return genops_output_flag
("JIT_OPCODE_OPER_SHL", needs_or);
}
break;
case OP_SHR:
{
return genops_output_flag
("JIT_OPCODE_OPER_SHR", needs_or);
}
break;
case OP_SHR_UN:
{
return genops_output_flag
("JIT_OPCODE_OPER_SHR_UN", needs_or);
}
break;
case OP_COPY:
{
return genops_output_flag
("JIT_OPCODE_OPER_COPY", needs_or);
}
break;
case OP_ADDRESS_OF:
{
return genops_output_flag
("JIT_OPCODE_OPER_ADDRESS_OF", needs_or);
}
break;
}
return needs_or;
}
static int
genops_output_value_flags(const char *prefix, int flags, int needs_or)
{
switch(flags)
{
case VALUE_FLAG_EMPTY:
{
}
break;
case VALUE_FLAG_INT:
{
return genops_output_prefix_flag
(prefix, "_INT", needs_or);
}
break;
case VALUE_FLAG_LONG:
{
return genops_output_prefix_flag
(prefix, "_LONG", needs_or);
}
break;
case VALUE_FLAG_FLOAT32:
{
return genops_output_prefix_flag
(prefix, "_FLOAT32", needs_or);
}
break;
case VALUE_FLAG_FLOAT64:
{
return genops_output_prefix_flag
(prefix, "_FLOAT64", needs_or);
}
break;
case VALUE_FLAG_NFLOAT:
{
return genops_output_prefix_flag
(prefix, "_NFLOAT", needs_or);
}
break;
case VALUE_FLAG_ANY:
{
return genops_output_prefix_flag
(prefix, "_ANY", needs_or);
}
break;
case VALUE_FLAG_PTR:
{
return genops_output_prefix_flag
(prefix, "_PTR", needs_or);
}
break;
}
return needs_or;
}
static void
genops_output_signature(int signature)
{
switch(signature)
{
case SIG_NONE:
{
printf("JIT_SIG_NONE");
}
break;
case SIG_i_i:
{
printf("JIT_SIG_i_i");
}
break;
case SIG_i_ii:
{
printf("JIT_SIG_i_ii");
}
break;
case SIG_i_piii:
{
printf("JIT_SIG_i_piii");
}
break;
case SIG_i_iI:
{
printf("JIT_SIG_i_iI");
}
break;
case SIG_i_II:
{
printf("JIT_SIG_i_II");
}
break;
case SIG_I_I:
{
printf("JIT_SIG_I_I");
}
break;
case SIG_I_II:
{
printf("JIT_SIG_I_II");
}
break;
case SIG_i_pIII:
{
printf("JIT_SIG_i_pIII");
}
break;
case SIG_l_l:
{
printf("JIT_SIG_l_l");
}
break;
case SIG_l_ll:
{
printf("JIT_SIG_l_ll");
}
break;
case SIG_i_plll:
{
printf("JIT_SIG_i_plll");
}
break;
case SIG_i_l:
{
printf("JIT_SIG_i_l");
}
break;
case SIG_i_ll:
{
printf("JIT_SIG_i_ll");
}
break;
case SIG_l_lI:
{
printf("JIT_SIG_l_lI");
}
break;
case SIG_L_L:
{
printf("JIT_SIG_L_L");
}
break;
case SIG_L_LL:
{
printf("JIT_SIG_L_LL");
}
break;
case SIG_i_pLLL:
{
printf("JIT_SIG_i_pLLL");
}
break;
case SIG_i_LL:
{
printf("JIT_SIG_i_LL");
}
break;
case SIG_L_LI:
{
printf("JIT_SIG_L_LI");
}
break;
case SIG_f_f:
{
printf("JIT_SIG_f_f");
}
break;
case SIG_f_ff:
{
printf("JIT_SIG_f_ff");
}
break;
case SIG_i_f:
{
printf("JIT_SIG_i_f");
}
break;
case SIG_i_ff:
{
printf("JIT_SIG_i_ff");
}
break;
case SIG_d_d:
{
printf("JIT_SIG_d_d");
}
break;
case SIG_d_dd:
{
printf("JIT_SIG_d_dd");
}
break;
case SIG_i_d:
{
printf("JIT_SIG_i_d");
}
break;
case SIG_i_dd:
{
printf("JIT_SIG_i_dd");
}
break;
case SIG_D_D:
{
printf("JIT_SIG_D_D");
}
break;
case SIG_D_DD:
{
printf("JIT_SIG_D_DD");
}
break;
case SIG_i_D:
{
printf("JIT_SIG_i_D");
}
break;
case SIG_i_DD:
{
printf("JIT_SIG_i_DD");
}
break;
case SIG_conv:
{
printf("JIT_SIG_conv");
}
break;
case SIG_conv_ovf:
{
printf("JIT_SIG_conv_ovf");
}
break;
}
}
static char *
genops_string_upper(const char *string)
{
if(string)
{
char *cp;
char *new_string;
new_string = strdup(string);
for(cp = new_string; *cp; cp++)
{
*cp = toupper(*cp);
}
return new_string;
}
return 0;
}
static int
genops_set_option(const char *option, const char *value)
{
if(!strcmp(option, "gen_intrinsic_table"))
{
if(!strcmp(value, "yes"))
{
genops_gen_intrinsic_table = 1;
}
else if(!strcmp(value, "no"))
{
genops_gen_intrinsic_table = 0;
}
else
{
yyerror("Invalid boolean value for the option. Allowed values: yes | no");
return 0;
}
}
else if(!strcmp(option, "intrinsic_table_decl"))
{
genops_intrinsic_decl = value;
}
else
{
yyerror("Invalid option");
return 0;
}
return 1;
}
#line 904 "gen-ops-parser.c"
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif
#ifndef YY_YY_GEN_OPS_PARSER_H_INCLUDED
# define YY_YY_GEN_OPS_PARSER_H_INCLUDED
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
IDENTIFIER = 258,
CODE_BLOCK = 259,
HEADER_BLOCK = 260,
LITERAL = 261,
K_EMPTY = 262,
K_ANY = 263,
K_INT = 264,
K_LONG = 265,
K_PTR = 266,
K_FLOAT32 = 267,
K_FLOAT64 = 268,
K_NFLOAT = 269,
K_NEG = 270,
K_EQ = 271,
K_NE = 272,
K_LT = 273,
K_LE = 274,
K_GT = 275,
K_GE = 276,
K_SHL = 277,
K_SHR = 278,
K_SHR_UN = 279,
K_ADDRESS_OF = 280,
K_ADDRESS_OF_LABEL = 281,
K_BRANCH = 282,
K_CALL = 283,
K_CALL_EXTERNAL = 284,
K_JUMP_TABLE = 285,
K_OP_DEF = 286,
K_OP_INTRINSIC = 287,
K_OP_TYPE = 288,
K_OP_VALUES = 289,
K_OPCODES = 290,
K_REG = 291,
K_POPTION = 292,
K_i_i = 293,
K_i_ii = 294,
K_i_piii = 295,
K_i_iI = 296,
K_i_II = 297,
K_I_I = 298,
K_I_II = 299,
K_i_pIII = 300,
K_l_l = 301,
K_l_ll = 302,
K_i_plll = 303,
K_i_l = 304,
K_i_ll = 305,
K_l_lI = 306,
K_L_L = 307,
K_L_LL = 308,
K_i_pLLL = 309,
K_i_LL = 310,
K_L_LI = 311,
K_f_f = 312,
K_f_ff = 313,
K_i_f = 314,
K_i_ff = 315,
K_d_d = 316,
K_d_dd = 317,
K_i_d = 318,
K_i_dd = 319,
K_D_D = 320,
K_D_DD = 321,
K_i_D = 322,
K_i_DD = 323,
K_CONV = 324,
K_CONV_OVF = 325
};
#endif
#define IDENTIFIER 258
#define CODE_BLOCK 259
#define HEADER_BLOCK 260
#define LITERAL 261
#define K_EMPTY 262
#define K_ANY 263
#define K_INT 264
#define K_LONG 265
#define K_PTR 266
#define K_FLOAT32 267
#define K_FLOAT64 268
#define K_NFLOAT 269
#define K_NEG 270
#define K_EQ 271
#define K_NE 272
#define K_LT 273
#define K_LE 274
#define K_GT 275
#define K_GE 276
#define K_SHL 277
#define K_SHR 278
#define K_SHR_UN 279
#define K_ADDRESS_OF 280
#define K_ADDRESS_OF_LABEL 281
#define K_BRANCH 282
#define K_CALL 283
#define K_CALL_EXTERNAL 284
#define K_JUMP_TABLE 285
#define K_OP_DEF 286
#define K_OP_INTRINSIC 287
#define K_OP_TYPE 288
#define K_OP_VALUES 289
#define K_OPCODES 290
#define K_REG 291
#define K_POPTION 292
#define K_i_i 293
#define K_i_ii 294
#define K_i_piii 295
#define K_i_iI 296
#define K_i_II 297
#define K_I_I 298
#define K_I_II 299
#define K_i_pIII 300
#define K_l_l 301
#define K_l_ll 302
#define K_i_plll 303
#define K_i_l 304
#define K_i_ll 305
#define K_l_lI 306
#define K_L_L 307
#define K_L_LL 308
#define K_i_pLLL 309
#define K_i_LL 310
#define K_L_LI 311
#define K_f_f 312
#define K_f_ff 313
#define K_i_f 314
#define K_i_ff 315
#define K_d_d 316
#define K_d_dd 317
#define K_i_d 318
#define K_i_dd 319
#define K_D_D 320
#define K_D_DD 321
#define K_i_D 322
#define K_i_DD 323
#define K_CONV 324
#define K_CONV_OVF 325
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 842 "gen-ops-parser.y"
int value;
char *name;
struct
{
const char *header;
const char *code;
} blocks;
struct
{
const char *declaration;
const char *define_start;
const char *counter_prefix_expr;
} opcode_list_header;
struct
{
const char *name;
int oper;
} opcode_header;
struct
{
int dest_flags;
int input1_flags;
int input2_flags;
} opcode_values;
struct
{
int type;
int dest_flags;
int input1_flags;
int input2_flags;
const char *expression;
const char *intrinsic_flags;
int signature;
const char *intrinsic;
} opcode_properties;
struct
{
const char *intrinsic_flags;
int signature;
const char *intrinsic;
} intrinsic_info;
struct
{
const char *name;
int type;
int oper;
int dest_flags;
int input1_flags;
int input2_flags;
const char *expression;
const char *intrinsic_flags;
int signature;
const char *intrinsic;
} opcode;
#line 1141 "gen-ops-parser.c"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif
#line 1158 "gen-ops-parser.c"
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T
# include <stddef.h>
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h>
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec)
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E)
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value)
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h>
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h>
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
# define YYSTACK_FREE(Ptr) do { ; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM 4032
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h>
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T);
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *);
# endif
# endif
# endif
#endif
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif
#define YYFINAL 7
#define YYLAST 172
#define YYNTOKENS 88
#define YYNNTS 22
#define YYNRULES 110
#define YYNSTATES 151
#define YYUNDEFTOK 2
#define YYMAXUTOK 325
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 80, 81, 2,
73, 75, 78, 76, 74, 77, 2, 79, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85, 87, 86, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 83, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 71, 82, 72, 84, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70
};
#if YYDEBUG
static const yytype_uint16 yyrline[] =
{
0, 996, 996, 1005, 1006, 1007, 1008, 1012, 1019, 1019,
1028, 1033, 1041, 1051, 1064, 1076, 1091, 1095, 1102, 1112,
1122, 1132, 1142, 1152, 1162, 1172, 1185, 1189, 1190, 1191,
1192, 1193, 1194, 1198, 1203, 1208, 1216, 1220, 1221, 1222,
1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232,
1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1245,
1246, 1247, 1248, 1249, 1250, 1251, 1252, 1256, 1261, 1266,
1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283,
1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293,
1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303,
1304, 1305, 1306, 1310, 1311, 1326, 1327, 1331, 1332, 1336,
1339
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 1
static const char *const yytname[] =
{
"$end", "error", "$undefined", "\"an identifier\"",
"\"a block copied to the code\"", "\"a block copied to the header\"",
"\"literal string\"", "\"empty\"", "\"any\"", "\"int\"", "\"long\"",
"\"ptr\"", "\"float32\"", "\"float64\"", "\"nfloat\"", "\"neg\"",
"\"==\"", "\"!=\"", "\"lt\"", "\"<=\"", "\"gt\"", "\">=\"", "\"<<\"",
"\">>\"", "\"shr_un\"", "\"address_of\"", "\"address_of_label\"",
"\"branch\"", "\"call\"", "\"call_external\"", "\"jump_table\"",
"\"op_def\"", "\"op_intrinsic\"", "\"op_type\"", "\"op_values\"",
"\"opcodes\"", "\"reg\"", "\"%option\"", "\"i_i\"", "\"i_ii\"",
"\"i_piii\"", "\"i_iI\"", "\"i_II\"", "\"I_I\"", "\"I_II\"",
"\"i_pIII\"", "\"l_l\"", "\"l_ll\"", "\"i_plll\"", "\"i_l\"", "\"i_ll\"",
"\"l_lI\"", "\"L_L\"", "\"L_LL\"", "\"i_pLLL\"", "\"i_LL\"", "\"L_LI\"",
"\"f_f\"", "\"f_ff\"", "\"i_f\"", "\"i_ff\"", "\"d_d\"", "\"d_dd\"",
"\"i_d\"", "\"i_dd\"", "\"D_D\"", "\"D_DD\"", "\"i_D\"", "\"i_DD\"",
"\"conv\"", "\"conv_ovf\"", "'{'", "'}'", "'('", "','", "')'", "'+'",
"'-'", "'*'", "'/'", "'%'", "'&'", "'|'", "'^'", "'~'", "'<'", "'>'",
"'='", "$accept", "Start", "Blocks", "OpcodeDeclarations", "$@1",
"OpcodeListHeader", "Opcodes", "Opcode", "OpcodeHeader",
"OpcodeProperties", "OpcodeType", "OpcodeTypeFlag", "OpcodeValues",
"OpcodeExpression", "Op", "ValueFlag", "OpcodeIntrinsicInfo",
"Signature", "Literal", "OptOptions", "Options", "Option", YY_NULLPTR
};
#endif
# ifdef YYPRINT
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
325, 123, 125, 40, 44, 41, 43, 45, 42, 47,
37, 38, 124, 94, 126, 60, 62, 61
};
# endif
#define YYPACT_NINF -120
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-120)))
#define YYTABLE_NINF -1
#define yytable_value_is_error(Yytable_value) \
0
static const yytype_int16 yypact[] =
{
29, 17, 34, 24, 8, -120, -120, -120, 43, 13,
8, -120, -31, -24, 29, -120, -120, 26, 52, -120,
-14, -120, -120, 53, -16, 45, -120, 54, 2, -28,
-120, 85, -1, 71, -120, -120, 7, 54, -120, -44,
84, 86, 87, -120, -58, -120, -120, -120, -120, 53,
5, -15, -120, 44, -9, 141, -120, 20, -120, -120,
-120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
3, 88, -120, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -120, -120, 83, 6, -120, -120, -120,
-120, -120, -120, 89, -120, -120, -120, -120, -120, -120,
-120, -120, -38, -120, -120, -120, -120, -120, 77, -120,
-120, -120, 141, -120, 90, -32, -120, 141, -120, 91,
-120
};
static const yytype_uint8 yydefact[] =
{
3, 4, 5, 0, 105, 6, 7, 1, 0, 0,
106, 107, 0, 0, 3, 8, 108, 0, 0, 2,
0, 109, 103, 110, 0, 0, 104, 0, 0, 0,
12, 0, 0, 0, 9, 13, 0, 0, 10, 0,
0, 0, 0, 14, 0, 18, 19, 20, 21, 36,
0, 37, 16, 0, 0, 0, 15, 0, 11, 43,
51, 52, 53, 55, 48, 49, 50, 58, 38, 39,
40, 41, 42, 44, 45, 46, 47, 54, 56, 57,
0, 0, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 0, 0, 27, 28, 29,
30, 31, 32, 0, 59, 66, 60, 61, 62, 63,
64, 65, 0, 22, 23, 24, 25, 17, 0, 68,
67, 26, 0, 33, 0, 0, 69, 0, 34, 0,
35
};
static const yytype_int16 yypgoto[] =
{
-120, -120, 147, -120, -120, -120, -120, 134, -120, -120,
110, -120, 111, 112, -120, -119, 113, 33, -2, -120,
-120, 162
};
static const yytype_int16 yydefgoto[] =
{
-1, 3, 4, 14, 20, 15, 29, 30, 31, 44,
45, 123, 46, 47, 80, 132, 48, 115, 49, 9,
10, 11
};
static const yytype_uint8 yytable[] =
{
59, 60, 61, 28, 62, 26, 63, 64, 65, 66,
67, 26, 26, 22, 56, 23, 57, 117, 118, 119,
120, 121, 5, 145, 7, 32, 22, 122, 149, 21,
51, 52, 22, 1, 2, 50, 142, 143, 6, 40,
41, 42, 147, 148, 34, 8, 12, 81, 13, 18,
22, 116, 40, 41, 42, 24, 17, 25, 27, 26,
22, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 37, 38, 33, 28, 39, 137, 43,
58, 140, 82, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
107, 108, 109, 110, 111, 112, 113, 114, 124, 125,
126, 127, 128, 129, 130, 131, 36, 53, 139, 54,
55, 19, 138, 35, 141, 146, 150, 133, 134, 135,
136, 144, 16
};
static const yytype_uint8 yycheck[] =
{
15, 16, 17, 31, 19, 6, 21, 22, 23, 24,
25, 6, 6, 6, 72, 17, 74, 26, 27, 28,
29, 30, 5, 142, 0, 27, 6, 36, 147, 3,
74, 75, 6, 4, 5, 37, 74, 75, 4, 32,
33, 34, 74, 75, 72, 37, 3, 3, 35, 73,
6, 53, 32, 33, 34, 3, 87, 71, 74, 6,
6, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 74, 75, 73, 31, 6, 75, 72,
75, 75, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 7, 8,
9, 10, 11, 12, 13, 14, 71, 73, 75, 73,
73, 14, 74, 29, 75, 75, 75, 57, 57, 57,
57, 138, 10
};
static const yytype_uint8 yystos[] =
{
0, 4, 5, 89, 90, 5, 4, 0, 37, 107,
108, 109, 3, 35, 91, 93, 109, 87, 73, 90,
92, 3, 6, 106, 3, 71, 6, 74, 31, 94,
95, 96, 106, 73, 72, 95, 71, 74, 75, 6,
32, 33, 34, 72, 97, 98, 100, 101, 104, 106,
106, 74, 75, 73, 73, 73, 72, 74, 75, 15,
16, 17, 19, 21, 22, 23, 24, 25, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
102, 3, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 105, 106, 26, 27, 28,
29, 30, 36, 99, 7, 8, 9, 10, 11, 12,
13, 14, 103, 98, 100, 101, 104, 75, 74, 75,
75, 75, 74, 75, 105, 103, 75, 74, 75, 103,
75
};
static const yytype_uint8 yyr1[] =
{
0, 88, 89, 90, 90, 90, 90, 90, 92, 91,
93, 93, 94, 94, 95, 95, 96, 96, 97, 97,
97, 97, 97, 97, 97, 97, 98, 99, 99, 99,
99, 99, 99, 100, 100, 100, 101, 102, 102, 102,
102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
102, 102, 102, 102, 102, 102, 102, 102, 102, 103,
103, 103, 103, 103, 103, 103, 103, 104, 104, 104,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
105, 105, 105, 106, 106, 107, 107, 108, 108, 109,
109
};
static const yytype_uint8 yyr2[] =
{
0, 2, 4, 0, 1, 1, 2, 2, 0, 5,
6, 8, 1, 2, 3, 4, 4, 6, 1, 1,
1, 1, 3, 3, 3, 3, 4, 1, 1, 1,
1, 1, 1, 4, 6, 8, 1, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 4, 4, 6,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 0, 1, 1, 2, 4,
4
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h>
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
}
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)
int yydebug;
#else
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
static YYSIZE_T
yystrlen (const char *yystr)
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
static char *
yystpcpy (char *yydest, const char *yysrc)
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
const char *yyformat = YY_NULLPTR;
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yycount = 0;
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
int yyxbegin = yyn < 0 ? -yyn : 0;
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
#endif
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
{
YYUSE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
int yychar;
YYSTYPE yylval;
int yynerrs;
int
yyparse (void)
{
int yystate;
int yyerrstatus;
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
YYSIZE_T yystacksize;
int yyn;
int yyresult;
int yytoken = 0;
YYSTYPE yyval;
#if YYERROR_VERBOSE
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
int yylen = 0;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY;
goto yysetstate;
yynewstate:
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
#else
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
yybackup:
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = yylex ();
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
if (yyerrstatus)
yyerrstatus--;
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
yychar = YYEMPTY;
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
yyreduce:
yylen = yyr2[yyn];
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
#line 996 "gen-ops-parser.y"
{
start_code_block = ((yyvsp[-3].blocks)).code;
start_header_block = ((yyvsp[-3].blocks)).header;
end_code_block = ((yyvsp[0].blocks)).code;;
end_header_block = ((yyvsp[0].blocks)).header;
}
#line 2378 "gen-ops-parser.c"
break;
case 3:
#line 1005 "gen-ops-parser.y"
{ ((yyval.blocks)).header = 0; ((yyval.blocks)).code = 0; }
#line 2384 "gen-ops-parser.c"
break;
case 4:
#line 1006 "gen-ops-parser.y"
{ ((yyval.blocks)).header = 0; ((yyval.blocks)).code = (yyvsp[0].name); }
#line 2390 "gen-ops-parser.c"
break;
case 5:
#line 1007 "gen-ops-parser.y"
{ ((yyval.blocks)).header = (yyvsp[0].name); ((yyval.blocks)).code = 0; }
#line 2396 "gen-ops-parser.c"
break;
case 6:
#line 1008 "gen-ops-parser.y"
{
((yyval.blocks)).code = (yyvsp[-1].name);
((yyval.blocks)).header = (yyvsp[0].name);
}
#line 2405 "gen-ops-parser.c"
break;
case 7:
#line 1012 "gen-ops-parser.y"
{
((yyval.blocks)).code = (yyvsp[0].name);
((yyval.blocks)).header = (yyvsp[-1].name);
}
#line 2414 "gen-ops-parser.c"
break;
case 8:
#line 1019 "gen-ops-parser.y"
{
genops_create_opcode_header(((yyvsp[0].opcode_list_header)).declaration,
((yyvsp[0].opcode_list_header)).define_start,
((yyvsp[0].opcode_list_header)).counter_prefix_expr);
}
#line 2424 "gen-ops-parser.c"
break;
case 10:
#line 1028 "gen-ops-parser.y"
{
((yyval.opcode_list_header)).declaration = (yyvsp[-3].name);
((yyval.opcode_list_header)).define_start = (yyvsp[-1].name);
((yyval.opcode_list_header)).counter_prefix_expr = 0;
}
#line 2434 "gen-ops-parser.c"
break;
case 11:
#line 1033 "gen-ops-parser.y"
{
((yyval.opcode_list_header)).declaration = (yyvsp[-5].name);
((yyval.opcode_list_header)).define_start = (yyvsp[-3].name);
((yyval.opcode_list_header)).counter_prefix_expr = (yyvsp[-1].name);
}
#line 2444 "gen-ops-parser.c"
break;
case 12:
#line 1041 "gen-ops-parser.y"
{
genops_add_opcode(((yyvsp[0].opcode)).name, ((yyvsp[0].opcode)).type,
((yyvsp[0].opcode)).oper, ((yyvsp[0].opcode)).dest_flags,
((yyvsp[0].opcode)).input1_flags,
((yyvsp[0].opcode)).input2_flags,
((yyvsp[0].opcode)).expression,
((yyvsp[0].opcode)).intrinsic_flags,
((yyvsp[0].opcode)).signature,
((yyvsp[0].opcode)).intrinsic);
}
#line 2459 "gen-ops-parser.c"
break;
case 13:
#line 1051 "gen-ops-parser.y"
{
genops_add_opcode(((yyvsp[0].opcode)).name, ((yyvsp[0].opcode)).type,
((yyvsp[0].opcode)).oper, ((yyvsp[0].opcode)).dest_flags,
((yyvsp[0].opcode)).input1_flags,
((yyvsp[0].opcode)).input2_flags,
((yyvsp[0].opcode)).expression,
((yyvsp[0].opcode)).intrinsic_flags,
((yyvsp[0].opcode)).signature,
((yyvsp[0].opcode)).intrinsic);
}
#line 2474 "gen-ops-parser.c"
break;
case 14:
#line 1064 "gen-ops-parser.y"
{
((yyval.opcode)).name = ((yyvsp[-2].opcode_header)).name;
((yyval.opcode)).type = 0;
((yyval.opcode)).oper = ((yyvsp[-2].opcode_header)).oper;
((yyval.opcode)).dest_flags = VALUE_FLAG_EMPTY;
((yyval.opcode)).input1_flags = VALUE_FLAG_EMPTY;
((yyval.opcode)).input2_flags = VALUE_FLAG_EMPTY;
((yyval.opcode)).expression = 0;
((yyval.opcode)).intrinsic_flags = 0;
((yyval.opcode)).signature = SIG_NONE;
((yyval.opcode)).intrinsic = 0;;
}
#line 2491 "gen-ops-parser.c"
break;
case 15:
#line 1076 "gen-ops-parser.y"
{
((yyval.opcode)).name = ((yyvsp[-3].opcode_header)).name;
((yyval.opcode)).type = ((yyvsp[-1].opcode_properties)).type;
((yyval.opcode)).oper = ((yyvsp[-3].opcode_header)).oper;
((yyval.opcode)).dest_flags = ((yyvsp[-1].opcode_properties)).dest_flags;
((yyval.opcode)).input1_flags = ((yyvsp[-1].opcode_properties)).input1_flags;
((yyval.opcode)).input2_flags = ((yyvsp[-1].opcode_properties)).input2_flags;
((yyval.opcode)).expression = ((yyvsp[-1].opcode_properties)).expression;
((yyval.opcode)).intrinsic_flags = ((yyvsp[-1].opcode_properties)).intrinsic_flags;
((yyval.opcode)).signature = ((yyvsp[-1].opcode_properties)).signature;
((yyval.opcode)).intrinsic = ((yyvsp[-1].opcode_properties)).intrinsic;;
}
#line 2508 "gen-ops-parser.c"
break;
case 16:
#line 1091 "gen-ops-parser.y"
{
((yyval.opcode_header)).name = (yyvsp[-1].name);
((yyval.opcode_header)).oper = OP_NONE;
}
#line 2517 "gen-ops-parser.c"
break;
case 17:
#line 1095 "gen-ops-parser.y"
{
((yyval.opcode_header)).name = (yyvsp[-3].name);
((yyval.opcode_header)).oper = (yyvsp[-1].value);
}
#line 2526 "gen-ops-parser.c"
break;
case 18:
#line 1102 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = (yyvsp[0].value);
((yyval.opcode_properties)).dest_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).input1_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).input2_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).expression = 0;
((yyval.opcode_properties)).intrinsic_flags = 0;
((yyval.opcode_properties)).signature = SIG_NONE;
((yyval.opcode_properties)).intrinsic = 0;;
}
#line 2541 "gen-ops-parser.c"
break;
case 19:
#line 1112 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = 0;
((yyval.opcode_properties)).dest_flags = ((yyvsp[0].opcode_values)).dest_flags;
((yyval.opcode_properties)).input1_flags = ((yyvsp[0].opcode_values)).input1_flags;
((yyval.opcode_properties)).input2_flags = ((yyvsp[0].opcode_values)).input2_flags;
((yyval.opcode_properties)).expression = 0;
((yyval.opcode_properties)).intrinsic_flags = 0;
((yyval.opcode_properties)).signature = SIG_NONE;
((yyval.opcode_properties)).intrinsic = 0;;
}
#line 2556 "gen-ops-parser.c"
break;
case 20:
#line 1122 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = 0;
((yyval.opcode_properties)).dest_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).input1_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).input2_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).expression = (yyvsp[0].name);
((yyval.opcode_properties)).intrinsic_flags = 0;
((yyval.opcode_properties)).signature = SIG_NONE;
((yyval.opcode_properties)).intrinsic = 0;;
}
#line 2571 "gen-ops-parser.c"
break;
case 21:
#line 1132 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = 0;
((yyval.opcode_properties)).dest_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).input1_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).input2_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_properties)).expression = 0;
((yyval.opcode_properties)).intrinsic_flags = ((yyvsp[0].intrinsic_info)).intrinsic_flags;
((yyval.opcode_properties)).signature = ((yyvsp[0].intrinsic_info)).signature;
((yyval.opcode_properties)).intrinsic = ((yyvsp[0].intrinsic_info)).intrinsic;;
}
#line 2586 "gen-ops-parser.c"
break;
case 22:
#line 1142 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = (yyvsp[0].value);
((yyval.opcode_properties)).dest_flags = ((yyvsp[-2].opcode_properties)).dest_flags;
((yyval.opcode_properties)).input1_flags = ((yyvsp[-2].opcode_properties)).input1_flags;
((yyval.opcode_properties)).input2_flags = ((yyvsp[-2].opcode_properties)).input2_flags;
((yyval.opcode_properties)).expression = ((yyvsp[-2].opcode_properties)).expression;
((yyval.opcode_properties)).intrinsic_flags = ((yyvsp[-2].opcode_properties)).intrinsic_flags;
((yyval.opcode_properties)).signature = ((yyvsp[-2].opcode_properties)).signature;
((yyval.opcode_properties)).intrinsic = ((yyvsp[-2].opcode_properties)).intrinsic;;
}
#line 2601 "gen-ops-parser.c"
break;
case 23:
#line 1152 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = ((yyvsp[-2].opcode_properties)).type;
((yyval.opcode_properties)).dest_flags = ((yyvsp[0].opcode_values)).dest_flags;
((yyval.opcode_properties)).input1_flags = ((yyvsp[0].opcode_values)).input1_flags;
((yyval.opcode_properties)).input2_flags = ((yyvsp[0].opcode_values)).input2_flags;
((yyval.opcode_properties)).expression = ((yyvsp[-2].opcode_properties)).expression;
((yyval.opcode_properties)).intrinsic_flags = ((yyvsp[-2].opcode_properties)).intrinsic_flags;
((yyval.opcode_properties)).signature = ((yyvsp[-2].opcode_properties)).signature;
((yyval.opcode_properties)).intrinsic = ((yyvsp[-2].opcode_properties)).intrinsic;;
}
#line 2616 "gen-ops-parser.c"
break;
case 24:
#line 1162 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = ((yyvsp[-2].opcode_properties)).type;
((yyval.opcode_properties)).dest_flags = ((yyvsp[-2].opcode_properties)).dest_flags;
((yyval.opcode_properties)).input1_flags = ((yyvsp[-2].opcode_properties)).input1_flags;
((yyval.opcode_properties)).input2_flags = ((yyvsp[-2].opcode_properties)).input2_flags;
((yyval.opcode_properties)).expression = (yyvsp[0].name);
((yyval.opcode_properties)).intrinsic_flags = ((yyvsp[-2].opcode_properties)).intrinsic_flags;
((yyval.opcode_properties)).signature = ((yyvsp[-2].opcode_properties)).signature;
((yyval.opcode_properties)).intrinsic = ((yyvsp[-2].opcode_properties)).intrinsic;;
}
#line 2631 "gen-ops-parser.c"
break;
case 25:
#line 1172 "gen-ops-parser.y"
{
((yyval.opcode_properties)).type = ((yyvsp[-2].opcode_properties)).type;
((yyval.opcode_properties)).dest_flags = ((yyvsp[-2].opcode_properties)).dest_flags;
((yyval.opcode_properties)).input1_flags = ((yyvsp[-2].opcode_properties)).input1_flags;
((yyval.opcode_properties)).input2_flags = ((yyvsp[-2].opcode_properties)).input2_flags;
((yyval.opcode_properties)).expression = ((yyvsp[-2].opcode_properties)).expression;
((yyval.opcode_properties)).intrinsic_flags = ((yyvsp[0].intrinsic_info)).intrinsic_flags;
((yyval.opcode_properties)).signature = ((yyvsp[0].intrinsic_info)).signature;
((yyval.opcode_properties)).intrinsic = ((yyvsp[0].intrinsic_info)).intrinsic;;
}
#line 2646 "gen-ops-parser.c"
break;
case 26:
#line 1185 "gen-ops-parser.y"
{ (yyval.value) = (yyvsp[-1].value); }
#line 2652 "gen-ops-parser.c"
break;
case 27:
#line 1189 "gen-ops-parser.y"
{ (yyval.value) = OP_TYPE_ADDRESS_OF_LABEL; }
#line 2658 "gen-ops-parser.c"
break;
case 28:
#line 1190 "gen-ops-parser.y"
{ (yyval.value) = OP_TYPE_BRANCH; }
#line 2664 "gen-ops-parser.c"
break;
case 29:
#line 1191 "gen-ops-parser.y"
{ (yyval.value) = OP_TYPE_CALL; }
#line 2670 "gen-ops-parser.c"
break;
case 30:
#line 1192 "gen-ops-parser.y"
{ (yyval.value) = OP_TYPE_CALL_EXTERNAL; }
#line 2676 "gen-ops-parser.c"
break;
case 31:
#line 1193 "gen-ops-parser.y"
{ (yyval.value) = OP_TYPE_JUMP_TABLE; }
#line 2682 "gen-ops-parser.c"
break;
case 32:
#line 1194 "gen-ops-parser.y"
{ (yyval.value) = OP_TYPE_REG; }
#line 2688 "gen-ops-parser.c"
break;
case 33:
#line 1198 "gen-ops-parser.y"
{
((yyval.opcode_values)).dest_flags = (yyvsp[-1].value);
((yyval.opcode_values)).input1_flags = VALUE_FLAG_EMPTY;
((yyval.opcode_values)).input2_flags = VALUE_FLAG_EMPTY;
}
#line 2698 "gen-ops-parser.c"
break;
case 34:
#line 1203 "gen-ops-parser.y"
{
((yyval.opcode_values)).dest_flags = (yyvsp[-3].value);
((yyval.opcode_values)).input1_flags = (yyvsp[-1].value);
((yyval.opcode_values)).input2_flags = VALUE_FLAG_EMPTY;
}
#line 2708 "gen-ops-parser.c"
break;
case 35:
#line 1208 "gen-ops-parser.y"
{
((yyval.opcode_values)).dest_flags = (yyvsp[-5].value);
((yyval.opcode_values)).input1_flags = (yyvsp[-3].value);
((yyval.opcode_values)).input2_flags = (yyvsp[-1].value);
}
#line 2718 "gen-ops-parser.c"
break;
case 36:
#line 1216 "gen-ops-parser.y"
{ (yyval.name) = (yyvsp[0].name); }
#line 2724 "gen-ops-parser.c"
break;
case 37:
#line 1220 "gen-ops-parser.y"
{ (yyval.value) = OP_NONE; }
#line 2730 "gen-ops-parser.c"
break;
case 38:
#line 1221 "gen-ops-parser.y"
{ (yyval.value) = OP_ADD; }
#line 2736 "gen-ops-parser.c"
break;
case 39:
#line 1222 "gen-ops-parser.y"
{ (yyval.value) = OP_SUB; }
#line 2742 "gen-ops-parser.c"
break;
case 40:
#line 1223 "gen-ops-parser.y"
{ (yyval.value) = OP_MUL; }
#line 2748 "gen-ops-parser.c"
break;
case 41:
#line 1224 "gen-ops-parser.y"
{ (yyval.value) = OP_DIV; }
#line 2754 "gen-ops-parser.c"
break;
case 42:
#line 1225 "gen-ops-parser.y"
{ (yyval.value) = OP_REM; }
#line 2760 "gen-ops-parser.c"
break;
case 43:
#line 1226 "gen-ops-parser.y"
{ (yyval.value) = OP_NEG; }
#line 2766 "gen-ops-parser.c"
break;
case 44:
#line 1227 "gen-ops-parser.y"
{ (yyval.value) = OP_AND; }
#line 2772 "gen-ops-parser.c"
break;
case 45:
#line 1228 "gen-ops-parser.y"
{ (yyval.value) = OP_OR; }
#line 2778 "gen-ops-parser.c"
break;
case 46:
#line 1229 "gen-ops-parser.y"
{ (yyval.value) = OP_XOR; }
#line 2784 "gen-ops-parser.c"
break;
case 47:
#line 1230 "gen-ops-parser.y"
{ (yyval.value) = OP_NOT; }
#line 2790 "gen-ops-parser.c"
break;
case 48:
#line 1231 "gen-ops-parser.y"
{ (yyval.value) = OP_SHL; }
#line 2796 "gen-ops-parser.c"
break;
case 49:
#line 1232 "gen-ops-parser.y"
{ (yyval.value) = OP_SHR; }
#line 2802 "gen-ops-parser.c"
break;
case 50:
#line 1233 "gen-ops-parser.y"
{ (yyval.value) = OP_SHR_UN; }
#line 2808 "gen-ops-parser.c"
break;
case 51:
#line 1234 "gen-ops-parser.y"
{ (yyval.value) = OP_EQ; }
#line 2814 "gen-ops-parser.c"
break;
case 52:
#line 1235 "gen-ops-parser.y"
{ (yyval.value) = OP_NE; }
#line 2820 "gen-ops-parser.c"
break;
case 53:
#line 1236 "gen-ops-parser.y"
{ (yyval.value) = OP_LE; }
#line 2826 "gen-ops-parser.c"
break;
case 54:
#line 1237 "gen-ops-parser.y"
{ (yyval.value) = OP_LT; }
#line 2832 "gen-ops-parser.c"
break;
case 55:
#line 1238 "gen-ops-parser.y"
{ (yyval.value) = OP_GE; }
#line 2838 "gen-ops-parser.c"
break;
case 56:
#line 1239 "gen-ops-parser.y"
{ (yyval.value) = OP_GT; }
#line 2844 "gen-ops-parser.c"
break;
case 57:
#line 1240 "gen-ops-parser.y"
{ (yyval.value) = OP_COPY; }
#line 2850 "gen-ops-parser.c"
break;
case 58:
#line 1241 "gen-ops-parser.y"
{ (yyval.value) = OP_ADDRESS_OF; }
#line 2856 "gen-ops-parser.c"
break;
case 59:
#line 1245 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_EMPTY; }
#line 2862 "gen-ops-parser.c"
break;
case 60:
#line 1246 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_INT; }
#line 2868 "gen-ops-parser.c"
break;
case 61:
#line 1247 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_LONG; }
#line 2874 "gen-ops-parser.c"
break;
case 62:
#line 1248 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_PTR; }
#line 2880 "gen-ops-parser.c"
break;
case 63:
#line 1249 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_FLOAT32; }
#line 2886 "gen-ops-parser.c"
break;
case 64:
#line 1250 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_FLOAT64; }
#line 2892 "gen-ops-parser.c"
break;
case 65:
#line 1251 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_NFLOAT; }
#line 2898 "gen-ops-parser.c"
break;
case 66:
#line 1252 "gen-ops-parser.y"
{ (yyval.value) = VALUE_FLAG_ANY; }
#line 2904 "gen-ops-parser.c"
break;
case 67:
#line 1256 "gen-ops-parser.y"
{
((yyval.intrinsic_info)).intrinsic_flags = (yyvsp[-1].name);
((yyval.intrinsic_info)).signature = SIG_NONE;
((yyval.intrinsic_info)).intrinsic = 0;;
}
#line 2914 "gen-ops-parser.c"
break;
case 68:
#line 1261 "gen-ops-parser.y"
{
((yyval.intrinsic_info)).intrinsic_flags = 0;
((yyval.intrinsic_info)).signature = (yyvsp[-1].value);
((yyval.intrinsic_info)).intrinsic = 0;
}
#line 2924 "gen-ops-parser.c"
break;
case 69:
#line 1266 "gen-ops-parser.y"
{
((yyval.intrinsic_info)).intrinsic_flags = 0;
((yyval.intrinsic_info)).signature = (yyvsp[-1].value);
((yyval.intrinsic_info)).intrinsic = (yyvsp[-3].name);
}
#line 2934 "gen-ops-parser.c"
break;
case 70:
#line 1274 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_i; }
#line 2940 "gen-ops-parser.c"
break;
case 71:
#line 1275 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_ii; }
#line 2946 "gen-ops-parser.c"
break;
case 72:
#line 1276 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_piii; }
#line 2952 "gen-ops-parser.c"
break;
case 73:
#line 1277 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_iI; }
#line 2958 "gen-ops-parser.c"
break;
case 74:
#line 1278 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_II; }
#line 2964 "gen-ops-parser.c"
break;
case 75:
#line 1279 "gen-ops-parser.y"
{ (yyval.value) = SIG_I_I; }
#line 2970 "gen-ops-parser.c"
break;
case 76:
#line 1280 "gen-ops-parser.y"
{ (yyval.value) = SIG_I_II; }
#line 2976 "gen-ops-parser.c"
break;
case 77:
#line 1281 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_pIII; }
#line 2982 "gen-ops-parser.c"
break;
case 78:
#line 1282 "gen-ops-parser.y"
{ (yyval.value) = SIG_l_l; }
#line 2988 "gen-ops-parser.c"
break;
case 79:
#line 1283 "gen-ops-parser.y"
{ (yyval.value) = SIG_l_ll; }
#line 2994 "gen-ops-parser.c"
break;
case 80:
#line 1284 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_plll; }
#line 3000 "gen-ops-parser.c"
break;
case 81:
#line 1285 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_l; }
#line 3006 "gen-ops-parser.c"
break;
case 82:
#line 1286 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_ll; }
#line 3012 "gen-ops-parser.c"
break;
case 83:
#line 1287 "gen-ops-parser.y"
{ (yyval.value) = SIG_l_lI; }
#line 3018 "gen-ops-parser.c"
break;
case 84:
#line 1288 "gen-ops-parser.y"
{ (yyval.value) = SIG_L_L; }
#line 3024 "gen-ops-parser.c"
break;
case 85:
#line 1289 "gen-ops-parser.y"
{ (yyval.value) = SIG_L_LL; }
#line 3030 "gen-ops-parser.c"
break;
case 86:
#line 1290 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_pLLL; }
#line 3036 "gen-ops-parser.c"
break;
case 87:
#line 1291 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_LL; }
#line 3042 "gen-ops-parser.c"
break;
case 88:
#line 1292 "gen-ops-parser.y"
{ (yyval.value) = SIG_L_LI; }
#line 3048 "gen-ops-parser.c"
break;
case 89:
#line 1293 "gen-ops-parser.y"
{ (yyval.value) = SIG_f_f; }
#line 3054 "gen-ops-parser.c"
break;
case 90:
#line 1294 "gen-ops-parser.y"
{ (yyval.value) = SIG_f_ff; }
#line 3060 "gen-ops-parser.c"
break;
case 91:
#line 1295 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_f; }
#line 3066 "gen-ops-parser.c"
break;
case 92:
#line 1296 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_ff; }
#line 3072 "gen-ops-parser.c"
break;
case 93:
#line 1297 "gen-ops-parser.y"
{ (yyval.value) = SIG_d_d; }
#line 3078 "gen-ops-parser.c"
break;
case 94:
#line 1298 "gen-ops-parser.y"
{ (yyval.value) = SIG_d_dd; }
#line 3084 "gen-ops-parser.c"
break;
case 95:
#line 1299 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_d; }
#line 3090 "gen-ops-parser.c"
break;
case 96:
#line 1300 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_dd; }
#line 3096 "gen-ops-parser.c"
break;
case 97:
#line 1301 "gen-ops-parser.y"
{ (yyval.value) = SIG_D_D; }
#line 3102 "gen-ops-parser.c"
break;
case 98:
#line 1302 "gen-ops-parser.y"
{ (yyval.value) = SIG_D_DD; }
#line 3108 "gen-ops-parser.c"
break;
case 99:
#line 1303 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_D; }
#line 3114 "gen-ops-parser.c"
break;
case 100:
#line 1304 "gen-ops-parser.y"
{ (yyval.value) = SIG_i_DD; }
#line 3120 "gen-ops-parser.c"
break;
case 101:
#line 1305 "gen-ops-parser.y"
{ (yyval.value) = SIG_conv; }
#line 3126 "gen-ops-parser.c"
break;
case 102:
#line 1306 "gen-ops-parser.y"
{ (yyval.value) = SIG_conv_ovf; }
#line 3132 "gen-ops-parser.c"
break;
case 103:
#line 1310 "gen-ops-parser.y"
{ (yyval.name) = (yyvsp[0].name); }
#line 3138 "gen-ops-parser.c"
break;
case 104:
#line 1311 "gen-ops-parser.y"
{
char *cp = malloc(strlen((yyvsp[-1].name)) + strlen((yyvsp[0].name)) + 1);
if(!cp)
{
exit(1);
}
strcpy(cp, (yyvsp[-1].name));
strcat(cp, (yyvsp[0].name));
free((yyvsp[-1].name));
free((yyvsp[0].name));
(yyval.name) = cp;
}
#line 3155 "gen-ops-parser.c"
break;
case 105:
#line 1326 "gen-ops-parser.y"
{ }
#line 3161 "gen-ops-parser.c"
break;
case 109:
#line 1336 "gen-ops-parser.y"
{
genops_set_option((yyvsp[-2].name), (yyvsp[0].name));
}
#line 3169 "gen-ops-parser.c"
break;
case 110:
#line 1339 "gen-ops-parser.y"
{
genops_set_option((yyvsp[-2].name), (yyvsp[0].name));
}
#line 3177 "gen-ops-parser.c"
break;
#line 3181 "gen-ops-parser.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
yyerrlab:
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif
}
if (yyerrstatus == 3)
{
if (yychar <= YYEOF)
{
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}
}
goto yyerrlab1;
yyerrorlab:
if ( 0)
goto yyerrorlab;
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
yyerrlab1:
yyerrstatus = 3;
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
yyacceptlab:
yyresult = 0;
goto yyreturn;
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
#endif
yyreturn:
if (yychar != YYEMPTY)
{
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
return yyresult;
}
#line 1344 "gen-ops-parser.y"
static int
genops_parseargs(int argc, char *argv[])
{
int current;
current = 1;
while(current < argc - 1)
{
if(!strcmp(argv[current], "-H") ||
!strcmp(argv[current], "--header"))
{
genops_task = TASK_GEN_HEADER;
}
else if(!strcmp(argv[current], "-T") ||
!strcmp(argv[current], "--table"))
{
genops_task = TASK_GEN_TABLE;
}
else if(!strcmp(argv[current], "--help"))
{
return 1;
}
else
{
fprintf(stderr, "Invalid commandline option %s\n",
argv[current]);
return 1;
}
++current;
}
if(genops_task == TASK_GEN_NONE)
{
return 1;
}
if(argc > 1)
{
if(strcmp(argv[argc - 1], "-"))
{
genops_file = fopen(argv[argc - 1], "r");
if(!genops_file)
{
perror(argv[argc - 1]);
return 1;
}
genops_file_needs_close = 1;
}
else
{
genops_file = stdin;
}
}
else
{
return 1;
}
return 0;
}
static void
genops_output_defines(const char *define_start, const char *counter_prefix_expr)
{
struct genops_opcode *current;
int start_len;
int opcode_no;
int name_len;
int num_tabs;
start_len = strlen(define_start);
opcode_no = 0;
current = opcode_header->first_opcode;
while(current)
{
char *upper_name;
upper_name = genops_string_upper(current->name);
if(upper_name == 0)
{
perror(genops_filename);
exit(1);
}
printf("#define\t%s%s", define_start, upper_name);
name_len = strlen(upper_name) + 8 + start_len;
num_tabs = 8 - name_len / 8;
while(num_tabs > 0)
{
printf("\t");
--num_tabs;
}
if(counter_prefix_expr)
{
printf("(%s + 0x%04X)\n", counter_prefix_expr, opcode_no);
}
else
{
printf("0x%04X\n", opcode_no);
}
free(upper_name);
current = current->next;
++opcode_no;
}
printf("#define\t%s%s", define_start, "NUM_OPCODES");
name_len = 11 + 8 + start_len;
num_tabs = 8 - name_len / 8;
while(num_tabs > 0)
{
printf("\t");
--num_tabs;
}
printf("0x%04X\n", opcode_no);
}
static void
genops_output_defs(const char *filename)
{
printf("/%c Automatically generated from %s - DO NOT EDIT %c/\n",
'*', filename, '*');
if(start_header_block)
{
printf("%s", start_header_block);
}
genops_output_defines(opcode_header->define_start,
opcode_header->counter_prefix_expr);
if(end_header_block)
{
printf("%s", end_header_block);
}
}
static void
genops_output_ops(void)
{
struct genops_opcode *current;
printf("%s = {\n", opcode_header->declaration);
current = opcode_header->first_opcode;
while(current)
{
int needs_or = 0;
printf("\t{\"%s\"", current->name);
if(current->type || current->oper || current->dest_flags ||
current->input1_flags || current->input2_flags||
current->expression)
printf(", ");
needs_or = genops_output_type(current->type, 0);
needs_or = genops_output_oper(current->oper, needs_or);
needs_or = genops_output_value_flags("JIT_OPCODE_DEST", current->dest_flags, needs_or);
needs_or = genops_output_value_flags("JIT_OPCODE_SRC1", current->input1_flags, needs_or);
needs_or = genops_output_value_flags("JIT_OPCODE_SRC2", current->input2_flags, needs_or);
needs_or = genops_output_expression(current->expression, needs_or);
if(!needs_or)
{
printf(", 0");
}
printf("}");
current = current->next;
if(current)
{
printf(",\n");
}
else
{
printf("\n");
}
}
printf("};\n");
}
static void
genops_output_intrinsic_table(const char *define_start)
{
struct genops_opcode *current;
printf("%s = {\n", genops_intrinsic_decl);
current = opcode_header->first_opcode;
while(current)
{
printf("\t{");
if(current->intrinsic_info.flags)
{
printf("%s", current->intrinsic_info.flags);
}
else
{
printf("%i", 0);
}
printf(", ");
genops_output_signature(current->intrinsic_info.signature);
printf(", ");
if(current->intrinsic_info.intrinsic)
{
printf("%s", current->intrinsic_info.intrinsic);
}
else
{
printf("0");
}
printf("}");
current = current->next;
if(current)
{
printf(",\n");
}
else
{
printf("\n");
}
}
printf("};\n");
}
static void
genops_output_opcode_table(const char *filename)
{
printf("/%c Automatically generated from %s - DO NOT EDIT %c/\n",
'*', filename, '*');
if(start_code_block)
{
printf("%s", start_code_block);
}
genops_output_ops();
if(genops_gen_intrinsic_table)
{
printf("\n");
genops_output_intrinsic_table(opcode_header->define_start);
}
if(end_code_block)
{
printf("%s", end_code_block);
}
}
#define USAGE \
"Usage: %s option file\n" \
"Generates an opcode header or table from opcode definitions\n" \
"and writes the result to standard output\n\n" \
"Options:\n" \
" -H, --header\tgenerate a header file\n" \
" -T, --table\tgenerate a file with the opcode table\n" \
" --help\tdisplay this information\n" \
"\nExactly one of header or table option must be supplied.\n" \
"If file is - standard input is used.\n"
int main(int argc, char *argv[])
{
if(genops_parseargs(argc, argv))
{
fprintf(stderr, USAGE, argv[0]);
return 1;
}
genops_filename = argv[argc - 1];
genops_linenum = 1;
yyrestart(genops_file);
if(yyparse())
{
if(genops_file_needs_close)
{
fclose(genops_file);
}
return 1;
}
if(genops_file_needs_close)
{
fclose(genops_file);
}
switch(genops_task)
{
case TASK_GEN_HEADER:
{
genops_output_defs(genops_filename);
}
break;
case TASK_GEN_TABLE:
{
genops_output_opcode_table(genops_filename);
}
break;
}
return 0;
}