Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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)
 
TargetEntryInstrTargetEntry (intptr_t try_index=kInvalidTryIndex) const
 
JoinEntryInstrJoinEntry (intptr_t try_index=kInvalidTryIndex) const
 
ConstantInstrIntConstant (int64_t value) 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 271 of file il_test_helper.h.

Member Enumeration Documentation

◆ IncomingDefKind

Enumerator
kImmediate 
kDelayed 

Definition at line 317 of file il_test_helper.h.

Constructor & Destructor Documentation

◆ FlowGraphBuilderHelper()

dart::FlowGraphBuilderHelper::FlowGraphBuilderHelper ( intptr_t  num_parameters = 0)
inlineexplicit

Definition at line 273 of file il_test_helper.h.

274 : state_(CompilerState::Current()),
275 flow_graph_(MakeDummyGraph(Thread::Current(),
276 num_parameters,
277 state_.is_optimizing())) {
278 flow_graph_.CreateCommonConstants();
279 }
bool is_optimizing() const
static CompilerState & Current()
void CreateCommonConstants()
static Thread * Current()
Definition thread.h:361

Member Function Documentation

◆ AddVariable()

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

Definition at line 302 of file il_test_helper.h.

304 {
305 LocalVariable* v =
306 new LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
309 new CompileType(CompileType::FromAbstractType(
310 static_type, CompileType::kCanBeNull,
312 inferred_arg_type);
313 v->set_type_check_mode(LocalVariable::kTypeCheckedByCaller);
315 }
static constexpr bool kCannotBeSentinel
static constexpr bool kCanBeNull
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:722
const char *const name

◆ DoubleConstant()

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

Definition at line 296 of file il_test_helper.h.

296 {
297 return flow_graph_.GetConstant(Double::Handle(Double::NewCanonical(value)));
298 }
static DoublePtr NewCanonical(double d)
Definition object.cc:23497
ConstantInstr * GetConstant(const Object &object, Representation representation=kTagged)

◆ FinishGraph()

void dart::FlowGraphBuilderHelper::FinishGraph ( )
inline

Definition at line 363 of file il_test_helper.h.

363 {
364 flow_graph_.DiscoverBlocks();
365 GrowableArray<BitVector*> dominance_frontier;
366 flow_graph_.ComputeDominators(&dominance_frontier);
367
368 for (auto& pending : pending_phis_) {
369 auto join = pending.phi->block();
370 EXPECT(pending.phi->InputCount() == join->PredecessorCount());
371 auto pred_index = join->IndexOfPredecessor(pending.incoming.from());
372 EXPECT(pred_index != -1);
373 pending.phi->InputAt(pred_index)->BindTo(pending.incoming.defn());
374 }
375 }
#define EXPECT(type, expectedAlignment, expectedSize)
void DiscoverBlocks()
void ComputeDominators(GrowableArray< BitVector * > *dominance_frontier)
SINT Vec< 2 *N, T > join(const Vec< N, T > &lo, const Vec< N, T > &hi)
Definition SkVx.h:242

◆ flow_graph()

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

Definition at line 377 of file il_test_helper.h.

377{ return &flow_graph_; }

◆ IntConstant()

ConstantInstr * dart::FlowGraphBuilderHelper::IntConstant ( int64_t  value) const
inline

Definition at line 291 of file il_test_helper.h.

291 {
292 return flow_graph_.GetConstant(
294 }
static IntegerPtr NewCanonical(const String &str)
Definition object.cc:23078

◆ JoinEntry()

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

Definition at line 286 of file il_test_helper.h.

286 {
287 return new JoinEntryInstr(flow_graph_.allocate_block_id(), try_index,
288 state_.GetNextDeoptId());
289 }
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 349 of file il_test_helper.h.

350 {
351 auto phi = new PhiInstr(join, incoming.size());
352 for (size_t i = 0; i < incoming.size(); i++) {
353 auto input = new Value(flow_graph_.constant_dead());
354 phi->SetInputAt(i, input);
355 input->definition()->AddInputUse(input);
356 }
357 for (auto def : incoming) {
358 pending_phis_.Add({phi, def});
359 }
360 return phi;
361 }
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 281 of file il_test_helper.h.

281 {
282 return new TargetEntryInstr(flow_graph_.allocate_block_id(), try_index,
283 state_.GetNextDeoptId());
284 }

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