Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ILMatcher Class Reference

#include <il_test_helper.h>

Inheritance diagram for dart::ILMatcher:
dart::ValueObject

Public Member Functions

 ILMatcher (FlowGraph *flow_graph, Instruction *cursor, bool trace=true, ParallelMovesHandling parallel_moves_handling=ParallelMovesHandling::kDefault)
 
Instructionvalue ()
 
bool TryMatch (std::initializer_list< MatchCode > match_codes, MatchOpCode insert_before=kInvalidMatchOpCode)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 224 of file il_test_helper.h.

Constructor & Destructor Documentation

◆ ILMatcher()

dart::ILMatcher::ILMatcher ( FlowGraph flow_graph,
Instruction cursor,
bool  trace = true,
ParallelMovesHandling  parallel_moves_handling = ParallelMovesHandling::kDefault 
)
inline

Definition at line 226 of file il_test_helper.h.

231 : flow_graph_(flow_graph),
232 cursor_(cursor),
233 parallel_moves_handling_(parallel_moves_handling),
234 // clang-format off
235#if !defined(PRODUCT)
236 trace_(trace) {}

Member Function Documentation

◆ TryMatch()

bool dart::ILMatcher::TryMatch ( std::initializer_list< MatchCode match_codes,
MatchOpCode  insert_before = kInvalidMatchOpCode 
)

Definition at line 288 of file il_test_helper.cc.

289 {
290 std::vector<MatchCode> qcodes = match_codes;
291
292 if (insert_before != kInvalidMatchOpCode) {
293 for (auto pos = qcodes.begin(); pos < qcodes.end(); pos++) {
294 pos = qcodes.insert(pos, insert_before) + 1;
295 }
296 }
297
298 if (trace_) {
299 OS::PrintErr("ILMatcher: Matching the following graph\n");
300 FlowGraphPrinter::PrintGraph("ILMatcher", flow_graph_);
301 OS::PrintErr("ILMatcher: Starting match at %s:\n", cursor_->ToCString());
302 }
303
304 Instruction* cursor = cursor_;
305 for (size_t i = 0; i < qcodes.size(); ++i) {
306 Instruction** capture = qcodes[i].capture_;
307 if (parallel_moves_handling_ == ParallelMovesHandling::kSkip) {
308 while (cursor->IsParallelMove()) {
309 cursor = cursor->next();
310 }
311 }
312 if (trace_) {
313 OS::PrintErr(" matching %30s @ %s\n",
314 MatchOpCodeToCString(qcodes[i].opcode()),
315 cursor->ToCString());
316 }
317
318 auto next = MatchInternal(qcodes, i, cursor);
319 if (next == nullptr) {
320 if (trace_) {
321 OS::PrintErr(" -> Match failed\n");
322 }
323 cursor = next;
324 break;
325 }
326 if (capture != nullptr) {
327 *capture = cursor;
328 }
329 cursor = next;
330 }
331 if (cursor != nullptr) {
332 cursor_ = cursor;
333 return true;
334 }
335 return false;
336}
SkPoint pos
static float next(float f)
static void PrintGraph(const char *phase, FlowGraph *flow_graph)
Definition: il_printer.cc:1706
Instruction * next() const
Definition: il.h:1093
const char * ToCString() const
Definition: il_printer.cc:1683
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
@ kInvalidMatchOpCode

◆ value()

Instruction * dart::ILMatcher::value ( )
inline

Definition at line 242 of file il_test_helper.h.

242{ return cursor_; }

The documentation for this class was generated from the following files: