Lines Matching refs:cfg

85 void CFGGenerator::addExpression(CFG& cfg, std::unique_ptr<Expression>* e, bool constantPropagate) {  in addExpression()  argument
96 this->addExpression(cfg, &b->fLeft, constantPropagate); in addExpression()
97 BlockId start = cfg.fCurrent; in addExpression()
98 cfg.newBlock(); in addExpression()
99 this->addExpression(cfg, &b->fRight, constantPropagate); in addExpression()
100 cfg.newBlock(); in addExpression()
101 cfg.addExit(start, cfg.fCurrent); in addExpression()
105 this->addExpression(cfg, &b->fRight, constantPropagate); in addExpression()
106 this->addLValue(cfg, &b->fLeft); in addExpression()
107 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ in addExpression()
116 this->addExpression(cfg, &b->fLeft, !Token::IsAssignment(b->fOperator)); in addExpression()
117 this->addExpression(cfg, &b->fRight, constantPropagate); in addExpression()
118 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ in addExpression()
130 this->addExpression(cfg, &arg, constantPropagate); in addExpression()
132 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
139 this->addExpression(cfg, &arg, constantPropagate); in addExpression()
141 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
146 this->addExpression(cfg, &((FieldAccess*) e->get())->fBase, constantPropagate); in addExpression()
147 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
151 this->addExpression(cfg, &((IndexExpression*) e->get())->fBase, constantPropagate); in addExpression()
152 this->addExpression(cfg, &((IndexExpression*) e->get())->fIndex, constantPropagate); in addExpression()
153 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
158 this->addExpression(cfg, &p->fOperand, constantPropagate && in addExpression()
161 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
166 this->addExpression(cfg, &((PostfixExpression*) e->get())->fOperand, false); in addExpression()
167 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
171 this->addExpression(cfg, &((Swizzle*) e->get())->fBase, constantPropagate); in addExpression()
172 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
179 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind, in addExpression()
184 this->addExpression(cfg, &t->fTest, constantPropagate); in addExpression()
185 BlockId start = cfg.fCurrent; in addExpression()
186 cfg.newBlock(); in addExpression()
187 this->addExpression(cfg, &t->fIfTrue, constantPropagate); in addExpression()
188 BlockId next = cfg.newBlock(); in addExpression()
189 cfg.fCurrent = start; in addExpression()
190 cfg.newBlock(); in addExpression()
191 this->addExpression(cfg, &t->fIfFalse, constantPropagate); in addExpression()
192 cfg.addExit(cfg.fCurrent, next); in addExpression()
193 cfg.fCurrent = next; in addExpression()
205 void CFGGenerator::addLValue(CFG& cfg, std::unique_ptr<Expression>* e) { in addLValue() argument
208 this->addLValue(cfg, &((FieldAccess&) **e).fBase); in addLValue()
211 this->addLValue(cfg, &((IndexExpression&) **e).fBase); in addLValue()
212 this->addExpression(cfg, &((IndexExpression&) **e).fIndex, true); in addLValue()
215 this->addLValue(cfg, &((Swizzle&) **e).fBase); in addLValue()
226 void CFGGenerator::addStatement(CFG& cfg, const Statement* s) { in addStatement() argument
230 addStatement(cfg, child.get()); in addStatement()
235 this->addExpression(cfg, &ifs->fTest, true); in addStatement()
236 BlockId start = cfg.fCurrent; in addStatement()
237 cfg.newBlock(); in addStatement()
238 this->addStatement(cfg, ifs->fIfTrue.get()); in addStatement()
239 BlockId next = cfg.newBlock(); in addStatement()
241 cfg.fCurrent = start; in addStatement()
242 cfg.newBlock(); in addStatement()
243 this->addStatement(cfg, ifs->fIfFalse.get()); in addStatement()
244 cfg.addExit(cfg.fCurrent, next); in addStatement()
245 cfg.fCurrent = next; in addStatement()
247 cfg.addExit(start, next); in addStatement()
252 this->addExpression(cfg, &((ExpressionStatement&) *s).fExpression, true); in addStatement()
259 this->addExpression(cfg, &vd.fValue, true); in addStatement()
262 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
267 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
269 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
274 this->addExpression(cfg, &r.fExpression, true); in addStatement()
276 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
278 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
282 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
284 cfg.addExit(cfg.fCurrent, fLoopExits.top()); in addStatement()
285 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
288 cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kStatement_Kind, false, in addStatement()
290 cfg.addExit(cfg.fCurrent, fLoopContinues.top()); in addStatement()
291 cfg.fCurrent = cfg.newIsolatedBlock(); in addStatement()
295 BlockId loopStart = cfg.newBlock(); in addStatement()
297 BlockId loopExit = cfg.newIsolatedBlock(); in addStatement()
299 this->addExpression(cfg, &w->fTest, true); in addStatement()
300 BlockId test = cfg.fCurrent; in addStatement()
301 cfg.addExit(test, loopExit); in addStatement()
302 cfg.newBlock(); in addStatement()
303 this->addStatement(cfg, w->fStatement.get()); in addStatement()
304 cfg.addExit(cfg.fCurrent, loopStart); in addStatement()
307 cfg.fCurrent = loopExit; in addStatement()
312 BlockId loopStart = cfg.newBlock(); in addStatement()
314 BlockId loopExit = cfg.newIsolatedBlock(); in addStatement()
316 this->addStatement(cfg, d->fStatement.get()); in addStatement()
317 this->addExpression(cfg, &d->fTest, true); in addStatement()
318 cfg.addExit(cfg.fCurrent, loopExit); in addStatement()
319 cfg.addExit(cfg.fCurrent, loopStart); in addStatement()
322 cfg.fCurrent = loopExit; in addStatement()
328 this->addStatement(cfg, f->fInitializer.get()); in addStatement()
330 BlockId loopStart = cfg.newBlock(); in addStatement()
331 BlockId next = cfg.newIsolatedBlock(); in addStatement()
333 BlockId loopExit = cfg.newIsolatedBlock(); in addStatement()
336 this->addExpression(cfg, &f->fTest, true); in addStatement()
337 BlockId test = cfg.fCurrent; in addStatement()
338 cfg.addExit(test, loopExit); in addStatement()
340 cfg.newBlock(); in addStatement()
341 this->addStatement(cfg, f->fStatement.get()); in addStatement()
342 cfg.addExit(cfg.fCurrent, next); in addStatement()
343 cfg.fCurrent = next; in addStatement()
345 this->addExpression(cfg, &f->fNext, true); in addStatement()
347 cfg.addExit(cfg.fCurrent, loopStart); in addStatement()
350 cfg.fCurrent = loopExit; in addStatement()
355 this->addExpression(cfg, &ss->fValue, true); in addStatement()
356 BlockId start = cfg.fCurrent; in addStatement()
357 BlockId switchExit = cfg.newIsolatedBlock(); in addStatement()
360 cfg.newBlock(); in addStatement()
361 cfg.addExit(start, cfg.fCurrent); in addStatement()
365 this->addExpression(cfg, &c->fValue, true); in addStatement()
368 this->addStatement(cfg, caseStatement.get()); in addStatement()
371 cfg.addExit(cfg.fCurrent, switchExit); in addStatement()
375 cfg.addExit(start, switchExit); in addStatement()
378 cfg.fCurrent = switchExit; in addStatement()