Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages | Examples

archc.parser.c File Reference

ArchC Parser implementation file. This file contains all functions generated by Bison for the ArchC Parser. The ArchC Grammar can be found in the archc.bison file. More...

#include "acsim.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>

Include dependency graph for archc.parser.c:

Include dependency graph

Go to the source code of this file.

Classes

union  yyalloc
union  YYSTYPE

Defines

#define YYBISON   1
#define YYSKELETON_NAME   "yacc.c"
#define YYPURE   0
#define YYLSP_NEEDED   0
#define INT   258
#define STR   259
#define DOT   260
#define COMMA   261
#define SEMICOLON   262
#define COLON   263
#define LT   264
#define GT   265
#define EQ   266
#define RPAREN   267
#define LPAREN   268
#define LBRACK   269
#define RBRACK   270
#define LBRACE   271
#define RBRACE   272
#define SET_DECODER   273
#define SET_ASM   274
#define SET_CYCLES   275
#define ID   276
#define AC_ISA_UPPER   277
#define ISA_CTOR   278
#define AC_FORMAT   279
#define AC_INSTR   280
#define CYCLE_RANGE   281
#define AC_ARCH   282
#define AC_CACHE   283
#define AC_ICACHE   284
#define AC_DCACHE   285
#define AC_MEM   286
#define AC_PC   287
#define AC_REGBANK   288
#define AC_REG   289
#define AC_STAGE   290
#define AC_PIPE   291
#define ARCH_CTOR   292
#define AC_ISA   293
#define AC_WORDSIZE   294
#define AC_FETCHSIZE   295
#define SET_ENDIAN   296
#define BIND_TO   297
#define YYDEBUG   1
#define YYERROR_VERBOSE
#define ADD_DEBUG   1
#define YYERROR_VERBOSE   1
#define yystype   YYSTYPE
#define YYSTYPE_IS_DECLARED   1
#define YYSTYPE_IS_TRIVIAL   1
#define YYSTACK_ALLOC   malloc
#define YYSTACK_FREE   free
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_BYTES(N)
#define YYCOPY(To, From, Count)
#define YYSTACK_RELOCATE(Stack)
#define YYFINAL   8
#define YYLAST   177
#define YYNTOKENS   43
#define YYNNTS   55
#define YYNRULES   86
#define YYNSTATES   231
#define YYUNDEFTOK   2
#define YYMAXUTOK   297
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
#define YYPACT_NINF   -185
#define YYTABLE_NINF   -1
#define YYSIZE_T   unsigned int
#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 yyerrlab1
#define YYFAIL   goto yyerrlab
#define YYRECOVERING()   (!!yyerrstatus)
#define YYBACKUP(Token, Value)
#define YYTERROR   1
#define YYERRCODE   256
#define YYLLOC_DEFAULT(Current, Rhs, N)
#define YYLEX   yylex ()
#define YYFPRINTF   fprintf
#define YYDPRINTF(Args)
#define YYDSYMPRINT(Args)
#define YYDSYMPRINTF(Title, Token, Value, Location)
#define YY_STACK_PRINT(Bottom, Top)
#define YY_REDUCE_PRINT(Rule)
#define YYINITDEPTH   200
#define YYMAXDEPTH   10000
#define YYPOPSTACK   (yyvsp--, yyssp--)

Typedefs

typedef enum _commalist commalist
typedef enum _descr description
typedef enum _sto_unit sto_unit
typedef YYSTYPE YYSTYPE
typedef short yysigned_char

Enumerations

enum  yytokentype {
  INT = 258, STR = 259, DOT = 260, COMMA = 261,
  SEMICOLON = 262, COLON = 263, LT = 264, GT = 265,
  EQ = 266, RPAREN = 267, LPAREN = 268, LBRACK = 269,
  RBRACK = 270, LBRACE = 271, RBRACE = 272, SET_DECODER = 273,
  SET_ASM = 274, SET_CYCLES = 275, ID = 276, AC_ISA_UPPER = 277,
  ISA_CTOR = 278, AC_FORMAT = 279, AC_INSTR = 280, CYCLE_RANGE = 281,
  AC_ARCH = 282, AC_CACHE = 283, AC_ICACHE = 284, AC_DCACHE = 285,
  AC_MEM = 286, AC_PC = 287, AC_REGBANK = 288, AC_REG = 289,
  AC_STAGE = 290, AC_PIPE = 291, ARCH_CTOR = 292, AC_ISA = 293,
  AC_WORDSIZE = 294, AC_FETCHSIZE = 295, SET_ENDIAN = 296, BIND_TO = 297
}
enum  _commalist {
  INSTR_L, STAGE_L, REG_L, PIPE_L,
  REGBANK_L, CACHE_L, MEM_L
}
enum  _descr { ISA_D, ARCH_D }
enum  _sto_unit { BYTE = 1, KBYTE = 1024, MBYTE = 1048576, GBYTE = 1073741824 }

Functions

void yyerror (char *s)
void print_comment (FILE *output, char *description)
int parse_format (char **fieldstr, int sum_size, int size_limit, ac_dec_field **field_list_head, ac_dec_field **field_list_tail)
void add_format (ac_dec_format **head, ac_dec_format **tail, char *name, char *str)
void add_instr (char *name)
void add_pipe (char *name)
void add_stage (char *name, ac_stg_list **listp)
void add_storage (char *name, unsigned size, ac_sto_types type)
int yyparse ()

Variables

FILE * output = NULL
 The output file being written.

char * current_type
 The name of the type/format associated to the object currently being parsed.

char * current_instr
 The name of the instruction currently being parsed.

char * project_name
 Name of the ArchC project being processed.

char * isa_filename
 Name for the isa class file.

char * aux
ac_dec_formatformat_ins_list
ac_dec_formatformat_ins_list_tail
 Format List for instructions.

ac_dec_formatformat_reg_list
 Format List for registers.

ac_dec_formatformat_reg_list_tail
ac_dec_instrinstr_list
 Instruction List.

ac_dec_instrinstr_list_tail
ac_dec_instrpinstr
ac_dec_fieldfield_list = NULL
 Field List.

ac_dec_listpdec_list
 Decodification List.

ac_pipe_listpipe_list = NULL *ppipe *current_pipe=NULL *pipe_list_tail = NULL
commalist list_type
 Indicates what type of list of declarations is being parsed.

description descrp
 Indicates what type of description is being parsed.

sto_unit current_unit
 Indicates what storage unit is being used.

ac_sto_types cache_type
 Indicates the type of cache being declared.

ac_sto_listfetch_device
 Indicates the device used for fetching instructions.

int instr_num
 Number of Instructions.

int declist_num
 Number of Decodification lists.

int format_num
 Number of Formats.

int const_count
 Number of Constants.

int stage_num
 Number of Stages.

int pipe_num
 Number of Pipelines.

int wordsize
 Size of the word type in bits for the current project.

int reg_width
 Bit width of registers in a regbank.

int fetchsize
 Size of the fetch word type in bits for the current project.

int line_num
 Input file line counter.

int ac_tgt_endian
 Indicates the endianess of the host machine.

int first_format = 1 largest_format_size=0
short * top
const char * yysrc
int yytype
YYSTYPE * yyvaluep
int yychar
YYSTYPE yylval
int yynerrs


Detailed Description

ArchC Parser implementation file. This file contains all functions generated by Bison for the ArchC Parser. The ArchC Grammar can be found in the archc.bison file.

Definition in file archc.parser.c.


Define Documentation

#define YY_REDUCE_PRINT Rule   ) 
 

Value:

do {                                    \
  if (yydebug)                          \
    yy_reduce_print (Rule);             \
} while (0)

#define YY_STACK_PRINT Bottom,
Top   ) 
 

Value:

do {                                                            \
  if (yydebug)                                                  \
    yy_stack_print ((Bottom), (Top));                           \
} while (0)

#define YYBACKUP Token,
Value   ) 
 

Value:

do                                                              \
  if (yychar == YYEMPTY && yylen == 1)                          \
    {                                                           \
      yychar = (Token);                                         \
      yylval = (Value);                                         \
      yytoken = YYTRANSLATE (yychar);                           \
      YYPOPSTACK;                                               \
      goto yybackup;                                            \
    }                                                           \
  else                                                          \
    {                                                           \
      yyerror ("syntax error: cannot back up");\
      YYERROR;                                                  \
    }                                                           \
while (0)

Definition at line 1146 of file archc.parser.c.

#define YYCOPY To,
From,
Count   ) 
 

Value:

do                                      \
        {                                       \
          register YYSIZE_T yyi;                \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (To)[yyi] = (From)[yyi];            \
        }                                       \
      while (0)

Definition at line 724 of file archc.parser.c.

#define YYDPRINTF Args   ) 
 

Value:

do {                                            \
  if (yydebug)                                  \
    YYFPRINTF Args;                             \
} while (0)

Definition at line 1193 of file archc.parser.c.

#define YYDSYMPRINT Args   ) 
 

Value:

do {                                            \
  if (yydebug)                                  \
    yysymprint Args;                            \
} while (0)

Definition at line 1199 of file archc.parser.c.

#define YYDSYMPRINTF Title,
Token,
Value,
Location   ) 
 

Value:

do {                                                            \
  if (yydebug)                                                  \
    {                                                           \
      YYFPRINTF (stderr, "%s ", Title);                         \
      yysymprint (stderr,                                       \
                  Token, Value);        \
      YYFPRINTF (stderr, "\n");                                 \
    }                                                           \
} while (0)

Definition at line 1205 of file archc.parser.c.

#define YYLLOC_DEFAULT Current,
Rhs,
 ) 
 

Value:

Current.first_line   = Rhs[1].first_line;      \
  Current.first_column = Rhs[1].first_column;    \
  Current.last_line    = Rhs[N].last_line;       \
  Current.last_column  = Rhs[N].last_column;

Definition at line 1170 of file archc.parser.c.

#define YYSTACK_BYTES  ) 
 

Value:

((N) * (sizeof (short) + sizeof (YYSTYPE))                              \
      + YYSTACK_GAP_MAXIMUM)

Definition at line 713 of file archc.parser.c.

#define YYSTACK_RELOCATE Stack   ) 
 

Value:

do                                                                      \
      {                                                                 \
        YYSIZE_T yynewbytes;                                            \
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
        Stack = &yyptr->Stack;                                          \
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
      }                                                                 \
    while (0)

Definition at line 740 of file archc.parser.c.


Function Documentation

void add_pipe char *  name  ) 
 

Add a pipeline to pipe list.

Parameters:
name The name of the pipeline to be added.

Definition at line 506 of file archc.parser.c.

References ac_pipe_list, _ac_pipe_list::id, _ac_pipe_list::name, _ac_pipe_list::next, pipe_list, pipe_num, and _ac_pipe_list::stages.

void add_stage char *  name,
ac_stg_list **  listp
 

Add stage to stage list.

Parameters:
name The name of the stage to be added.

Definition at line 533 of file archc.parser.c.

References ac_stg_list, _ac_stg_list::id, _ac_stg_list::name, _ac_stg_list::next, and stage_num.


Generated on Thu Jun 24 08:30:07 2004 for ArchC by doxygen 1.3.4