Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
dart::FlowGraphBuilderHelper Class Reference

#include <il_test_helper.h>

Classes

class  IncomingDef
 

Public Types

enum class  IncomingDefKind { kImmediate , kDelayed }
 

Public Member Functions

 FlowGraphBuilderHelper (intptr_t num_parameters=0, const std::function< void(const Function &)> &configure_function=[](const Function &) {})
 
TargetEntryInstrTargetEntry (intptr_t try_index=kInvalidTryIndex) const
 
JoinEntryInstrJoinEntry (intptr_t try_index=kInvalidTryIndex) const
 
ConstantInstrIntConstant (int64_t value, Representation representation=kTagged) const
 
ConstantInstrDoubleConstant (double value)
 
void AddVariable (const char *name, const AbstractType &static_type, CompileType *inferred_arg_type=nullptr)
 
PhiInstrPhi (JoinEntryInstr *join, std::initializer_list< IncomingDef > incoming)
 
void FinishGraph ()
 
FlowGraphflow_graph ()
 

Detailed Description

Definition at line 288 of file il_test_helper.h.

Member Enumeration Documentation

◆ IncomingDefKind

Enumerator
kImmediate 
kDelayed 

Definition at line 341 of file il_test_helper.h.

341 {
342 kImmediate,
343 kDelayed,
344 };

Constructor & Destructor Documentation

◆ FlowGraphBuilderHelper()

dart::FlowGraphBuilderHelper::FlowGraphBuilderHelper ( intptr_t  num_parameters = 0,
const std::function< void(const Function &)> &  configure_function = [](const Function&) {} 
)
inlineexplicit

Definition at line 290 of file il_test_helper.h.

293 {})
294 : state_(CompilerState::Current()),
295 flow_graph_(MakeDummyGraph(Thread::Current(),
296 num_parameters,
297 state_.is_optimizing(),
298 configure_function)) {
299 flow_graph_.CreateCommonConstants();
300 }
bool is_optimizing() const
static CompilerState & Current()
void CreateCommonConstants()
Definition: flow_graph.cc:1143
static Thread * Current()
Definition: thread.h:362

Member Function Documentation

◆ AddVariable()

void dart::FlowGraphBuilderHelper::AddVariable ( const char *  name,
const AbstractType static_type,
CompileType inferred_arg_type = nullptr 
)
inline

Definition at line 326 of file il_test_helper.h.

328 {
329 LocalVariable* v =
330 new LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
333 new CompileType(CompileType::FromAbstractType(
334 static_type, CompileType::kCanBeNull,
336 inferred_arg_type);
337 v->set_type_check_mode(LocalVariable::kTypeCheckedByCaller);
339 }
static constexpr bool kCannotBeSentinel
Definition: compile_type.h:49
static constexpr bool kCanBeNull
Definition: compile_type.h:45
static CompileType FromAbstractType(const AbstractType &type, bool can_be_null, bool can_be_sentinel)
const ParsedFunction & parsed_function() const
Definition: flow_graph.h:129
bool AddVariable(LocalVariable *variable)
Definition: scopes.cc:57
static constexpr intptr_t kNoKernelOffset
Definition: scopes.h:77
static Object & Handle()
Definition: object.h:407
LocalScope * scope() const
Definition: parser.h:76
static StringPtr New(Thread *thread, const char *cstr)
Definition: symbols.h:723
const char *const name

◆ DoubleConstant()

ConstantInstr * dart::FlowGraphBuilderHelper::DoubleConstant ( double  value)
inline

Definition at line 320 of file il_test_helper.h.

320 {
322 }
static DoublePtr NewCanonical(double d)
Definition: object.cc:23418
ConstantInstr * GetConstant(const Object &object, Representation representation=kTagged)
Definition: flow_graph.cc:187
uint8_t value

◆ FinishGraph()

void dart::FlowGraphBuilderHelper::FinishGraph ( )
inline

Definition at line 387 of file il_test_helper.h.

387 {
388 flow_graph_.DiscoverBlocks();
389 GrowableArray<BitVector*> dominance_frontier;
390 flow_graph_.ComputeDominators(&dominance_frontier);
391
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());
396 EXPECT(pred_index != -1);
397 pending.phi->InputAt(pred_index)->BindTo(pending.incoming.defn());
398 }
399 }
#define EXPECT(type, expectedAlignment, expectedSize)
void DiscoverBlocks()
Definition: flow_graph.cc:346
void ComputeDominators(GrowableArray< BitVector * > *dominance_frontier)
Definition: flow_graph.cc:975
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ flow_graph()

FlowGraph * dart::FlowGraphBuilderHelper::flow_graph ( )
inline

Definition at line 401 of file il_test_helper.h.

401{ return &flow_graph_; }

◆ IntConstant()

ConstantInstr * dart::FlowGraphBuilderHelper::IntConstant ( int64_t  value,
Representation  representation = kTagged 
) const
inline

Definition at line 312 of file il_test_helper.h.

313 {
314 ASSERT(representation == kTagged ||
316 return flow_graph_.GetConstant(
318 }
static IntegerPtr NewCanonical(const String &str)
Definition: object.cc:22999
#define ASSERT(E)
static constexpr bool IsUnboxedInteger(Representation rep)
Definition: locations.h:92

◆ JoinEntry()

JoinEntryInstr * dart::FlowGraphBuilderHelper::JoinEntry ( intptr_t  try_index = kInvalidTryIndex) const
inline

Definition at line 307 of file il_test_helper.h.

307 {
308 return new JoinEntryInstr(flow_graph_.allocate_block_id(), try_index,
309 state_.GetNextDeoptId());
310 }
intptr_t GetNextDeoptId()
intptr_t allocate_block_id()
Definition: flow_graph.h:266

◆ Phi()

PhiInstr * dart::FlowGraphBuilderHelper::Phi ( JoinEntryInstr join,
std::initializer_list< IncomingDef incoming 
)
inline

Definition at line 373 of file il_test_helper.h.

374 {
375 auto phi = new PhiInstr(join, incoming.size());
376 for (size_t i = 0; i < incoming.size(); i++) {
377 auto input = new Value(flow_graph_.constant_dead());
378 phi->SetInputAt(i, input);
379 input->definition()->AddInputUse(input);
380 }
381 for (auto def : incoming) {
382 pending_phis_.Add({phi, def});
383 }
384 return phi;
385 }
size_t size() const
Definition: SkString.h:131
void Add(const T &value)
ConstantInstr * constant_dead() const
Definition: flow_graph.h:272

◆ TargetEntry()

TargetEntryInstr * dart::FlowGraphBuilderHelper::TargetEntry ( intptr_t  try_index = kInvalidTryIndex) const
inline

Definition at line 302 of file il_test_helper.h.

302 {
303 return new TargetEntryInstr(flow_graph_.allocate_block_id(), try_index,
304 state_.GetNextDeoptId());
305 }

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