Added a new operator for ncg: is_rom()
This commit is contained in:
parent
069d94c39b
commit
3f950c9f17
|
@ -129,6 +129,7 @@ typedef struct exprnode *node_p;
|
||||||
#define EX_OR 41
|
#define EX_OR 41
|
||||||
#define EX_XOR 42
|
#define EX_XOR 42
|
||||||
#define EX_AND 43
|
#define EX_AND 43
|
||||||
|
#define EX_ISROM 44
|
||||||
|
|
||||||
|
|
||||||
typedef struct { /* to stack coercions */
|
typedef struct { /* to stack coercions */
|
||||||
|
|
|
@ -71,6 +71,7 @@ char opdesc[] = {
|
||||||
LLDEF|RLDEF, /* EX_OR */
|
LLDEF|RLDEF, /* EX_OR */
|
||||||
LLDEF|RLDEF, /* EX_XOR */
|
LLDEF|RLDEF, /* EX_XOR */
|
||||||
LLDEF|RLDEF, /* EX_AND */
|
LLDEF|RLDEF, /* EX_AND */
|
||||||
|
0, /* EX_ISROM */
|
||||||
};
|
};
|
||||||
|
|
||||||
string salloc(),strcpy(),strcat();
|
string salloc(),strcpy(),strcat();
|
||||||
|
@ -208,6 +209,13 @@ result_t compute(node) register node_p node; {
|
||||||
return(undefres);
|
return(undefres);
|
||||||
result.e_v.e_con = gp->gl_rom[node->ex_rnode];
|
result.e_v.e_con = gp->gl_rom[node->ex_rnode];
|
||||||
return(result);
|
return(result);
|
||||||
|
case EX_ISROM:
|
||||||
|
leaf2=dollar[node->ex_lnode];
|
||||||
|
if (leaf2.e_typ != EV_ADDR)
|
||||||
|
result.e_v.e_con = 0;
|
||||||
|
else
|
||||||
|
result.e_v.e_con = lookglo(leaf2.e_v.e_addr.ea_str) != 0;
|
||||||
|
return(result);
|
||||||
case EX_LOWW:
|
case EX_LOWW:
|
||||||
result.e_v.e_con = saveemp[node->ex_lnode].em_u.em_loper&0xFFFF;
|
result.e_v.e_con = saveemp[node->ex_lnode].em_u.em_loper&0xFFFF;
|
||||||
return(result);
|
return(result);
|
||||||
|
|
|
@ -279,7 +279,7 @@ dopseudo() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (rommask != 0) {
|
if (nromwords != 0) {
|
||||||
romcont[MAXROM]=rommask;
|
romcont[MAXROM]=rommask;
|
||||||
enterglo(labstr,romcont);
|
enterglo(labstr,romcont);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ iocc_t iops[20];
|
||||||
%token FROM TO
|
%token FROM TO
|
||||||
%token TEST MOVE STACK RETURN
|
%token TEST MOVE STACK RETURN
|
||||||
%token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING
|
%token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING
|
||||||
%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW
|
%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM
|
||||||
%token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP
|
%token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP
|
||||||
%token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER
|
%token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER
|
||||||
%token <yy_int> ADORNACCESS
|
%token <yy_int> ADORNACCESS
|
||||||
|
@ -1015,6 +1015,8 @@ expr
|
||||||
{ $$ = make_expr(TYPBOOL,EX_UFIT,i_expr($3),i_expr($5)); }
|
{ $$ = make_expr(TYPBOOL,EX_UFIT,i_expr($3),i_expr($5)); }
|
||||||
| ROM '(' emarg ',' NUMBER ')'
|
| ROM '(' emarg ',' NUMBER ')'
|
||||||
{ $$ = make_expr(TYPINT,EX_ROM,$3-1,chkincl($5,1,3)-1); }
|
{ $$ = make_expr(TYPINT,EX_ROM,$3-1,chkincl($5,1,3)-1); }
|
||||||
|
| ISROM '(' emarg ')'
|
||||||
|
{ $$ = make_expr(TYPINT,EX_ISROM,$3-1,0); }
|
||||||
| LOWW '(' emarg ')'
|
| LOWW '(' emarg ')'
|
||||||
{ $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); }
|
{ $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); }
|
||||||
| HIGHW '(' emarg ')'
|
| HIGHW '(' emarg ')'
|
||||||
|
|
|
@ -24,6 +24,7 @@ from FROM
|
||||||
gen GEN
|
gen GEN
|
||||||
highw HIGHW
|
highw HIGHW
|
||||||
inreg INREG
|
inreg INREG
|
||||||
|
is_rom ISROM
|
||||||
kills KILLS
|
kills KILLS
|
||||||
leaving LEAVING
|
leaving LEAVING
|
||||||
loww LOWW
|
loww LOWW
|
||||||
|
|
Loading…
Reference in a new issue