Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::compiler::BlockBuilder Class Reference

#include <block_builder.h>

Inheritance diagram for dart::compiler::BlockBuilder:
dart::ValueObject

Public Member Functions

 BlockBuilder (FlowGraph *flow_graph, BlockEntryInstr *entry, bool with_frame=true)
 
DefinitionAddToInitialDefinitions (Definition *def)
 
template<typename T >
TAddDefinition (T *def)
 
template<typename T >
TAddInstruction (T *instr)
 
const Functionfunction () const
 
DartReturnInstrAddReturn (Value *value)
 
DefinitionAddParameter (intptr_t index)
 
DefinitionAddParameter (intptr_t index, Representation representation, Location location=Location())
 
TokenPosition TokenPos () const
 
const InstructionSourceSource () const
 
DefinitionAddNullDefinition ()
 
DefinitionAddUnboxInstr (Representation rep, Value *value, bool is_checked)
 
DefinitionAddUnboxInstr (Representation rep, Definition *boxed, bool is_checked)
 
BranchInstrAddBranch (ComparisonInstr *comp, TargetEntryInstr *true_successor, TargetEntryInstr *false_successor)
 
void AddPhi (PhiInstr *phi)
 
Instructionlast () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 19 of file block_builder.h.

Constructor & Destructor Documentation

◆ BlockBuilder()

dart::compiler::BlockBuilder::BlockBuilder ( FlowGraph flow_graph,
BlockEntryInstr entry,
bool  with_frame = true 
)
inline

Definition at line 21 of file block_builder.h.

24 : flow_graph_(flow_graph),
25 source_(InstructionSource(flow_graph_->function().token_pos(),
26 flow_graph->inlining_id())),
27 entry_(entry),
28 current_(entry),
29 dummy_env_(new Environment(0, 0, 0, flow_graph->function(), nullptr)),
30 with_frame_(with_frame) {
31 // Some graph transformations use environments from block entries.
32 entry->SetEnvironment(dummy_env_);
33 }
const Function & function() const
Definition flow_graph.h:130
TokenPosition token_pos() const
Definition object.h:3426

Member Function Documentation

◆ AddBranch()

BranchInstr * dart::compiler::BlockBuilder::AddBranch ( ComparisonInstr comp,
TargetEntryInstr true_successor,
TargetEntryInstr false_successor 
)
inline

Definition at line 132 of file block_builder.h.

134 {
135 auto branch =
136 new BranchInstr(comp, CompilerState::Current().GetNextDeoptId());
137 // Some graph transformations use environments from branches.
138 branch->SetEnvironment(dummy_env_);
139 current_->AppendInstruction(branch);
140 current_ = nullptr;
141
142 *branch->true_successor_address() = true_successor;
143 *branch->false_successor_address() = false_successor;
144
145 return branch;
146 }
static CompilerState & Current()
Instruction * AppendInstruction(Instruction *tail)
Definition il.cc:1339

◆ AddDefinition()

template<typename T >
T * dart::compiler::BlockBuilder::AddDefinition ( T def)
inline

Definition at line 43 of file block_builder.h.

43 {
44 flow_graph_->AllocateSSAIndex(def);
45 AddInstruction(def);
46 return def;
47 }
void AllocateSSAIndex(Definition *def)
Definition flow_graph.h:274

◆ AddInstruction()

template<typename T >
T * dart::compiler::BlockBuilder::AddInstruction ( T instr)
inline

Definition at line 50 of file block_builder.h.

50 {
51 if (instr->ComputeCanDeoptimize() ||
52 instr->ComputeCanDeoptimizeAfterCall() ||
53 instr->CanBecomeDeoptimizationTarget()) {
54 // All instructions that can deoptimize must have an environment attached
55 // to them.
56 instr->SetEnvironment(dummy_env_);
57 }
58 current_ = current_->AppendInstruction(instr);
59 return instr;
60 }

◆ AddNullDefinition()

Definition * dart::compiler::BlockBuilder::AddNullDefinition ( )
inline

Definition at line 95 of file block_builder.h.

95 {
96 return flow_graph_->GetConstant(Object::ZoneHandle());
97 }
ConstantInstr * GetConstant(const Object &object, Representation representation=kTagged)
static Object & ZoneHandle()
Definition object.h:419

◆ AddParameter() [1/2]

Definition * dart::compiler::BlockBuilder::AddParameter ( intptr_t  index)
inline

Definition at line 75 of file block_builder.h.

75 {
76 const auto [location, representation] =
77 flow_graph_->GetDirectParameterInfoAt(index);
78 return AddParameter(index, representation,
79 with_frame_ ? location : location.ToEntrySpRelative());
80 }
const std::pair< Location, Representation > & GetDirectParameterInfoAt(intptr_t i)
Definition flow_graph.h:573
Definition * AddParameter(intptr_t index)

◆ AddParameter() [2/2]

Definition * dart::compiler::BlockBuilder::AddParameter ( intptr_t  index,
Representation  representation,
Location  location = Location() 
)
inline

Definition at line 82 of file block_builder.h.

84 {
85 auto normal_entry = flow_graph_->graph_entry()->normal_entry();
87 new ParameterInstr(normal_entry,
88 /*env_index=*/index,
89 /*param_index=*/index, location, representation));
90 }
GraphEntryInstr * graph_entry() const
Definition flow_graph.h:268
FunctionEntryInstr * normal_entry() const
Definition il.h:1986
Definition * AddToInitialDefinitions(Definition *def)

◆ AddPhi()

void dart::compiler::BlockBuilder::AddPhi ( PhiInstr phi)
inline

Definition at line 148 of file block_builder.h.

148 {
149 flow_graph_->AllocateSSAIndex(phi);
150 phi->mark_alive();
151 entry_->AsJoinEntry()->InsertPhi(phi);
152 }

◆ AddReturn()

DartReturnInstr * dart::compiler::BlockBuilder::AddReturn ( Value value)
inline

Definition at line 64 of file block_builder.h.

64 {
65 const auto& function = flow_graph_->function();
66 const auto representation = FlowGraph::ReturnRepresentationOf(function);
67 DartReturnInstr* instr = new DartReturnInstr(
68 Source(), value, CompilerState::Current().GetNextDeoptId(),
69 representation);
70 AddInstruction(instr);
71 entry_->set_last_instruction(instr);
72 return instr;
73 }
void set_last_instruction(Instruction *instr)
Definition il.h:1681
static Representation ReturnRepresentationOf(const Function &function)
const InstructionSource & Source() const
const Function & function() const

◆ AddToInitialDefinitions()

Definition * dart::compiler::BlockBuilder::AddToInitialDefinitions ( Definition def)
inline

Definition at line 35 of file block_builder.h.

35 {
36 flow_graph_->AllocateSSAIndex(def);
37 auto normal_entry = flow_graph_->graph_entry()->normal_entry();
38 flow_graph_->AddToInitialDefinitions(normal_entry, def);
39 return def;
40 }
void AddToInitialDefinitions(BlockEntryWithInitialDefs *entry, Definition *defn)

◆ AddUnboxInstr() [1/2]

Definition * dart::compiler::BlockBuilder::AddUnboxInstr ( Representation  rep,
Definition boxed,
bool  is_checked 
)
inline

Definition at line 126 of file block_builder.h.

128 {
129 return AddUnboxInstr(rep, new Value(boxed), is_checked);
130 }
Definition * AddUnboxInstr(Representation rep, Value *value, bool is_checked)

◆ AddUnboxInstr() [2/2]

Definition * dart::compiler::BlockBuilder::AddUnboxInstr ( Representation  rep,
Value value,
bool  is_checked 
)
inline

Definition at line 99 of file block_builder.h.

99 {
100 // Unbox floats by first unboxing a double then converting it to a float.
101 auto const unbox_rep = rep == kUnboxedFloat
102 ? kUnboxedDouble
104 Definition* unboxed_value =
106 if (rep != unbox_rep && unboxed_value->IsUnboxInteger()) {
109 // Mark unboxing of small unboxed integer representations as truncating.
110 unboxed_value->AsUnboxInteger()->mark_truncating();
111 }
112 if (is_checked) {
113 // The type of |value| has already been checked and it is safe to
114 // adjust reaching type. This is done manually because there is no type
115 // propagation when building intrinsics.
116 unboxed_value->AsUnbox()->value()->SetReachingType(
117 new CompileType(CompileType::FromUnboxedRepresentation(rep)));
118 }
119 if (rep == kUnboxedFloat) {
120 unboxed_value = AddDefinition(
121 new DoubleToFloatInstr(new Value(unboxed_value), DeoptId::kNone));
122 }
123 return unboxed_value;
124 }
static CompileType FromUnboxedRepresentation(Representation rep)
static constexpr intptr_t kNone
Definition deopt_id.h:27
static UnboxInstr * Create(Representation to, Value *value, intptr_t deopt_id, SpeculativeMode speculative_mode=kGuardInputs)
Definition il.cc:4045
#define ASSERT(E)
static constexpr Representation NativeRepresentation(Representation rep)
Definition il.h:8456
static constexpr size_t ValueSize(Representation rep)
Definition locations.h:112

◆ function()

const Function & dart::compiler::BlockBuilder::function ( ) const
inline

Definition at line 62 of file block_builder.h.

62{ return flow_graph_->function(); }

◆ last()

Instruction * dart::compiler::BlockBuilder::last ( ) const
inline

Definition at line 154 of file block_builder.h.

154{ return current_; }

◆ Source()

const InstructionSource & dart::compiler::BlockBuilder::Source ( ) const
inline

Definition at line 93 of file block_builder.h.

93{ return source_; }

◆ TokenPos()

TokenPosition dart::compiler::BlockBuilder::TokenPos ( ) const
inline

Definition at line 92 of file block_builder.h.

92{ return source_.token_pos; }
const TokenPosition token_pos

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