|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)opmatch.c 1.1 86/02/03 Copyr 1985 Sun Micro";
3: #endif
4:
5: /*
6: * Copyright (c) 1985 by Sun Microsystems, Inc.
7: */
8:
9: #include "cpass2.h"
10:
11: /*
12: * int
13: * opmatch(op,tableop)
14: * Decides if an operator 'tableop' from the code templates
15: * table should be considered in pattern matching when a given
16: * operator 'op' shows up in an expression tree.
17: */
18:
19: extern int mamask[]; /* from match.c */
20:
21: int
22: opmatch(op,tableop)
23: unsigned op;
24: register unsigned tableop;
25: {
26: register opmtemp;
27:
28: /*
29: * check target machine dependencies against code generation options
30: */
31: if (tableop&OP68SPEC) {
32: if ((tableop&OP68020) && !use68020)
33: return(0);
34: if ((tableop&OP68881) && !use68881)
35: return(0);
36: if ((tableop&NO68020) && use68020)
37: return(0);
38: if ((tableop&NO68881) && use68881)
39: return(0);
40: }
41: tableop &= ~OP68SPEC;
42:
43: /*
44: * check for match against a specific operator
45: */
46: if ( tableop < OPSIMP )
47: return( tableop == op );
48:
49: /*
50: * check for match against an operator class (e.g., OPSIMP)
51: */
52: if ((opmtemp=mamask[tableop - OPSIMP])&SPFLG){
53: switch (op) {
54: case NAME:
55: case FCON:
56: case ICON:
57: case OREG:
58: case REG:
59: return(1);
60: case UNARY MUL:
61: /*
62: * for autoincrement addressing, recognize
63: * *p++, *--p as LTYPEs, even though they
64: * aren't. We have to finish this test
65: * by calling shumul() in match() (bletch)
66: */
67: return(1);
68: }
69: return(0);
70: }
71: /*
72: * same check on ASG operator class
73: */
74: return( (dope[op]&(opmtemp|ASGFLG)) == opmtemp );
75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.