Example #1
0
//------------------------------------------------------------------------
// DecomposeNeg: Decompose GT_NEG.
//
// Arguments:
//    use - the LIR::Use object for the def that needs to be decomposed.
//
// Return Value:
//    The next node to process.
//
GenTree* DecomposeLongs::DecomposeNeg(LIR::Use& use)
{
    assert(use.IsInitialized());
    assert(use.Def()->OperGet() == GT_NEG);

    GenTree* tree   = use.Def();
    GenTree* gtLong = tree->gtGetOp1();
    noway_assert(gtLong->OperGet() == GT_LONG);

    LIR::Use op1(Range(), &gtLong->gtOp.gtOp1, gtLong);
    op1.ReplaceWithLclVar(m_compiler, m_blockWeight);

    LIR::Use op2(Range(), &gtLong->gtOp.gtOp2, gtLong);
    op2.ReplaceWithLclVar(m_compiler, m_blockWeight);

    // Neither GT_NEG nor the introduced temporaries have side effects.
    tree->gtFlags &= ~GTF_ALL_EFFECT;
    GenTree* loOp1 = gtLong->gtGetOp1();
    GenTree* hiOp1 = gtLong->gtGetOp2();

    Range().Remove(gtLong);

    GenTree* loResult    = tree;
    loResult->gtType     = TYP_INT;
    loResult->gtOp.gtOp1 = loOp1;

    GenTree* zero     = m_compiler->gtNewZeroConNode(TYP_INT);
    GenTree* hiAdjust = m_compiler->gtNewOperNode(GT_ADD_HI, TYP_INT, hiOp1, zero);
    GenTree* hiResult = m_compiler->gtNewOperNode(GT_NEG, TYP_INT, hiAdjust);
    hiResult->gtFlags = tree->gtFlags;

    Range().InsertAfter(loResult, zero, hiAdjust, hiResult);

    return FinalizeDecomposition(use, loResult, hiResult);
}
Example #2
0
int main()
{
	int t,i,j;
	long n;
	double p1,p2,p3,p4;
	vi[0]=1;
	FILE*f=fopen("hprob.in","r");
	FILE *g=fopen("hprob.out","w");
	fscanf(f,"%d",&t);
	for(i=0; i<t; i++) {
		fscanf(f,"%ld %lf %lf %lf",&n,&p1,&p2,&p3);
		p4=1-p1-p2-p3;
		for(j=0; j<24;j++) {
			mi[j][j]=p4;
			mu[j][j]=1;
			//initializarea matricei de trecere
			mi[j][op1(j)]=p1;
			mi[j][op2(j)]=p2;
			mi[j][op3(j)]=p3;
		}
		memcpy(rezultat,mu,sizeof(mat22));
		putere(n,mi);
		inmultirev();
		fprintf(g,"%7.5lf\n",vr[0]);
	}
	fclose(f);
	fclose(g);
	return 0;
}
Example #3
0
TEST_F(lfpTest, UnsignedRelOps) {
	const lfp_hl * tv(&addsub_tab[0][0]);
	for (size_t lc=addsub_tot-1; lc; --lc,++tv) {
		LFP op1(tv[0].h,tv[0].l);
		LFP op2(tv[1].h,tv[1].l);
		int cmp(op1.ucmp(op2));

		switch (cmp) {
		case -1:
			std::swap(op1, op2);
		case 1:
			EXPECT_TRUE (isgtu_p(op1,op2));
			EXPECT_FALSE(isgtu_p(op2,op1));

			EXPECT_TRUE (ishis_p(op1,op2));
			EXPECT_FALSE(ishis_p(op2,op1));
			break;
		case 0:
			EXPECT_FALSE(isgtu_p(op1,op2));
			EXPECT_FALSE(isgtu_p(op2,op1));

			EXPECT_TRUE (ishis_p(op1,op2));
			EXPECT_TRUE (ishis_p(op2,op1));
			break;
		default:
			FAIL() << "unexpected UCMP result: " << cmp;
		}
	}
}
Example #4
0
//----------------------------------------------------------------------
// test negation
//----------------------------------------------------------------------
TEST_F(lfpTest, Negation) {
	for (size_t idx=0; idx < addsub_cnt; ++idx) {
		LFP op1(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
		LFP op2(-op1);
		LFP sum(op1 + op2);

		ASSERT_EQ(LFP(0,0), sum);
	}	
}
Example #5
0
TEST_F(lfpTest, SubtractionRL) {
	for (size_t idx=0; idx < addsub_cnt; ++idx) {
		LFP exp(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
		LFP op2(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
		LFP op1(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
		LFP res(op1 - op2);

		ASSERT_EQ(exp, res);
	}	
}
int main(void)
{
    Operator op1;
    std::cout<<"op1(2.3, 5.6)="<<op1(2.3, 5.6)<<std::endl;
    Operator op2;

    std::cout<<"op2(1, 2, 3)="<<op2(1, 2, 3)<<std::endl;

    return 0;
}
Example #7
0
int main(){
	while (scanf("%s",a) != EOF)
	{
		char temp[10];
		int  b[1000];
		change(a,b);
		long long int ans;
		scanf("%s",temp);
		scanf("%lld",&n);
		if (strchr(temp,'/'))
			op1(b,1,n);
		else 
			op1(b,2,n);



	}

	return 0 ;
}
Example #8
0
void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) {
  // thread stacks
  VM_PrintThreads op1(output(), _locks.value());
  VMThread::execute(&op1);

  // JNI global handles
  VM_PrintJNI op2(output());
  VMThread::execute(&op2);

  // Deadlock detection
  VM_FindDeadlocks op3(output());
  VMThread::execute(&op3);
}
Example #9
0
File: e1.c Project: noodles-v6/ACM
int main() {
	int i,t;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++) scanf("%d",&a[i]);
	f[0]=f[1]=1;
	for(i=2;i<100100;i++) f[i]=(f[i-1]+f[i-2])%MOD;
	while(m--) {
		scanf("%d",&t);
		if(t==1) op1();
		else if(t==2) op2();
		else op3();
	}
	
	return 0;
}
Example #10
0
//----------------------------------------------------------------------
// fp -> double -> fp rountrip test
//----------------------------------------------------------------------
TEST_F(lfpTest, FDF_RoundTrip) {
	// since a l_fp has 64 bits in it's mantissa and a double has
	// only 54 bits available (including the hidden '1') we have to
	// make a few concessions on the roundtrip precision. The 'eps()'
	// function makes an educated guess about the avilable precision
	// and checks the difference in the two 'l_fp' values against
	// that limit.
	for (size_t idx=0; idx < addsub_cnt; ++idx) {
		LFP    op1(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
		double op2(op1);
		LFP    op3(op2);
		// for manual checks only:
		// std::cout << std::setprecision(16) << op2 << std::endl;
		ASSERT_LE(fabs(op1-op3), eps(op2));
	}	
}
Example #11
0
        void SelectObjectOperation::Run(const Reciever &reciever)
        {
            auto doc = reciever.model->documentAccess->GetDocument();
            QVector2D mousePos = (reciever.model->view->viewMatrix.inverted() *
                                  this->ScreenPosition.toVector3D()).toVector2D();
            auto conf = doc->GetSceneConf();

            for (int i = 0; i < conf->Receivers.size(); i++)
            {
                QVector2D receiverPos(conf->Receivers[i][0], conf->Receivers[i][1]);
                if (receiverPos.distanceToPoint(mousePos) < 0.4f)
                {
                    reciever.operationRunner->RunOperation(std::shared_ptr<SelectIndexedObjectOperation>(
                            new SelectIndexedObjectOperation(SELECTION_RECEIVER, i)));
                    return;
                }
            }


            for (int i = 0; i < conf->Speakers.size(); i++)
            {
                QVector2D speakersPos(conf->Speakers[i][0], conf->Speakers[i][1]);
                if (speakersPos.distanceToPoint(mousePos) < 0.4f)
                {
                    reciever.operationRunner->RunOperation(std::shared_ptr<SelectIndexedObjectOperation>(
                            new SelectIndexedObjectOperation(SELECTION_SPEAKER, i)));
                    return;
                }
            }

            for (int i = 0; i < conf->Domains.size(); i++)
            {
                QVector2D tl = conf->Domains[i].TopLeft;
                QVector2D size = conf->Domains[i].Size;

                if (PointInSquare(tl, size, mousePos))
                {
                    //execute operation that selects the correct index
                    reciever.operationRunner->RunOperation(std::shared_ptr<SelectIndexedObjectOperation>(
                            new SelectIndexedObjectOperation(SELECTION_DOMAIN, i)));
                    return;
                }
            }
            //deselects the domain
            std::shared_ptr<DeselectOperation> op1(new DeselectOperation());
            reciever.operationRunner->RunOperation(op1);
        }
Example #12
0
void SyntaxAnalyzer::ending2()
{
	if ((strcmp(cur->lex, "+")==0)||
		(strcmp(cur->lex, "-")==0)) {
		bool is_plus = false;
		if (strcmp(cur->lex, "+")==0) is_plus = true;
		next();
		op1();
		if (is_plus) {
			PolizFunPlus* tmp = new PolizFunPlus();
			add_poliz_list(tmp);
		} else {
			PolizFunMinus* tmp = new PolizFunMinus();
			add_poliz_list(tmp);
		}
	}
}
Example #13
0
void main()
{
binaryop op1(10);
binaryop op2(20);
binaryop op3;
binaryop op4;
binaryop op5;
binaryop op6;
clrscr();
op3=op1+op2;
op3.display();
op4=op1-op2;
op4.display();
op5=op1*op2;
op5.display();
op6=op1/op2;
op6.display();
getch();
}
// Implementation of "threaddump" command - essentially a remote ctrl-break
// See also: ThreadDumpDCmd class
//
static jint thread_dump(AttachOperation* op, outputStream* out) {
  bool print_concurrent_locks = false;
  if (op->arg(0) != NULL && strcmp(op->arg(0), "-l") == 0) {
    print_concurrent_locks = true;
  }

  // thread stacks
  VM_PrintThreads op1(out, print_concurrent_locks);
  VMThread::execute(&op1);

  // JNI global handles
  VM_PrintJNI op2(out);
  VMThread::execute(&op2);

  // Deadlock detection
  VM_FindDeadlocks op3(out);
  VMThread::execute(&op3);

  return JNI_OK;
}
Example #15
0
//----------------------------------------------------------------------
// test absolute value
//----------------------------------------------------------------------
TEST_F(lfpTest, Absolute) {
	for (size_t idx=0; idx < addsub_cnt; ++idx) {
		LFP op1(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
		LFP op2(op1.abs());

		ASSERT_TRUE(op2.signum() >= 0);

		if (op1.signum() >= 0)
			op1 -= op2;
		else
			op1 += op2;
		ASSERT_EQ(LFP(0,0), op1);
	}

	// There is one special case we have to check: the minimum
	// value cannot be negated, or, to be more precise, the
	// negation reproduces the original pattern.
	LFP minVal(0x80000000, 0x00000000);
	LFP minAbs(minVal.abs());
	ASSERT_EQ(-1, minVal.signum());
	ASSERT_EQ(minVal, minAbs);
}
Example #16
0
QImage* MyWidget::transform_back() const
{
    if(!image_save || frames.size() == 0 || frames_save.size() == 0)
        return image_save;

    uint w = image_save->width(),
         h = image_save->height();

    QImage *new_img = new QImage(w,h,QImage::Format_RGB32);

    QPainter painter;
    painter.begin(new_img);
    QBrush brush(QColor(0,0,0));
        QPen pen(QColor(0,0,0));
        painter.setBrush(brush);
        painter.setPen(pen);
        painter.drawRect(QRect(0,0,w-1,h-1));
    painter.end();


    for(uint i=0;i<frames.size();++i)
    {
        auto v2 = &frames, v1 = &frames_save;
        QPoint p1(v1->at(i).getPoint(0)), p2(v1->at(i).getPoint(1)),p3(v1->at(i).getPoint(2)),p4(v1->at(i).getPoint(3)),
               op1(v2->at(i).getPoint(0)), op2(v2->at(i).getPoint(1)), op3(v2->at(i).getPoint(2)), op4(v2->at(i).getPoint(3));

        std::vector<QPoint>
             vpi{p1,p2,p3,p4},
             vpo{op1,op2,op3,op4};

        BilineTransform pt;

        pt.generateFromPoints(vpo, vpi);

        pt.transformImage(*image_save, *new_img, v2->at(i));
    }
    return new_img;
}
Example #17
0
//------------------------------------------------------------------------
// DecomposeStoreInd: Decompose GT_STOREIND.
//
// Arguments:
//    use - the LIR::Use object for the def that needs to be decomposed.
//
// Return Value:
//    The next node to process.
//
// TODO-LIR: replace comments below that use embedded statements with ones that do not.
GenTree* DecomposeLongs::DecomposeStoreInd(LIR::Use& use)
{
    assert(use.IsInitialized());
    assert(use.Def()->OperGet() == GT_STOREIND);

    GenTree* tree = use.Def();

    assert(tree->gtOp.gtOp2->OperGet() == GT_LONG);

    // Example input trees (a nested embedded statement case)
    //
    //   <linkBegin Node>
    //   *  stmtExpr  void  (top level) (IL   ???...  ???)
    //   |  /--*  argPlace  ref    $280
    //   |  +--*  argPlace  int    $4a
    //   |  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //   |  |  {  |     /--*  lclVar    ref    V11 tmp9         u:3 $21c
    //   |  |  {  |     +--*  const     int    4 $44
    //   |  |  {  |  /--*  +         byref  $2c8
    //   |  |  {  |  |     {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //   |  |  {  |  |     {  |  /--*  lclFld    long   V01 arg1         u:2[+8] Fseq[i] $380
    //   |  |  {  |  |     {  \--*  st.lclVar long  (P) V21 cse8
    //   |  |  {  |  |     {  \--*    int    V21.hi (offs=0x00) -> V22 rat0
    //   |  |  {  |  |     {  \--*    int    V21.hi (offs=0x04) -> V23 rat1
    //   |  |  {  |  |  /--*  lclVar    int    V22 rat0          $380
    //   |  |  {  |  |  +--*  lclVar    int    V23 rat1
    //   |  |  {  |  +--*  gt_long   long
    //   |  |  {  \--*  storeIndir long
    //   |  +--*  lclVar    ref    V11 tmp9         u:3 (last use) $21c
    //   |  +--*  lclVar    ref    V02 tmp0         u:3 $280
    //   |  +--*  const     int    8 $4a
    //   \--*  call help void   HELPER.CORINFO_HELP_ARRADDR_ST $205
    //  <linkEndNode>
    //
    // (editor brace matching compensation: }}}}}}}}}}}}}}}}}})

    GenTree* gtLong      = tree->gtOp.gtOp2;
    unsigned blockWeight = m_block->getBBWeight(m_compiler);

    // Save address to a temp. It is used in storeIndLow and storeIndHigh trees.
    LIR::Use address(BlockRange(), &tree->gtOp.gtOp1, tree);
    address.ReplaceWithLclVar(m_compiler, blockWeight);
    JITDUMP("[DecomposeStoreInd]: Saving address tree to a temp var:\n");
    DISPTREERANGE(BlockRange(), address.Def());

    if (!gtLong->gtOp.gtOp1->OperIsLeaf())
    {
        LIR::Use op1(BlockRange(), &gtLong->gtOp.gtOp1, gtLong);
        op1.ReplaceWithLclVar(m_compiler, blockWeight);
        JITDUMP("[DecomposeStoreInd]: Saving low data tree to a temp var:\n");
        DISPTREERANGE(BlockRange(), op1.Def());
    }

    if (!gtLong->gtOp.gtOp2->OperIsLeaf())
    {
        LIR::Use op2(BlockRange(), &gtLong->gtOp.gtOp2, gtLong);
        op2.ReplaceWithLclVar(m_compiler, blockWeight);
        JITDUMP("[DecomposeStoreInd]: Saving high data tree to a temp var:\n");
        DISPTREERANGE(BlockRange(), op2.Def());
    }

    // Example trees after embedded statements for address and data are added.
    // This example saves all address and data trees into temp variables
    // to show how those embedded statements are created.
    //
    //  *  stmtExpr  void  (top level) (IL   ???...  ???)
    //  |  /--*  argPlace  ref    $280
    //  |  +--*  argPlace  int    $4a
    //  |  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |  {  |     /--*  lclVar    ref    V11 tmp9         u:3 $21c
    //  |  |  {  |     +--*  const     int    4 $44
    //  |  |  {  |  /--*  +         byref  $2c8
    //  |  |  {  \--*  st.lclVar byref  V24 rat2
    //  |  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |  {  |  /--*  lclVar    byref  V24 rat2
    //  |  |  {  |  |     {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |  {  |  |     {  |  /--*  lclFld    long   V01 arg1         u:2[+8] Fseq[i] $380380
    //  |  |  {  |  |     {  \--*  st.lclVar long  (P) V21 cse8
    //  |  |  {  |  |     {  \--*    int    V21.hi (offs=0x00) -> V22 rat0
    //  |  |  {  |  |     {  \--*    int    V21.hi (offs=0x04) -> V23 rat1
    //  |  |  {  |  |     {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |  {  |  |     {  |  /--*  lclVar    int    V22 rat0          $380
    //  |  |  {  |  |     {  \--*  st.lclVar int    V25 rat3
    //  |  |  {  |  |  /--*  lclVar    int    V25 rat3
    //  |  |  {  |  |  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |  {  |  |  |  {  |  /--*  lclVar    int    V23 rat1
    //  |  |  {  |  |  |  {  \--*  st.lclVar int    V26 rat4
    //  |  |  {  |  |  +--*  lclVar    int    V26 rat4
    //  |  |  {  |  +--*  gt_long   long
    //  |  |  {  \--*  storeIndir long
    //  |  +--*  lclVar    ref    V11 tmp9         u:3 (last use) $21c
    //  |  +--*  lclVar    ref    V02 tmp0         u:3 $280
    //  |  +--*  const     int    8 $4a
    //  \--*  call help void   HELPER.CORINFO_HELP_ARRADDR_ST $205
    //
    // (editor brace matching compensation: }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}})

    GenTree* addrBase    = tree->gtOp.gtOp1;
    GenTree* dataHigh    = gtLong->gtOp.gtOp2;
    GenTree* dataLow     = gtLong->gtOp.gtOp1;
    GenTree* storeIndLow = tree;

    // Rewrite storeIndLow tree to save only lower 32-bit data.
    //
    //  |  |  {  |  /--*  lclVar    byref  V24 rat2   (address)
    //  ...
    //  |  |  {  |  +--*  lclVar    int    V25 rat3   (lower 32-bit data)
    //  |  |  {  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |  {  |  {  |  /--*  lclVar    int    V23 rat1
    //  |  |  {  |  {  \--*  st.lclVar int    V26 rat4
    //  |  |  {  \--*  storeIndir int
    //
    // (editor brace matching compensation: }}}}}}}}})

    BlockRange().Remove(gtLong);
    BlockRange().Remove(dataHigh);
    storeIndLow->gtOp.gtOp2 = dataLow;
    storeIndLow->gtType     = TYP_INT;

    // Construct storeIndHigh tree
    //
    // | | {  *stmtExpr  void  (embedded)(IL ? ? ? ... ? ? ? )
    // | | { | / --*  lclVar    int    V26 rat4
    // | | { | | / --*  lclVar    byref  V24 rat2
    // | | { | +--*  lea(b + 4)  ref
    // | | {  \--*  storeIndir int
    //
    // (editor brace matching compensation: }}}}})

    GenTree* addrBaseHigh = new (m_compiler, GT_LCL_VAR)
        GenTreeLclVar(GT_LCL_VAR, addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum(), BAD_IL_OFFSET);
    GenTree* addrHigh =
        new (m_compiler, GT_LEA) GenTreeAddrMode(TYP_REF, addrBaseHigh, nullptr, 0, genTypeSize(TYP_INT));
    GenTree* storeIndHigh = new (m_compiler, GT_STOREIND) GenTreeStoreInd(TYP_INT, addrHigh, dataHigh);
    storeIndHigh->gtFlags = (storeIndLow->gtFlags & (GTF_ALL_EFFECT | GTF_LIVENESS_MASK));
    storeIndHigh->gtFlags |= GTF_REVERSE_OPS;

    m_compiler->gtPrepareCost(storeIndHigh);

    BlockRange().InsertAfter(storeIndLow, dataHigh, addrBaseHigh, addrHigh, storeIndHigh);

    return storeIndHigh;

    // Example final output
    //
    //  *  stmtExpr  void  (top level) (IL   ???...  ???)
    //  |  /--*  argPlace  ref    $280
    //  |  +--*  argPlace  int    $4a
    //  |  |     {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |     {  |     /--*  lclVar    ref    V11 tmp9         u:3 $21c
    //  |  |     {  |     +--*  const     int    4 $44
    //  |  |     {  |  /--*  +         byref  $2c8
    //  |  |     {  \--*  st.lclVar byref  V24 rat2
    //  |  |     {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |     {  |  /--*  lclVar    byref  V24 rat2
    //  |  |     {  |  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |     {  |  |  {  |     /--*  lclFld    int    V01 arg1         u:2[+8] Fseq[i] $380
    //  |  |     {  |  |  {  |     +--*  lclFld    int    V01 arg1         [+12]
    //  |  |     {  |  |  {  |  /--*  gt_long   long
    //  |  |     {  |  |  {  \--*  st.lclVar long  (P) V21 cse8
    //  |  |     {  |  |  {  \--*    int    V21.hi (offs=0x00) -> V22 rat0
    //  |  |     {  |  |  {  \--*    int    V21.hi (offs=0x04) -> V23 rat1
    //  |  |     {  |  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |     {  |  |  {  |  /--*  lclVar    int    V22 rat0          $380
    //  |  |     {  |  |  {  \--*  st.lclVar int    V25 rat3
    //  |  |     {  |  +--*  lclVar    int    V25 rat3
    //  |  |     {  |  {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |     {  |  {  |  /--*  lclVar    int    V23 rat1
    //  |  |     {  |  {  \--*  st.lclVar int    V26 rat4
    //  |  |     {  \--*  storeIndir int
    //  |  |     {  *  stmtExpr  void  (embedded) (IL   ???...  ???)
    //  |  |     {  |  /--*  lclVar    int    V26 rat4
    //  |  |     {  |  |  /--*  lclVar    byref  V24 rat2
    //  |  |     {  |  +--*  lea(b+4)  ref
    //  |  |     {  \--*  storeIndir int
    //  |  |  /--*  lclVar    ref    V11 tmp9         u:3 (last use) $21c
    //  |  +--*  putarg_stk [+0x00] ref
    //  |  |  /--*  lclVar    ref    V02 tmp0         u:3 $280
    //  |  +--*  putarg_reg ref
    //  |  |  /--*  const     int    8 $4a
    //  |  +--*  putarg_reg int
    //  \--*  call help void   HELPER.CORINFO_HELP_ARRADDR_ST $205
    //
    // (editor brace matching compensation: }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}})
}
Example #18
0
  ref<ConstantExpr> Executor::evalConstantExpr(const llvm::ConstantExpr *ce) {
    LLVM_TYPE_Q llvm::Type *type = ce->getType();

    ref<ConstantExpr> op1(0), op2(0), op3(0);
    int numOperands = ce->getNumOperands();

    if (numOperands > 0) op1 = evalConstant(ce->getOperand(0));
    if (numOperands > 1) op2 = evalConstant(ce->getOperand(1));
    if (numOperands > 2) op3 = evalConstant(ce->getOperand(2));

    switch (ce->getOpcode()) {
    default :
      ce->dump();
      std::cerr << "error: unknown ConstantExpr type\n"
                << "opcode: " << ce->getOpcode() << "\n";
      abort();

    case Instruction::Trunc: 
      return op1->Extract(0, getWidthForLLVMType(type));
    case Instruction::ZExt:  return op1->ZExt(getWidthForLLVMType(type));
    case Instruction::SExt:  return op1->SExt(getWidthForLLVMType(type));
    case Instruction::Add:   return op1->Add(op2);
    case Instruction::Sub:   return op1->Sub(op2);
    case Instruction::Mul:   return op1->Mul(op2);
    case Instruction::SDiv:  return op1->SDiv(op2);
    case Instruction::UDiv:  return op1->UDiv(op2);
    case Instruction::SRem:  return op1->SRem(op2);
    case Instruction::URem:  return op1->URem(op2);
    case Instruction::And:   return op1->And(op2);
    case Instruction::Or:    return op1->Or(op2);
    case Instruction::Xor:   return op1->Xor(op2);
    case Instruction::Shl:   return op1->Shl(op2);
    case Instruction::LShr:  return op1->LShr(op2);
    case Instruction::AShr:  return op1->AShr(op2);
    case Instruction::BitCast:  return op1;

    case Instruction::IntToPtr:
      return op1->ZExt(getWidthForLLVMType(type));

    case Instruction::PtrToInt:
      return op1->ZExt(getWidthForLLVMType(type));

    case Instruction::GetElementPtr: {
      ref<ConstantExpr> base = op1->ZExt(Context::get().getPointerWidth());

      for (gep_type_iterator ii = gep_type_begin(ce), ie = gep_type_end(ce);
           ii != ie; ++ii) {
        ref<ConstantExpr> addend = 
          ConstantExpr::alloc(0, Context::get().getPointerWidth());

        if (LLVM_TYPE_Q StructType *st = dyn_cast<StructType>(*ii)) {
          const StructLayout *sl = kmodule->targetData->getStructLayout(st);
          const ConstantInt *ci = cast<ConstantInt>(ii.getOperand());

          addend = ConstantExpr::alloc(sl->getElementOffset((unsigned)
                                                            ci->getZExtValue()),
                                       Context::get().getPointerWidth());
        } else {
          const SequentialType *set = cast<SequentialType>(*ii);
          ref<ConstantExpr> index = 
            evalConstant(cast<Constant>(ii.getOperand()));
          unsigned elementSize = 
            kmodule->targetData->getTypeStoreSize(set->getElementType());

          index = index->ZExt(Context::get().getPointerWidth());
          addend = index->Mul(ConstantExpr::alloc(elementSize, 
                                                  Context::get().getPointerWidth()));
        }

        base = base->Add(addend);
      }

      return base;
    }
      
    case Instruction::ICmp: {
      switch(ce->getPredicate()) {
      default: assert(0 && "unhandled ICmp predicate");
      case ICmpInst::ICMP_EQ:  return op1->Eq(op2);
      case ICmpInst::ICMP_NE:  return op1->Ne(op2);
      case ICmpInst::ICMP_UGT: return op1->Ugt(op2);
      case ICmpInst::ICMP_UGE: return op1->Uge(op2);
      case ICmpInst::ICMP_ULT: return op1->Ult(op2);
      case ICmpInst::ICMP_ULE: return op1->Ule(op2);
      case ICmpInst::ICMP_SGT: return op1->Sgt(op2);
      case ICmpInst::ICMP_SGE: return op1->Sge(op2);
      case ICmpInst::ICMP_SLT: return op1->Slt(op2);
      case ICmpInst::ICMP_SLE: return op1->Sle(op2);
      }
    }

    case Instruction::Select:
      return op1->isTrue() ? op2 : op3;

    case Instruction::FAdd:
    case Instruction::FSub:
    case Instruction::FMul:
    case Instruction::FDiv:
    case Instruction::FRem:
    case Instruction::FPTrunc:
    case Instruction::FPExt:
    case Instruction::UIToFP:
    case Instruction::SIToFP:
    case Instruction::FPToUI:
    case Instruction::FPToSI:
    case Instruction::FCmp:
      assert(0 && "floating point ConstantExprs unsupported");
    }
  }
Example #19
0
void op3(struct impl2 * a)
{
  op1(a->w2);
  op1(a->w3);
}
Example #20
0
void print_instruction(char *outBuffer, int maxLength, int address, int instruction)
{
	snprintf(outBuffer, maxLength, "%08x: ", address);
	maxLength -= strlen(outBuffer);
	outBuffer += strlen(outBuffer);

	// Special case pseudo ops
	if (opcode(instruction) == 1 && result(instruction) == 31 && op1(instruction) == 31)
	{
		snprintf(outBuffer, maxLength, "jump     %08x", address + 4 + imm(instruction));
		return;
	}

	snprintf(outBuffer, maxLength, "%-8s ", instruction_table[opcode(instruction)].name);
	maxLength -= strlen(outBuffer);
	outBuffer += strlen(outBuffer);

	switch (instruction_table[opcode(instruction)].format)
	{
		case IF_R:				// r1, r2, r3
			snprintf(outBuffer, maxLength, "r%d, r%d, r%d", result(instruction), op1(instruction), op2(instruction));
			break;

		case IF_I:				// r1, r2, n
			snprintf(outBuffer, maxLength, "r%d, r%d, 0x%x", result(instruction), op1(instruction), imm(instruction));
			break;

		case IF_I_TWO_INDIRECT:	// r1, n(r2)
			snprintf(outBuffer, maxLength, "r%d, %d(r%d)", result(instruction), imm(instruction), op1(instruction));
			break;

		case IF_I_ONE_PARAM:		// r1, n
			snprintf(outBuffer, maxLength, "r%d, 0x%x (pc + %d)", result(instruction), address + 4 + 4 
				* imm(instruction), imm(instruction));
			break;

		case IF_J:				// n
			snprintf(outBuffer, maxLength, "0x%x", imm(instruction));
			break;

		case IF_R_ONE_INDIRECT:	// (r1)
			snprintf(outBuffer, maxLength, "(r%d)", result(instruction));
			break;

		case IF_R_ONE_PARAM:
			snprintf(outBuffer, maxLength, "r%d", op1(instruction));
			break;

		case IF_R_TWO_PARAM:
			snprintf(outBuffer, maxLength, "r%d, r%d", op1(instruction), op2(instruction));
			break;
			
		case IF_CR_READ:	// rn, crn
			snprintf(outBuffer, maxLength, "r%d, cr%d", result(instruction), op1(instruction));
			break;
			
		case IF_CR_WRITE:	// crn, rn
			snprintf(outBuffer, maxLength, "cr%d, r%d", result(instruction), op1(instruction));
			break;
			
		case IF_NONE:
			break;
	}	
}
Example #21
0
//------------------------------------------------------------------------
// DecomposeStoreInd: Decompose GT_STOREIND.
//
// Arguments:
//    use - the LIR::Use object for the def that needs to be decomposed.
//
// Return Value:
//    The next node to process.
//
GenTree* DecomposeLongs::DecomposeStoreInd(LIR::Use& use)
{
    assert(use.IsInitialized());
    assert(use.Def()->OperGet() == GT_STOREIND);

    GenTree* tree = use.Def();

    assert(tree->gtOp.gtOp2->OperGet() == GT_LONG);

    // Example input (address expression omitted):
    //
    //  t51 = const     int    0x37C05E7D
    // t154 = const     int    0x2A0A3C80
    //      / --*  t51    int
    //      + --*  t154   int
    // t155 = *gt_long   long
    //      / --*  t52    byref
    //      + --*  t155   long
    //      *  storeIndir long

    GenTree* gtLong      = tree->gtOp.gtOp2;

    // Save address to a temp. It is used in storeIndLow and storeIndHigh trees.
    LIR::Use address(Range(), &tree->gtOp.gtOp1, tree);
    address.ReplaceWithLclVar(m_compiler, m_blockWeight);
    JITDUMP("[DecomposeStoreInd]: Saving address tree to a temp var:\n");
    DISPTREERANGE(Range(), address.Def());

    if (!gtLong->gtOp.gtOp1->OperIsLeaf())
    {
        LIR::Use op1(Range(), &gtLong->gtOp.gtOp1, gtLong);
        op1.ReplaceWithLclVar(m_compiler, m_blockWeight);
        JITDUMP("[DecomposeStoreInd]: Saving low data tree to a temp var:\n");
        DISPTREERANGE(Range(), op1.Def());
    }

    if (!gtLong->gtOp.gtOp2->OperIsLeaf())
    {
        LIR::Use op2(Range(), &gtLong->gtOp.gtOp2, gtLong);
        op2.ReplaceWithLclVar(m_compiler, m_blockWeight);
        JITDUMP("[DecomposeStoreInd]: Saving high data tree to a temp var:\n");
        DISPTREERANGE(Range(), op2.Def());
    }

    GenTree* addrBase    = tree->gtOp.gtOp1;
    GenTree* dataHigh    = gtLong->gtOp.gtOp2;
    GenTree* dataLow     = gtLong->gtOp.gtOp1;
    GenTree* storeIndLow = tree;

    Range().Remove(gtLong);
    Range().Remove(dataHigh);
    storeIndLow->gtOp.gtOp2 = dataLow;
    storeIndLow->gtType     = TYP_INT;

    GenTree* addrBaseHigh = new (m_compiler, GT_LCL_VAR)
    GenTreeLclVar(GT_LCL_VAR, addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum(), BAD_IL_OFFSET);
    GenTree* addrHigh =
        new (m_compiler, GT_LEA) GenTreeAddrMode(TYP_REF, addrBaseHigh, nullptr, 0, genTypeSize(TYP_INT));
    GenTree* storeIndHigh = new (m_compiler, GT_STOREIND) GenTreeStoreInd(TYP_INT, addrHigh, dataHigh);
    storeIndHigh->gtFlags = (storeIndLow->gtFlags & (GTF_ALL_EFFECT | GTF_LIVENESS_MASK));
    storeIndHigh->gtFlags |= GTF_REVERSE_OPS;

    m_compiler->lvaIncRefCnts(addrBaseHigh);

    Range().InsertAfter(storeIndLow, dataHigh, addrBaseHigh, addrHigh, storeIndHigh);

    return storeIndHigh;

    // Example final output:
    //
    //      /--*  t52    byref
    //      *  st.lclVar byref  V07 rat0
    // t158 = lclVar    byref  V07 rat0
    //  t51 = const     int    0x37C05E7D
    //      /--*  t158   byref
    //      +--*  t51    int
    //      *  storeIndir int
    // t154 = const     int    0x2A0A3C80
    // t159 = lclVar    byref  V07 rat0
    //        /--*  t159   byref
    // t160 = *  lea(b + 4)  ref
    //      /--*  t154   int
    //      +--*  t160   ref
    //      *  storeIndir int
}
Example #22
0
/*
 * Disassemble floating-point ("escape") instruction
 * and return updated location.
 */
db_addr_t
db_disasm_esc(db_addr_t loc, int inst, int short_addr, int size, int rex,
    char *seg)
{
	int		regmodrm;
	struct finst	*fp;
	int		mod;
	struct i_addr	address;
	char *		name;

	get_value_inc(regmodrm, loc, 1, FALSE);
	fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm, 0)];
	mod = f_mod(regmodrm);
	if (mod != 3) {
		if (*fp->f_name == '\0') {
			db_printf("<bad instruction>");
			return (loc);
		}

		/*
		 * Normal address modes.
		 */
		loc = db_read_address(loc, short_addr, regmodrm, rex, &address);
		db_printf("%s", fp->f_name);
		switch (fp->f_size) {
		case SNGL:
			db_printf("s");
			break;
		case DBLR:
			db_printf("l");
			break;
		case EXTR:
			db_printf("t");
			break;
		case WORD:
			db_printf("s");
			break;
		case LONG:
			db_printf("l");
			break;
		case QUAD:
			db_printf("q");
			break;
		default:
			break;
		}
		db_printf("\t");
		db_print_address(seg, BYTE, &address);
	} else {
		/*
		 * 'reg-reg' - special formats
		 */
		switch (fp->f_rrmode) {
		case op2(ST,STI):
			name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
			db_printf("%s\t%%st,%%st(%d)",name, f_rm(regmodrm, 0));
			break;
		case op2(STI,ST):
			name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
			db_printf("%s\t%%st(%d),%%st",name, f_rm(regmodrm, 0));
			break;
		case op1(STI):
			name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
			db_printf("%s\t%%st(%d)",name, f_rm(regmodrm, 0));
			break;
		case op1(X):
			name = ((char * const *)fp->f_rrname)[f_rm(regmodrm,0)];
			if (*name == '\0')
				goto bad;
			db_printf("%s", name);
			break;
		case op1(XA):
			name = ((char * const *)fp->f_rrname)[f_rm(regmodrm,0)];
			if (*name == '\0')
				goto bad;
			db_printf("%s\t%%ax", name);
			break;
		default:
		bad:
			db_printf("<bad instruction>");
			break;
		}
	}

	return (loc);
}
void Tabla::justificar(){
//lee la tabla y agrega los espacios necesarios a cada celda para que quede justificado segun el operador de la columna
//agrega los espacios y vuelve a dejar la hilera en la celda correspondiente
string op="";
string op1 (">");
string op2 ("<");
string op3 ("=");
string hil;
int maxi=0;//tama;o maximo de la columna
int tamAct=0;//tama;o de la hilera en la celda actual
int espRest=0; //cantidad de espacios que se deben agregar para justificar una hilera
int lado1=0;
int lado2=0;
int der=0;
int izq=0;
pair<string, int> datos;

vector<pair<string, int> > Fil_aux;
vector<pair<string, int> > Fil;
 vector<vector <pair<string, int> > >Tab_aux;

for(it_Tab=Tab.begin(); it_Tab!=Tab.end();it_Tab++ ){
    Fil=*it_Tab;
    it_Op_Max= Ope_Max.begin();
    for(it_Fil=Fil.begin(); it_Fil!=Fil.end();it_Fil++ ){
            //justifica
            maxi=it_Op_Max->second;//longitud de la hilera mas grande de la columna
            maxi+=2;
            tamAct=it_Fil->second;
            espRest=maxi-tamAct;
            op=it_Op_Max->first;
            it_Op_Max++;

            if(op.compare(op1)==0)
            {
                //justificacio a la derecha con >
                for(int i=0; i<espRest;i++){
                    hil+=" ";
                }

                hil+=it_Fil->first;

            }else
            {
                if(op.compare(op2)==0){

                    //justificacion a la izquierda con <
                    hil+=it_Fil->first;
                    for(int j=0; j<espRest;j++){
                        hil+=" ";
                    }
                }else
                {
                    if(op.compare(op3)==0){
                        //justificacion al centro
                        if((espRest % 2)==0){
                            //se puede repartir en partes iguales a ambos lados de la hilera
                            for(int k=0;k<(espRest/2);k++){
                                hil+=" ";
                            }
                            hil+=it_Fil->first;
                            for(int v=0;v<(espRest/2);v++){
                                hil+=" ";
                            }
                        }else{
                            lado1=espRest/2;
                            lado2=espRest-lado1;
                            if(lado1>lado2){
                                der=lado1;
                                izq=lado2;
                            }else{
                                izq=lado1;
                                der=lado2;
                            }

                            for(int w=0; w<izq;w++){
                                hil+=" ";
                            }
                            hil+=it_Fil->first;
                            for(int x=0; x<der;x++){
                                hil+=" ";
                            }
                        }
                    }
                }
            }
    datos=make_pair(hil,hil.size());
    Fil_aux.push_back(datos);//ingresa la nueva hilera justificada
    hil.clear();
    }
    Tab_aux.push_back(Fil_aux);
    Fil_aux.clear();
}

    Tab.swap(Tab_aux);
}
Example #24
0
void SyntaxAnalyzer::expression()
{
	op1();
	ending1();
}
double& MyMatrix::operator()(unsigned int a, unsigned int b)
{
  NewMatMatrix & op1(*this);
  return op1(a,b);
}
const double MyMatrix::operator()(unsigned int a, unsigned int b) const
{
  const NewMatMatrix& op1(*this);
  return op1(a,b);
}
Example #27
0
	"fxsave",	"fxrstor",	"",		"",
	"",		"",		"",		""
};

char *	db_GrpA[] = {
	"",		"cmpxchg8b",	"",		"",
	"",		"",		"",		""
};

char *	db_GrpB[] = {
	"xstore-rng",	"xcrypt-ecb",	"xcrypt-cbc",	"",
	"xcrypt-cfb",	"xcrypt-ofb",	"",		""
};

struct inst db_inst_0f0x[] = {
/*00*/	{ "",	   TRUE,  NONE,  op1(Ew),     db_Grp6 },
/*01*/	{ "",	   TRUE,  NONE,  op1(Ew),     db_Grp7 },
/*02*/	{ "lar",   TRUE,  LONG,  op2(E,R),    0 },
/*03*/	{ "lsl",   TRUE,  LONG,  op2(E,R),    0 },
/*04*/	{ "",      FALSE, NONE,  0,	      0 },
/*05*/	{ "",      FALSE, NONE,  0,	      0 },
/*06*/	{ "clts",  FALSE, NONE,  0,	      0 },
/*07*/	{ "",      FALSE, NONE,  0,	      0 },

/*08*/	{ "invd",  FALSE, NONE,  0,	      0 },
/*09*/	{ "wbinvd",FALSE, NONE,  0,	      0 },
/*0a*/	{ "",      FALSE, NONE,  0,	      0 },
/*0b*/	{ "",      FALSE, NONE,  0,	      0 },
/*0c*/	{ "",      FALSE, NONE,  0,	      0 },
/*0d*/	{ "",      FALSE, NONE,  0,	      0 },
/*0e*/	{ "",      FALSE, NONE,  0,	      0 },
double& MySymmetricMatrix::operator()(unsigned int a, unsigned int b)
{
  NewMatSymmetricMatrix & op1 = (*this);
  return op1(a,b);
}
Example #29
0
Node *rectonode(void)	/* make $0 into a Node */
{
	extern Cell *literal0;
	return op1(INDIRECT, celltonode(literal0, CUNK));
}
Example #30
0
File: awk.g.c Project: npe9/sprite
yyparse() {

    short yys[YYMAXDEPTH];
    short yyj, yym;
    register YYSTYPE *yypvt;
    register short yystate, *yyps, yyn;
    register YYSTYPE *yypv;
    register short *yyxi;

    yystate = 0;
    yychar = -1;
    yynerrs = 0;
    yyerrflag = 0;
    yyps= &yys[-1];
    yypv= &yyv[-1];

yystack:    /* put a state and value onto the stack */

#ifdef YYDEBUG
    if( yydebug  ) printf( "state %d, char 0%o\n", yystate, yychar );
#endif
    if( ++yyps> &yys[YYMAXDEPTH] ) {
        yyerror( "yacc stack overflow" );
        return(1);
    }
    *yyps = yystate;
    ++yypv;
    *yypv = yyval;

yynewstate:

    yyn = yypact[yystate];

    if( yyn<= YYFLAG ) goto yydefault; /* simple state */

    if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
    if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;

    if( yychk[ yyn=yyact[ yyn ] ] == yychar ) { /* valid shift */
        yychar = -1;
        yyval = yylval;
        yystate = yyn;
        if( yyerrflag > 0 ) --yyerrflag;
        goto yystack;
    }

yydefault:
    /* default state action */

    if( (yyn=yydef[yystate]) == -2 ) {
        if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
        /* look through exception table */

        for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */

        while( *(yyxi+=2) >= 0 ) {
            if( *yyxi == yychar ) break;
        }
        if( (yyn = yyxi[1]) < 0 ) return(0);   /* accept */
    }

    if( yyn == 0 ) { /* error */
        /* error ... attempt to resume parsing */

        switch( yyerrflag ) {

        case 0:   /* brand new error */

            yyerror( "syntax error" );
yyerrlab:
            ++yynerrs;

        case 1:
        case 2: /* incompletely recovered error ... try again */

            yyerrflag = 3;

            /* find a state where "error" is a legal shift action */

            while ( yyps >= yys ) {
                yyn = yypact[*yyps] + YYERRCODE;
                if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ) {
                    yystate = yyact[yyn];  /* simulate a shift of "error" */
                    goto yystack;
                }
                yyn = yypact[*yyps];

                /* the current yyps has no shift onn "error", pop stack */

#ifdef YYDEBUG
                if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
#endif
                --yyps;
                --yypv;
            }

            /* there is no state on the stack with an error shift ... abort */

yyabort:
            return(1);


        case 3:  /* no shift yet; clobber input char */

#ifdef YYDEBUG
            if( yydebug ) printf( "error recovery discards char %d\n", yychar );
#endif

            if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
            yychar = -1;
            goto yynewstate;   /* try again in the same state */

        }

    }

    /* reduction by production yyn */

#ifdef YYDEBUG
    if( yydebug ) printf("reduce %d\n",yyn);
#endif
    yyps -= yyr2[yyn];
    yypvt = yypv;
    yypv -= yyr2[yyn];
    yyval = yypv[1];
    yym=yyn;
    /* consult goto table to find next state */
    yyn = yyr1[yyn];
    yyj = yypgo[yyn] + *yyps + 1;
    if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
    switch(yym) {

    case 1:
# line 44 "awk.g.y"
        {
            if (errorflag==0) winner = (node *)stat3(PROGRAM, yypvt[-2], yypvt[-1], yypvt[-0]);
        }
        break;
    case 2:
# line 45 "awk.g.y"
        {
            yyclearin;
            yyerror("bailing out");
        }
        break;
    case 3:
# line 49 "awk.g.y"
        {
            PUTS("XBEGIN list");
            yyval = yypvt[-1];
        }
        break;
    case 5:
# line 51 "awk.g.y"
        {
            PUTS("empty XBEGIN");
            yyval = (hack)nullstat;
        }
        break;
    case 6:
# line 55 "awk.g.y"
        {
            PUTS("XEND list");
            yyval = yypvt[-1];
        }
        break;
    case 8:
# line 57 "awk.g.y"
        {
            PUTS("empty END");
            yyval = (hack)nullstat;
        }
        break;
    case 9:
# line 61 "awk.g.y"
        {
            PUTS("cond||cond");
            yyval = op2(BOR, yypvt[-2], yypvt[-0]);
        }
        break;
    case 10:
# line 62 "awk.g.y"
        {
            PUTS("cond&&cond");
            yyval = op2(AND, yypvt[-2], yypvt[-0]);
        }
        break;
    case 11:
# line 63 "awk.g.y"
        {
            PUTS("!cond");
            yyval = op1(NOT, yypvt[-0]);
        }
        break;
    case 12:
# line 64 "awk.g.y"
        {
            yyval = yypvt[-1];
        }
        break;
    case 13:
# line 68 "awk.g.y"
        {
            PUTS("pat||pat");
            yyval = op2(BOR, yypvt[-2], yypvt[-0]);
        }
        break;
    case 14:
# line 69 "awk.g.y"
        {
            PUTS("pat&&pat");
            yyval = op2(AND, yypvt[-2], yypvt[-0]);
        }
        break;
    case 15:
# line 70 "awk.g.y"
        {
            PUTS("!pat");
            yyval = op1(NOT, yypvt[-0]);
        }
        break;
    case 16:
# line 71 "awk.g.y"
        {
            yyval = yypvt[-1];
        }
        break;
    case 17:
# line 75 "awk.g.y"
        {
            PUTS("expr");
            yyval = op2(NE, yypvt[-0], valtonode(lookup("$zero&null", symtab, 0), CCON));
        }
        break;
    case 18:
# line 76 "awk.g.y"
        {
            PUTS("relexpr");
        }
        break;
    case 19:
# line 77 "awk.g.y"
        {
            PUTS("lexexpr");
        }
        break;
    case 20:
# line 78 "awk.g.y"
        {
            PUTS("compcond");
        }
        break;
    case 21:
# line 82 "awk.g.y"
        {
            PUTS("else");
        }
        break;
    case 22:
# line 86 "awk.g.y"
        {
            PUTS("field");
            yyval = valtonode(yypvt[-0], CFLD);
        }
        break;
    case 23:
# line 87 "awk.g.y"
        {
            PUTS("ind field");
            yyval = op1(INDIRECT, yypvt[-0]);
        }
        break;
    case 24:
# line 91 "awk.g.y"
        {
            PUTS("if(cond)");
            yyval = yypvt[-2];
        }
        break;
    case 25:
# line 95 "awk.g.y"
        {
            PUTS("expr~re");
            yyval = op2(yypvt[-1], yypvt[-2], makedfa(yypvt[-0]));
        }
        break;
    case 26:
# line 96 "awk.g.y"
        {
            PUTS("(lex_expr)");
            yyval = yypvt[-1];
        }
        break;
    case 27:
# line 100 "awk.g.y"
        {
            PUTS("number");
            yyval = valtonode(yypvt[-0], CCON);
        }
        break;
    case 28:
# line 101 "awk.g.y"
        {
            PUTS("string");
            yyval = valtonode(yypvt[-0], CCON);
        }
        break;
    case 29:
# line 102 "awk.g.y"
        {
            PUTS("var");
            yyval = valtonode(yypvt[-0], CVAR);
        }
        break;
    case 30:
# line 103 "awk.g.y"
        {
            PUTS("array[]");
            yyval = op2(ARRAY, yypvt[-3], yypvt[-1]);
        }
        break;
    case 33:
# line 108 "awk.g.y"
        {
            PUTS("getline");
            yyval = op1(GETLINE, 0);
        }
        break;
    case 34:
# line 109 "awk.g.y"
        {   PUTS("func");
            yyval = op2(FNCN, yypvt[-0], valtonode(lookup("$record", symtab, 0), CFLD));
        }
        break;
    case 35:
# line 112 "awk.g.y"
        {   PUTS("func()");
            yyval = op2(FNCN, yypvt[-2], valtonode(lookup("$record", symtab, 0), CFLD));
        }
        break;
    case 36:
# line 115 "awk.g.y"
        {
            PUTS("func(expr)");
            yyval = op2(FNCN, yypvt[-3], yypvt[-1]);
        }
        break;
    case 37:
# line 116 "awk.g.y"
        {
            PUTS("sprintf");
            yyval = op1(yypvt[-1], yypvt[-0]);
        }
        break;
    case 38:
# line 118 "awk.g.y"
        {
            PUTS("substr(e,e,e)");
            yyval = op3(SUBSTR, yypvt[-5], yypvt[-3], yypvt[-1]);
        }
        break;
    case 39:
# line 120 "awk.g.y"
        {
            PUTS("substr(e,e,e)");
            yyval = op3(SUBSTR, yypvt[-3], yypvt[-1], nullstat);
        }
        break;
    case 40:
# line 122 "awk.g.y"
        {
            PUTS("split(e,e,e)");
            yyval = op3(SPLIT, yypvt[-5], yypvt[-3], yypvt[-1]);
        }
        break;
    case 41:
# line 124 "awk.g.y"
        {
            PUTS("split(e,e,e)");
            yyval = op3(SPLIT, yypvt[-3], yypvt[-1], nullstat);
        }
        break;
    case 42:
# line 126 "awk.g.y"
        {
            PUTS("index(e,e)");
            yyval = op2(INDEX, yypvt[-3], yypvt[-1]);
        }
        break;
    case 43:
# line 127 "awk.g.y"
        {
            PUTS("(expr)");
            yyval = yypvt[-1];
        }
        break;
    case 44:
# line 128 "awk.g.y"
        {
            PUTS("t+t");
            yyval = op2(ADD, yypvt[-2], yypvt[-0]);
        }
        break;
    case 45:
# line 129 "awk.g.y"
        {
            PUTS("t-t");
            yyval = op2(MINUS, yypvt[-2], yypvt[-0]);
        }
        break;
    case 46:
# line 130 "awk.g.y"
        {
            PUTS("t*t");
            yyval = op2(MULT, yypvt[-2], yypvt[-0]);
        }
        break;
    case 47:
# line 131 "awk.g.y"
        {
            PUTS("t/t");
            yyval = op2(DIVIDE, yypvt[-2], yypvt[-0]);
        }
        break;
    case 48:
# line 132 "awk.g.y"
        {
            PUTS("t%t");
            yyval = op2(MOD, yypvt[-2], yypvt[-0]);
        }
        break;
    case 49:
# line 133 "awk.g.y"
        {
            PUTS("-term");
            yyval = op1(UMINUS, yypvt[-0]);
        }
        break;
    case 50:
# line 134 "awk.g.y"
        {
            PUTS("+term");
            yyval = yypvt[-0];
        }
        break;
    case 51:
# line 135 "awk.g.y"
        {
            PUTS("++var");
            yyval = op1(PREINCR, yypvt[-0]);
        }
        break;
    case 52:
# line 136 "awk.g.y"
        {
            PUTS("--var");
            yyval = op1(PREDECR, yypvt[-0]);
        }
        break;
    case 53:
# line 137 "awk.g.y"
        {
            PUTS("var++");
            yyval= op1(POSTINCR, yypvt[-1]);
        }
        break;
    case 54:
# line 138 "awk.g.y"
        {
            PUTS("var--");
            yyval= op1(POSTDECR, yypvt[-1]);
        }
        break;
    case 55:
# line 142 "awk.g.y"
        {
            PUTS("term");
        }
        break;
    case 56:
# line 143 "awk.g.y"
        {
            PUTS("expr term");
            yyval = op2(CAT, yypvt[-1], yypvt[-0]);
        }
        break;
    case 57:
# line 144 "awk.g.y"
        {
            PUTS("var=expr");
            yyval = stat2(yypvt[-1], yypvt[-2], yypvt[-0]);
        }
        break;
    case 60:
# line 153 "awk.g.y"
        {
            PUTS("pattern");
            yyval = stat2(PASTAT, yypvt[-0], genprint());
        }
        break;
    case 61:
# line 154 "awk.g.y"
        {
            PUTS("pattern {...}");
            yyval = stat2(PASTAT, yypvt[-3], yypvt[-1]);
        }
        break;
    case 62:
# line 155 "awk.g.y"
        {
            PUTS("srch,srch");
            yyval = pa2stat(yypvt[-2], yypvt[-0], genprint());
        }
        break;
    case 63:
# line 157 "awk.g.y"
        {
            PUTS("srch, srch {...}");
            yyval = pa2stat(yypvt[-5], yypvt[-3], yypvt[-1]);
        }
        break;
    case 64:
# line 158 "awk.g.y"
        {
            PUTS("null pattern {...}");
            yyval = stat2(PASTAT, nullstat, yypvt[-1]);
        }
        break;
    case 65:
# line 162 "awk.g.y"
        {
            PUTS("pa_stats pa_stat");
            yyval = linkum(yypvt[-2], yypvt[-1]);
        }
        break;
    case 66:
# line 163 "awk.g.y"
        {
            PUTS("null pa_stat");
            yyval = (hack)nullstat;
        }
        break;
    case 67:
# line 164 "awk.g.y"
        {
            PUTS("pa_stats pa_stat");
            yyval = linkum(yypvt[-1], yypvt[-0]);
        }
        break;
    case 68:
# line 168 "awk.g.y"
        {   PUTS("regex");
            yyval = op2(MATCH, valtonode(lookup("$record", symtab, 0), CFLD), makedfa(yypvt[-0]));
        }
        break;
    case 69:
# line 171 "awk.g.y"
        {
            PUTS("relexpr");
        }
        break;
    case 70:
# line 172 "awk.g.y"
        {
            PUTS("lexexpr");
        }
        break;
    case 71:
# line 173 "awk.g.y"
        {
            PUTS("comp pat");
        }
        break;
    case 72:
# line 177 "awk.g.y"
        {
            PUTS("expr");
        }
        break;
    case 73:
# line 178 "awk.g.y"
        {
            PUTS("pe_list");
        }
        break;
    case 74:
# line 179 "awk.g.y"
        {
            PUTS("null print_list");
            yyval = valtonode(lookup("$record", symtab, 0), CFLD);
        }
        break;
    case 75:
# line 183 "awk.g.y"
        {
            yyval = linkum(yypvt[-2], yypvt[-0]);
        }
        break;
    case 76:
# line 184 "awk.g.y"
        {
            yyval = linkum(yypvt[-2], yypvt[-0]);
        }
        break;
    case 77:
# line 185 "awk.g.y"
        {
            yyval = yypvt[-1];
        }
        break;
    case 80:
# line 194 "awk.g.y"
        {
            startreg();
        }
        break;
    case 81:
# line 196 "awk.g.y"
        {
            PUTS("/r/");
            yyval = yypvt[-1];
        }
        break;
    case 82:
# line 200 "awk.g.y"
        {
            PUTS("regex CHAR");
            yyval = op2(CHAR, (node *) 0, yypvt[-0]);
        }
        break;
    case 83:
# line 201 "awk.g.y"
        {
            PUTS("regex DOT");
            yyval = op2(DOT, (node *) 0, (node *) 0);
        }
        break;
    case 84:
# line 202 "awk.g.y"
        {
            PUTS("regex CCL");
            yyval = op2(CCL, (node *) 0, cclenter(yypvt[-0]));
        }
        break;
    case 85:
# line 203 "awk.g.y"
        {
            PUTS("regex NCCL");
            yyval = op2(NCCL, (node *) 0, cclenter(yypvt[-0]));
        }
        break;
    case 86:
# line 204 "awk.g.y"
        {
            PUTS("regex ^");
            yyval = op2(CHAR, (node *) 0, HAT);
        }
        break;
    case 87:
# line 205 "awk.g.y"
        {
            PUTS("regex $");
            yyval = op2(CHAR, (node *) 0 ,(node *) 0);
        }
        break;
    case 88:
# line 206 "awk.g.y"
        {
            PUTS("regex OR");
            yyval = op2(OR, yypvt[-2], yypvt[-0]);
        }
        break;
    case 89:
# line 208 "awk.g.y"
        {
            PUTS("regex CAT");
            yyval = op2(CAT, yypvt[-1], yypvt[-0]);
        }
        break;
    case 90:
# line 209 "awk.g.y"
        {
            PUTS("regex STAR");
            yyval = op2(STAR, yypvt[-1], (node *) 0);
        }
        break;
    case 91:
# line 210 "awk.g.y"
        {
            PUTS("regex PLUS");
            yyval = op2(PLUS, yypvt[-1], (node *) 0);
        }
        break;
    case 92:
# line 211 "awk.g.y"
        {
            PUTS("regex QUEST");
            yyval = op2(QUEST, yypvt[-1], (node *) 0);
        }
        break;
    case 93:
# line 212 "awk.g.y"
        {
            PUTS("(regex)");
            yyval = yypvt[-1];
        }
        break;
    case 94:
# line 217 "awk.g.y"
        {
            PUTS("expr relop expr");
            yyval = op2(yypvt[-1], yypvt[-2], yypvt[-0]);
        }
        break;
    case 95:
# line 219 "awk.g.y"
        {
            PUTS("(relexpr)");
            yyval = yypvt[-1];
        }
        break;
    case 98:
# line 229 "awk.g.y"
        {
            PUTS("print>stat");
            yyval = stat3(yypvt[-3], yypvt[-2], yypvt[-1], yypvt[-0]);
        }
        break;
    case 99:
# line 231 "awk.g.y"
        {
            PUTS("print list");
            yyval = stat3(yypvt[-1], yypvt[-0], nullstat, nullstat);
        }
        break;
    case 100:
# line 233 "awk.g.y"
        {
            PUTS("printf>stat");
            yyval = stat3(yypvt[-3], yypvt[-2], yypvt[-1], yypvt[-0]);
        }
        break;
    case 101:
# line 235 "awk.g.y"
        {
            PUTS("printf list");
            yyval = stat3(yypvt[-1], yypvt[-0], nullstat, nullstat);
        }
        break;
    case 102:
# line 236 "awk.g.y"
        {
            PUTS("expr");
            yyval = exptostat(yypvt[-0]);
        }
        break;
    case 103:
# line 237 "awk.g.y"
        {
            PUTS("null simple statement");
            yyval = (hack)nullstat;
        }
        break;
    case 104:
# line 238 "awk.g.y"
        {
            yyclearin;
            yyerror("illegal statement");
        }
        break;
    case 105:
# line 242 "awk.g.y"
        {
            PUTS("simple stat");
        }
        break;
    case 106:
# line 243 "awk.g.y"
        {
            PUTS("if stat");
            yyval = stat3(IF, yypvt[-1], yypvt[-0], nullstat);
        }
        break;
    case 107:
# line 245 "awk.g.y"
        {
            PUTS("if-else stat");
            yyval = stat3(IF, yypvt[-3], yypvt[-2], yypvt[-0]);
        }
        break;
    case 108:
# line 246 "awk.g.y"
        {
            PUTS("while stat");
            yyval = stat2(WHILE, yypvt[-1], yypvt[-0]);
        }
        break;
    case 109:
# line 247 "awk.g.y"
        {
            PUTS("for stat");
        }
        break;
    case 110:
# line 248 "awk.g.y"
        {
            PUTS("next");
            yyval = stat1(NEXT, 0);
        }
        break;
    case 111:
# line 249 "awk.g.y"
        {
            PUTS("exit");
            yyval = stat1(EXIT, 0);
        }
        break;
    case 112:
# line 250 "awk.g.y"
        {
            PUTS("exit");
            yyval = stat1(EXIT, yypvt[-1]);
        }
        break;
    case 113:
# line 251 "awk.g.y"
        {
            PUTS("break");
            yyval = stat1(BREAK, 0);
        }
        break;
    case 114:
# line 252 "awk.g.y"
        {
            PUTS("continue");
            yyval = stat1(CONTINUE, 0);
        }
        break;
    case 115:
# line 253 "awk.g.y"
        {
            PUTS("{statlist}");
            yyval = yypvt[-1];
        }
        break;
    case 116:
# line 257 "awk.g.y"
        {
            PUTS("stat_list stat");
            yyval = linkum(yypvt[-1], yypvt[-0]);
        }
        break;
    case 117:
# line 258 "awk.g.y"
        {
            PUTS("null stat list");
            yyval = (hack)nullstat;
        }
        break;
    case 118:
# line 262 "awk.g.y"
        {
            PUTS("while(cond)");
            yyval = yypvt[-2];
        }
        break;
    case 119:
# line 267 "awk.g.y"
        {
            PUTS("for(e;e;e)");
            yyval = stat4(FOR, yypvt[-7], yypvt[-5], yypvt[-3], yypvt[-0]);
        }
        break;
    case 120:
# line 269 "awk.g.y"
        {
            PUTS("for(e;e;e)");
            yyval = stat4(FOR, yypvt[-6], nullstat, yypvt[-3], yypvt[-0]);
        }
        break;
    case 121:
# line 271 "awk.g.y"
        {
            PUTS("for(v in v)");
            yyval = stat3(IN, yypvt[-5], yypvt[-3], yypvt[-0]);
        }
        break;
    }
    goto yystack;  /* stack new state and value */

}