diff --git a/mach/mips/top/table b/mach/mips/top/table index c0037f54d..f77447316 100644 --- a/mach/mips/top/table +++ b/mach/mips/top/table @@ -4,6 +4,10 @@ MAXOP 5; LABEL_STARTER '.'; +{ +int plus(const char *, const char *, const char *); +} + %%; X, Y, Z { TRUE }; diff --git a/mach/pdp/top/table b/mach/pdp/top/table index 7de05c47c..eab213b6a 100644 --- a/mach/pdp/top/table +++ b/mach/pdp/top/table @@ -6,6 +6,13 @@ MAXOP 2; LABEL_STARTER 'I'; OPC_TERMINATOR ' '; +{ +int no_side_effects(char *); +int is_register(char *); +int is_scratchreg(char *); +int carry_dead(char *); +} + %%; /* useful addressing modes: */ diff --git a/mach/powerpc/top/table b/mach/powerpc/top/table index 196cae128..6b4a8b73f 100644 --- a/mach/powerpc/top/table +++ b/mach/powerpc/top/table @@ -4,6 +4,13 @@ MAXOP 5; LABEL_STARTER '.'; +{ +int not_using_sp(const char *); +int positive(const char *); +int lift(const char *); +int plus(const char *, const char *, const char *); +} + %%; L1, L2, L3, L4, L5 { not_using_sp(VAL) }; @@ -160,7 +167,7 @@ static int liftcmp(const void *a, const void *b) { int lift(const char *s) { return bsearch(&s, liftables, sizeof(liftables) / sizeof(liftables[0]), - sizeof(liftables[0]), liftcmp); + sizeof(liftables[0]), liftcmp) != NULL; } diff --git a/util/topgen/topgen.g b/util/topgen/topgen.g index 1d0284d63..516f020ca 100644 --- a/util/topgen/topgen.g +++ b/util/topgen/topgen.g @@ -41,14 +41,14 @@ extern void error(char *s, char* s1); optim_description { struct symtab *p; } : - SPACE* parameter_line* + SPACE* parameters { p = findident("MAXOP",LOOKING,&deftable); if (p == 0) maxoperand = 2; /* default */ else maxoperand = p->s_num; } separator SPACE* mode_definitions - separator SPACE* patterns - separator + separator SPACE* patterns + separator { register int c; fprintf(genc, linedir, lineno, inpfile); while ((c = getc(input)) != EOF) { @@ -57,17 +57,25 @@ optim_description } ; +parameters : + [ parameter_line | declaration_block ]* +; + parameter_line - { struct symtab *p;} : + { struct symtab *p; + int lin; + } : identifier { p = findident(idbuf,ENTERING,&deftable);} SPACE + { lin = lineno;} value { p->s_num = atoi(buf);} /* This action in fact only needed for MAXOP */ LINE_TERMINATOR SPACE* - { fprintf(genh,"#define %s %s\n",p->s_name,buf);} + { fprintf(genh, linedir, lin, inpfile); + fprintf(genh,"#define %s %s\n",p->s_name,buf);} ; value @@ -89,6 +97,27 @@ value { *p1 = '\0';} ; +declaration_block : + OPEN_BRACKET + { fprintf(genh, linedir, lineno, inpfile);} + [ + [ LINE_TERMINATOR + | OPERAND_SEPARATOR + | PATTERN_SEPARATOR + | INSTRUCTION_SEPARATOR + | SPACE + | LETTER + | DIGIT + | OTHER + | '%' + ] + { putc(dot.t_attrib, genh);} + ]* + CLOSE_BRACKET + SPACE* + { putc('\n', genh);} +; + mode_definitions { int lin; } : { fputs("tok_chk(varno) {\n\tint r;\n", genc);