5#ifndef RUNTIME_VM_COMPILER_BACKEND_IL_TEST_HELPER_H_
6#define RUNTIME_VM_COMPILER_BACKEND_IL_TEST_HELPER_H_
77 bool is_optimizing =
true)
78 : thread_(
Thread::Current()),
79 compiler_state_(thread_,
83 hierarchy_info_(thread_),
89 parsed_function_(nullptr) {}
93 : thread_(
Thread::Current()),
94 compiler_state_(thread_,
98 hierarchy_info_(thread_),
124 std::unique_ptr<SpeculativeInliningPolicy> speculative_policy_;
136#define DEFINE_MATCH_OPCODES(Instruction, _) \
137 kMatch##Instruction, kMatchAndMove##Instruction, \
138 kMatchAndMoveOptional##Instruction,
141#undef DEFINE_MATCH_OPCODES
173 : opcode_(
opcode), capture_(nullptr) {}
176 : opcode_(
opcode), capture_(capture) {}
178#define DEFINE_TYPED_CONSTRUCTOR(Type, ignored) \
179 MatchCode(MatchOpCode opcode, Type##Instr** capture) \
180 : opcode_(opcode), capture_(reinterpret_cast<Instruction**>(capture)) { \
181 RELEASE_ASSERT(opcode == kMatch##Type || opcode == kMatchAndMove##Type); \
185#undef DEFINE_TYPED_CONSTRUCTOR
231 : flow_graph_(flow_graph),
233 parallel_moves_handling_(parallel_moves_handling),
251 bool TryMatch(std::initializer_list<MatchCode> match_codes,
255 Instruction* MatchInternal(std::vector<MatchCode> match_codes,
268#define ENTITY_TOCSTRING(v) ((v)->ToCString())
270#define ENTITY_TOCSTRING(v) "<?>"
278#define EXPECT_PROPERTY(entity, property) \
280 auto& it = *entity; \
282 dart::Expect(__FILE__, __LINE__) \
283 .Fail("expected " #property " for " #entity " which is %s.\n", \
284 ENTITY_TOCSTRING(entity)); \
291 intptr_t num_parameters = 0,
297 state_.is_optimizing(),
298 configure_function)) {
314 ASSERT(representation == kTagged ||
330 new LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
351 template <
typename T,
352 typename =
typename std::enable_if<
374 std::initializer_list<IncomingDef> incoming) {
376 for (
size_t i = 0;
i < incoming.size();
i++) {
378 phi->SetInputAt(
i, input);
379 input->definition()->AddInputUse(input);
381 for (
auto def : incoming) {
382 pending_phis_.
Add({phi, def});
392 for (
auto& pending : pending_phis_) {
393 auto join = pending.phi->block();
394 EXPECT(pending.phi->InputCount() ==
join->PredecessorCount());
395 auto pred_index =
join->IndexOfPredecessor(pending.incoming.from());
397 pending.phi->InputAt(pred_index)->BindTo(pending.incoming.defn());
406 intptr_t num_parameters,
414 UntaggedFunction::kRegularFunction,
421 TokenPosition::kNoSource));
422 configure_function(func);
432 const intptr_t block_id = 1;
433 graph_entry->set_normal_entry(
436 return *
new FlowGraph(*parsed_function, graph_entry, block_id,
441 CompilerState& state_;
442 FlowGraph& flow_graph_;
444 struct PendingPhiInput {
446 IncomingDef incoming;
448 GrowableArray<PendingPhiInput> pending_phis_;
static constexpr bool kCannotBeSentinel
static constexpr bool kCanBeNull
static CompileType FromAbstractType(const AbstractType &type, bool can_be_null, bool can_be_sentinel)
intptr_t GetNextDeoptId()
static CompilerState & Current()
static constexpr intptr_t kNoOSRDeoptId
static DoublePtr NewCanonical(double d)
IncomingDef(BlockEntryInstr *from, T **defn_source)
Definition * defn() const
IncomingDef(BlockEntryInstr *from, Definition *defn)
BlockEntryInstr * from() const
Definition ** defn_source_
JoinEntryInstr * JoinEntry(intptr_t try_index=kInvalidTryIndex) const
FlowGraphBuilderHelper(intptr_t num_parameters=0, const std::function< void(const Function &)> &configure_function=[](const Function &) {})
PhiInstr * Phi(JoinEntryInstr *join, std::initializer_list< IncomingDef > incoming)
void AddVariable(const char *name, const AbstractType &static_type, CompileType *inferred_arg_type=nullptr)
TargetEntryInstr * TargetEntry(intptr_t try_index=kInvalidTryIndex) const
ConstantInstr * DoubleConstant(double value)
ConstantInstr * IntConstant(int64_t value, Representation representation=kTagged) const
ConstantInstr * GetConstant(const Object &object, Representation representation=kTagged)
static constexpr CompilationMode CompilationModeFrom(bool is_optimizing)
ConstantInstr * constant_dead() const
void CreateCommonConstants()
void ComputeDominators(GrowableArray< BitVector * > *dominance_frontier)
const ParsedFunction & parsed_function() const
intptr_t allocate_block_id()
void set_num_fixed_parameters(intptr_t value) const
static FunctionTypePtr New(intptr_t num_parent_type_arguments=0, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
static FunctionPtr New(const FunctionType &signature, const String &name, UntaggedFunction::Kind kind, bool is_static, bool is_const, bool is_abstract, bool is_external, bool is_native, const Object &owner, TokenPosition token_pos, Heap::Space space=Heap::kOld)
ILMatcher(FlowGraph *flow_graph, Instruction *cursor, bool trace=true, ParallelMovesHandling parallel_moves_handling=ParallelMovesHandling::kDefault)
bool TryMatch(std::initializer_list< MatchCode > match_codes, MatchOpCode insert_before=kInvalidMatchOpCode)
static IntegerPtr NewCanonical(const String &str)
ObjectStore * object_store() const
bool AddVariable(LocalVariable *variable)
void set_type_check_mode(TypeCheckMode mode)
static constexpr intptr_t kNoKernelOffset
MatchCode(MatchOpCode opcode, Instruction **capture)
MatchCode(MatchOpCode opcode)
static Object & ZoneHandle()
LocalScope * scope() const
void set_scope(LocalScope *scope)
static StringPtr New(Thread *thread, const char *cstr)
TestPipeline(CompilerPass::PipelineMode mode, std::function< FlowGraph *()> fn)
void RunAdditionalPasses(std::initializer_list< CompilerPass::Id > passes)
FlowGraph * RunPasses(std::initializer_list< CompilerPass::Id > passes)
void CompileGraphAndAttachFunction()
TestPipeline(const Function &function, CompilerPass::PipelineMode mode, bool is_optimizing=true)
void RunForcedOptimizedAfterSSAPasses()
static Thread * Current()
IsolateGroup * isolate_group() const
Dart_NativeFunction(* Dart_NativeEntryResolver)(Dart_Handle name, int num_of_arguments, bool *auto_setup_scope)
Dart_NativeFunction function
#define FOR_EACH_INSTRUCTION(M)
#define FOR_EACH_ABSTRACT_INSTRUCTION(M)
#define DEFINE_MATCH_OPCODES(Instruction, _)
#define DEFINE_TYPED_CONSTRUCTOR(Type, ignored)
LibraryPtr LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri)
@ kMatchAndMoveBranchFalse
@ kMatchAndMoveBranchTrue
ObjectPtr Invoke(const Library &lib, const char *name)
FunctionPtr GetFunction(const Library &lib, const char *name)
LibraryPtr ReloadTestScript(const char *script)
ClassPtr GetClass(const Library &lib, const char *name)
TypeParameterPtr GetClassTypeParameter(const Class &klass, intptr_t index)
TypeParameterPtr GetFunctionTypeParameter(const Function &fun, intptr_t index)
NOT_IN_PRODUCT(LibraryPtr ReloadTestScript(const char *script))
InstructionsPtr BuildInstructions(std::function< void(compiler::Assembler *assembler)> fun)
static constexpr intptr_t kInvalidTryIndex
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static SkString join(const CommandLineFlags::StringArray &)
static constexpr bool IsUnboxedInteger(Representation rep)
#define RESOLVED_USER_TEST_URI