Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 207 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 209 of file il_test_helper.h.

214 : flow_graph_(flow_graph),
215 cursor_(cursor),
216 parallel_moves_handling_(parallel_moves_handling),
217 // clang-format off
218#if !defined(PRODUCT)
219 trace_(trace) {}

Member Function Documentation

◆ TryMatch()

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

Definition at line 283 of file il_test_helper.cc.

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

◆ value()

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

Definition at line 225 of file il_test_helper.h.

225{ return cursor_; }

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