Lines Matching refs:cfg
294 void CFGGenerator::addExpression(CFG& cfg, std::unique_ptr<Expression>* e, bool constantPropagate) { in addExpression() argument
305 this->addExpression(cfg, &b->fLeft, constantPropagate); in addExpression()
306 BlockId start = cfg.fCurrent; in addExpression()
307 cfg.newBlock(); in addExpression()
308 this->addExpression(cfg, &b->fRight, constantPropagate); in addExpression()
309 cfg.newBlock(); in addExpression()
310 cfg.addExit(start, cfg.fCurrent); in addExpression()
311 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ in addExpression()
320 this->addExpression(cfg, &b->fRight, constantPropagate); in addExpression()
321 this->addLValue(cfg, &b->fLeft); in addExpression()
322 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ in addExpression()
331 this->addExpression(cfg, &b->fLeft, !Compiler::IsAssignment(b->fOperator)); in addExpression()
332 this->addExpression(cfg, &b->fRight, constantPropagate); in addExpression()
333 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ in addExpression()
345 this->addExpression(cfg, &arg, constantPropagate); in addExpression()
347 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
354 this->addExpression(cfg, &arg, constantPropagate); in addExpression()
356 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
361 this->addExpression(cfg, &((FieldAccess*) e->get())->fBase, constantPropagate); in addExpression()
362 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
366 this->addExpression(cfg, &((IndexExpression*) e->get())->fBase, constantPropagate); in addExpression()
367 this->addExpression(cfg, &((IndexExpression*) e->get())->fIndex, constantPropagate); in addExpression()
368 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
373 this->addExpression(cfg, &p->fOperand, constantPropagate && in addExpression()
376 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
381 this->addExpression(cfg, &((PostfixExpression*) e->get())->fOperand, false); in addExpression()
382 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
386 this->addExpression(cfg, &((Swizzle*) e->get())->fBase, constantPropagate); in addExpression()
387 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
397 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
402 this->addExpression(cfg, &t->fTest, constantPropagate); in addExpression()
403 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
405 BlockId start = cfg.fCurrent; in addExpression()
406 cfg.newBlock(); in addExpression()
407 this->addExpression(cfg, &t->fIfTrue, constantPropagate); in addExpression()
408 BlockId next = cfg.newBlock(); in addExpression()
409 cfg.fCurrent = start; in addExpression()
410 cfg.newBlock(); in addExpression()
411 this->addExpression(cfg, &t->fIfFalse, constantPropagate); in addExpression()
412 cfg.addExit(cfg.fCurrent, next); in addExpression()
413 cfg.fCurrent = next; in addExpression()
425 void CFGGenerator::addLValue(CFG& cfg, std::unique_ptr<Expression>* e) { in addLValue() argument
428 this->addLValue(cfg, &((FieldAccess&) **e).fBase); in addLValue()
431 this->addLValue(cfg, &((IndexExpression&) **e).fBase); in addLValue()
432 this->addExpression(cfg, &((IndexExpression&) **e).fIndex, true); in addLValue()
435 this->addLValue(cfg, &((Swizzle&) **e).fBase); in addLValue()
440 this->addExpression(cfg, &((TernaryExpression&) **e).fTest, true); in addLValue()
444 this->addLValue(cfg, &((TernaryExpression&) **e).fIfTrue); in addLValue()
445 this->addLValue(cfg, &((TernaryExpression&) **e).fIfFalse); in addLValue()
454 void CFGGenerator::addStatement(CFG& cfg, std::unique_ptr<Statement>* s) { in addStatement() argument
458 addStatement(cfg, &child); in addStatement()
463 this->addExpression(cfg, &ifs.fTest, true); in addStatement()
464 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
466 BlockId start = cfg.fCurrent; in addStatement()
467 cfg.newBlock(); in addStatement()
468 this->addStatement(cfg, &ifs.fIfTrue); in addStatement()
469 BlockId next = cfg.newBlock(); in addStatement()
471 cfg.fCurrent = start; in addStatement()
472 cfg.newBlock(); in addStatement()
473 this->addStatement(cfg, &ifs.fIfFalse); in addStatement()
474 cfg.addExit(cfg.fCurrent, next); in addStatement()
475 cfg.fCurrent = next; in addStatement()
477 cfg.addExit(start, next); in addStatement()
482 this->addExpression(cfg, &((ExpressionStatement&) **s).fExpression, true); in addStatement()
483 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
495 this->addExpression(cfg, &vd.fValue, true); in addStatement()
497 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, in addStatement()
500 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
505 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
507 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
512 this->addExpression(cfg, &r.fExpression, true); in addStatement()
514 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
516 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
520 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
522 cfg.addExit(cfg.fCurrent, fLoopExits.top()); in addStatement()
523 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
526 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
528 cfg.addExit(cfg.fCurrent, fLoopContinues.top()); in addStatement()
529 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
533 BlockId loopStart = cfg.newBlock(); in addStatement()
535 BlockId loopExit = cfg.newIsolatedBlock(); in addStatement()
537 this->addExpression(cfg, &w.fTest, true); in addStatement()
538 BlockId test = cfg.fCurrent; in addStatement()
539 cfg.addExit(test, loopExit); in addStatement()
540 cfg.newBlock(); in addStatement()
541 this->addStatement(cfg, &w.fStatement); in addStatement()
542 cfg.addExit(cfg.fCurrent, loopStart); in addStatement()
545 cfg.fCurrent = loopExit; in addStatement()
550 BlockId loopStart = cfg.newBlock(); in addStatement()
552 BlockId loopExit = cfg.newIsolatedBlock(); in addStatement()
554 this->addStatement(cfg, &d.fStatement); in addStatement()
555 this->addExpression(cfg, &d.fTest, true); in addStatement()
556 cfg.addExit(cfg.fCurrent, loopExit); in addStatement()
557 cfg.addExit(cfg.fCurrent, loopStart); in addStatement()
560 cfg.fCurrent = loopExit; in addStatement()
566 this->addStatement(cfg, &f.fInitializer); in addStatement()
568 BlockId loopStart = cfg.newBlock(); in addStatement()
569 BlockId next = cfg.newIsolatedBlock(); in addStatement()
571 BlockId loopExit = cfg.newIsolatedBlock(); in addStatement()
574 this->addExpression(cfg, &f.fTest, true); in addStatement()
583 cfg.newBlock(); in addStatement()
584 this->addStatement(cfg, &f.fStatement); in addStatement()
585 cfg.addExit(cfg.fCurrent, next); in addStatement()
586 cfg.fCurrent = next; in addStatement()
588 this->addExpression(cfg, &f.fNext, true); in addStatement()
590 cfg.addExit(cfg.fCurrent, loopStart); in addStatement()
591 cfg.addExit(cfg.fCurrent, loopExit); in addStatement()
594 cfg.fCurrent = loopExit; in addStatement()
599 this->addExpression(cfg, &ss.fValue, true); in addStatement()
600 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
602 BlockId start = cfg.fCurrent; in addStatement()
603 BlockId switchExit = cfg.newIsolatedBlock(); in addStatement()
606 cfg.newBlock(); in addStatement()
607 cfg.addExit(start, cfg.fCurrent); in addStatement()
611 this->addExpression(cfg, &c->fValue, true); in addStatement()
614 this->addStatement(cfg, &caseStatement); in addStatement()
617 cfg.addExit(cfg.fCurrent, switchExit); in addStatement()
621 cfg.addExit(start, switchExit); in addStatement()
624 cfg.fCurrent = switchExit; in addStatement()