2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-03-24 14:06:46 -04:00
|
|
|
* Copyright 2001, 2011 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* This source code contains the intellectual property *
|
|
|
|
* of its copyright holder(s), and is made available *
|
|
|
|
* under a license. If you do not know the terms of *
|
|
|
|
* the license, please stop and do not read further. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "mdq.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "toktyp.h"
|
|
|
|
#include "mmemory.h"
|
|
|
|
|
|
|
|
void ex_tail(oprtype *opr)
|
|
|
|
{
|
|
|
|
LITREF octabstruct oc_tab[];
|
|
|
|
triple *t, *t1, *t2, *bitrip;
|
|
|
|
oprtype *i;
|
|
|
|
opctype c;
|
|
|
|
unsigned short w;
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(TRIP_REF == opr->oprclass);
|
2012-02-05 11:35:58 -05:00
|
|
|
t = opr->oprval.tref;
|
|
|
|
c = t->opcode;
|
|
|
|
w = oc_tab[c].octype;
|
|
|
|
if (w & OCT_EXPRLEAF)
|
|
|
|
return;
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(TRIP_REF == t->operand[0].oprclass);
|
|
|
|
assert((TRIP_REF == t->operand[1].oprclass) || (NOCLASS == t->operand[1].oprclass));
|
2012-02-05 11:35:58 -05:00
|
|
|
if (!(w & OCT_BOOL))
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
for (i = t->operand; ARRAYTOP(t->operand) > i; i++)
|
|
|
|
if (TRIP_REF == i->oprclass)
|
2012-02-05 11:35:58 -05:00
|
|
|
ex_tail(i);
|
2012-03-24 14:06:46 -04:00
|
|
|
if ((OC_COMINT == c) && (OC_BOOLINIT == (t1 = t->operand[0].oprval.tref)->opcode)) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
opr->oprval.tref = t1;
|
|
|
|
} else
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
for (t1 = t; ; t1 = t2)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(TRIP_REF == t1->operand[0].oprclass);
|
2012-02-05 11:35:58 -05:00
|
|
|
t2 = t1->operand[0].oprval.tref;
|
|
|
|
if (!(oc_tab[t2->opcode].octype & OCT_BOOL))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bitrip = maketriple(OC_BOOLINIT);
|
|
|
|
dqins(t1->exorder.bl, exorder, bitrip);
|
|
|
|
t2 = t->exorder.fl;
|
|
|
|
assert(&t2->operand[0] == opr);
|
2012-03-24 14:06:46 -04:00
|
|
|
assert((OC_COMVAL == t2->opcode) || (OC_COMINT == t2->opcode));
|
|
|
|
if (OC_COMINT == t2->opcode)
|
|
|
|
dqdel(t2, exorder);
|
2012-02-05 11:35:58 -05:00
|
|
|
t1 = maketriple(OC_BOOLFINI);
|
|
|
|
t1->operand[0] = put_tref(bitrip);
|
|
|
|
opr->oprval.tref = bitrip;
|
|
|
|
dqins(t, exorder, t1);
|
2012-03-24 14:06:46 -04:00
|
|
|
i = (oprtype *)mcalloc(SIZEOF(oprtype));
|
|
|
|
bx_tail(t, FALSE, i);
|
2012-02-05 11:35:58 -05:00
|
|
|
*i = put_tnxt(t1);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|