Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Friends | List of all members
dart::Instruction Class Referenceabstract

#include <il.h>

Inheritance diagram for dart::Instruction:
dart::ZoneAllocated dart::BranchInstr dart::CheckConditionInstr dart::Definition dart::PureInstruction dart::ReturnBaseInstr dart::AllocationInstr dart::ComparisonInstr dart::DropTempsInstr dart::IfThenElseInstr dart::PureDefinition dart::SimdOpInstr dart::VariadicDefinition dart::DartReturnInstr dart::NativeReturnInstr

Classes

struct  InputsTrait
 
struct  SuccessorsTrait
 

Public Types

enum  Tag { FOR_EACH_INSTRUCTION =(DECLARE_TAG) kNumInstructions }
 
enum  SpeculativeMode { kGuardInputs , kNotSpeculative }
 
using InputsIterable = InstructionIndexedPropertyIterable< InputsTrait >
 
using SuccessorsIterable = InstructionIndexedPropertyIterable< SuccessorsTrait >
 

Public Member Functions

 Instruction (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
 Instruction (intptr_t deopt_id=DeoptId::kNone)
 
virtual ~Instruction ()
 
virtual Tag tag () const =0
 
virtual intptr_t statistics_tag () const
 
intptr_t deopt_id () const
 
virtual TokenPosition token_pos () const
 
InstructionSource source () const
 
virtual intptr_t InputCount () const =0
 
virtual ValueInputAt (intptr_t i) const =0
 
void SetInputAt (intptr_t i, Value *value)
 
InputsIterable inputs ()
 
void UnuseAllInputs ()
 
virtual intptr_t ArgumentCount () const
 
ValueArgumentValueAt (intptr_t index) const
 
DefinitionArgumentAt (intptr_t index) const
 
virtual void SetMoveArguments (MoveArgumentsArray *move_arguments)
 
virtual MoveArgumentsArrayGetMoveArguments () const
 
virtual void ReplaceInputsWithMoveArguments (MoveArgumentsArray *move_arguments)
 
bool HasMoveArguments () const
 
void RepairArgumentUsesInEnvironment () const
 
virtual bool ComputeCanDeoptimize () const =0
 
virtual bool ComputeCanDeoptimizeAfterCall () const
 
bool CanDeoptimize () const
 
virtual void Accept (InstructionVisitor *visitor)=0
 
Instructionprevious () const
 
void set_previous (Instruction *instr)
 
Instructionnext () const
 
void set_next (Instruction *instr)
 
void LinkTo (Instruction *next)
 
InstructionRemoveFromGraph (bool return_previous=true)
 
virtual intptr_t SuccessorCount () const
 
virtual BlockEntryInstrSuccessorAt (intptr_t index) const
 
SuccessorsIterable successors () const
 
void Goto (JoinEntryInstr *entry)
 
virtual const char * DebugName () const =0
 
void CheckField (const Field &field) const
 
const char * ToCString () const
 
 DECLARE_INSTRUCTION_TYPE_CHECK (BlockEntryWithInitialDefs, BlockEntryWithInitialDefs) template< typename T > T *Cast()
 
template<typename T >
const TCast () const
 
LocationSummarylocs ()
 
bool HasLocs () const
 
virtual LocationSummaryMakeLocationSummary (Zone *zone, bool is_optimizing) const =0
 
void InitializeLocationSummary (Zone *zone, bool optimizing)
 
virtual void EmitNativeCode (FlowGraphCompiler *compiler)
 
Environmentenv () const
 
void SetEnvironment (Environment *deopt_env)
 
void RemoveEnvironment ()
 
void ReplaceInEnvironment (Definition *current, Definition *replacement)
 
virtual intptr_t NumberOfInputsConsumedBeforeCall () const
 
intptr_t GetPassSpecificId (CompilerPass::Id pass) const
 
void SetPassSpecificId (CompilerPass::Id pass, intptr_t id)
 
bool HasPassSpecificId (CompilerPass::Id pass) const
 
bool HasUnmatchedInputRepresentations () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
SpeculativeMode SpeculativeModeOfInputs () const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual Representation representation () const
 
bool WasEliminated () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
void InsertBefore (Instruction *next)
 
void InsertAfter (Instruction *prev)
 
InstructionAppendInstruction (Instruction *tail)
 
virtual bool AllowsCSE () const
 
virtual bool HasUnknownSideEffects () const =0
 
virtual bool CanCallDart () const
 
virtual bool CanTriggerGC () const
 
virtual BlockEntryInstrGetBlock ()
 
virtual intptr_t inlining_id () const
 
virtual void set_inlining_id (intptr_t value)
 
virtual bool has_inlining_id () const
 
virtual uword Hash () const
 
bool Equals (const Instruction &other) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
void InheritDeoptTarget (Zone *zone, Instruction *other)
 
bool NeedsEnvironment () const
 
virtual bool CanBecomeDeoptimizationTarget () const
 
void InheritDeoptTargetAfter (FlowGraph *flow_graph, Definition *call, Definition *result)
 
virtual bool MayThrow () const =0
 
virtual bool MayHaveVisibleEffect () const
 
virtual bool CanEliminate (const BlockEntryInstr *block) const
 
bool CanEliminate ()
 
bool IsDominatedBy (Instruction *dom)
 
void ClearEnv ()
 
void Unsupported (FlowGraphCompiler *compiler)
 
virtual bool UseSharedSlowPathStub (bool is_optimizing) const
 
Location::Kind RegisterKindForResult () const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Member Functions

static const ICDataGetICData (const ZoneGrowableArray< const ICData * > &ic_data_array, intptr_t deopt_id, bool is_static_call)
 
static LocationSummaryMakeCallSummary (Zone *zone, const Instruction *instr, LocationSummary *locs=nullptr)
 
static bool SlowPathSharingSupported (bool is_optimizing)
 

Static Public Attributes

static const intptr_t kInstructionAttrs [kNumInstructions]
 

Protected Member Functions

intptr_t GetDeoptId () const
 
virtual void CopyDeoptIdFrom (const Instruction &instr)
 
void WriteExtraWithoutInputs (FlowGraphSerializer *s)
 
void ReadExtraWithoutInputs (FlowGraphDeserializer *d)
 

Private Member Functions

virtual void RawSetInputAt (intptr_t i, Value *value)=0
 

Friends

class CallSiteInliner
 
class LICM
 
class ComparisonInstr
 
class Scheduler
 
class BlockEntryInstr
 
class CatchBlockEntryInstr
 
class DebugStepCheckInstr
 
class StrictCompareInstr
 
class BranchInstr
 
class IfThenElseInstr
 
class CheckConditionInstr
 

Detailed Description

Definition at line 956 of file il.h.

Member Typedef Documentation

◆ InputsIterable

Definition at line 1025 of file il.h.

◆ SuccessorsIterable

Definition at line 1129 of file il.h.

Member Enumeration Documentation

◆ SpeculativeMode

Enumerator
kGuardInputs 
kNotSpeculative 

Definition at line 964 of file il.h.

964 {
965 // Types of inputs should be checked when unboxing for this instruction.
967 // Each input is guaranteed to have a valid type for the input
968 // representation and its type should not be checked when unboxing.
970 };
@ kNotSpeculative
Definition il.h:969

◆ Tag

Enumerator
FOR_EACH_INSTRUCTION 

Definition at line 959 of file il.h.

959{ FOR_EACH_INSTRUCTION(DECLARE_TAG) kNumInstructions };
@ FOR_EACH_INSTRUCTION
Definition il.h:959
#define DECLARE_TAG(type, attrs)
Definition il.h:958

Constructor & Destructor Documentation

◆ Instruction() [1/2]

dart::Instruction::Instruction ( const InstructionSource source,
intptr_t  deopt_id = DeoptId::kNone 
)
inlineexplicit

Definition at line 974 of file il.h.

976 : deopt_id_(deopt_id), inlining_id_(source.inlining_id) {}
InstructionSource source() const
Definition il.h:1002
intptr_t deopt_id() const
Definition il.h:987

◆ Instruction() [2/2]

dart::Instruction::Instruction ( intptr_t  deopt_id = DeoptId::kNone)
inlineexplicit

Definition at line 978 of file il.h.

979 : Instruction(InstructionSource(), deopt_id) {}
Instruction(const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
Definition il.h:974

◆ ~Instruction()

virtual dart::Instruction::~Instruction ( )
inlinevirtual

Definition at line 981 of file il.h.

981{}

Member Function Documentation

◆ Accept()

virtual void dart::Instruction::Accept ( InstructionVisitor visitor)
pure virtual

◆ AllowsCSE()

virtual bool dart::Instruction::AllowsCSE ( ) const
inlinevirtual

◆ AppendInstruction()

Instruction * dart::Instruction::AppendInstruction ( Instruction tail)

Definition at line 1339 of file il.cc.

1339 {
1340 LinkTo(tail);
1341 // Update def-use chains whenever instructions are added to the graph
1342 // after initial graph construction.
1343 for (intptr_t i = tail->InputCount() - 1; i >= 0; --i) {
1344 Value* input = tail->InputAt(i);
1345 input->definition()->AddInputUse(input);
1346 }
1347 return tail;
1348}
void LinkTo(Instruction *next)
Definition il.h:1102

◆ ArgumentAt()

Definition * dart::Instruction::ArgumentAt ( intptr_t  index) const
inline

Definition at line 3423 of file il.h.

3423 {
3424 return ArgumentValueAt(index)->definition();
3425}
Value * ArgumentValueAt(intptr_t index) const
Definition il.h:3417
Definition * definition() const
Definition il.h:103

◆ ArgumentCount()

virtual intptr_t dart::Instruction::ArgumentCount ( ) const
inlinevirtual

Reimplemented in dart::BranchInstr, dart::TemplateDartCall< kExtraInputs >, dart::TemplateDartCall< 0 >, and dart::TemplateDartCall< 1 >.

Definition at line 1035 of file il.h.

1035{ return 0; }

◆ ArgumentValueAt()

Value * dart::Instruction::ArgumentValueAt ( intptr_t  index) const
inline

Definition at line 3417 of file il.h.

3417 {
3418 MoveArgumentsArray* move_arguments = GetMoveArguments();
3419 return move_arguments != nullptr ? (*move_arguments)[index]->value()
3420 : InputAt(index);
3421}
virtual Value * InputAt(intptr_t i) const =0
virtual MoveArgumentsArray * GetMoveArguments() const
Definition il.h:1044
ZoneGrowableArray< MoveArgumentInstr * > MoveArgumentsArray
Definition il.h:896

◆ AttributesEqual()

virtual bool dart::Instruction::AttributesEqual ( const Instruction other) const
inlinevirtual

◆ CanBecomeDeoptimizationTarget()

virtual bool dart::Instruction::CanBecomeDeoptimizationTarget ( ) const
inlinevirtual

◆ CanCallDart()

virtual bool dart::Instruction::CanCallDart ( ) const
inlinevirtual

◆ CanDeoptimize()

bool dart::Instruction::CanDeoptimize ( ) const
inline

Definition at line 1073 of file il.h.

1073 {
1074 return env() != nullptr &&
1076 }
virtual bool ComputeCanDeoptimizeAfterCall() const
Definition il.h:1064
virtual bool ComputeCanDeoptimize() const =0
Environment * env() const
Definition il.h:1209

◆ CanEliminate() [1/2]

bool dart::Instruction::CanEliminate ( )
inline

Definition at line 1354 of file il.h.

1354{ return CanEliminate(GetBlock()); }
virtual BlockEntryInstr * GetBlock()
Definition il.cc:1350
bool CanEliminate()
Definition il.h:1354

◆ CanEliminate() [2/2]

bool dart::Instruction::CanEliminate ( const BlockEntryInstr block) const
virtual

Reimplemented in dart::Definition.

Definition at line 1566 of file il.cc.

1566 {
1567 ASSERT(const_cast<Instruction*>(this)->GetBlock() == block);
1568 return !MayHaveVisibleEffect() && !CanDeoptimize() &&
1569 this != block->last_instruction();
1570}
virtual bool MayHaveVisibleEffect() const
Definition il.h:1346
bool CanDeoptimize() const
Definition il.h:1073
#define ASSERT(E)

◆ Canonicalize()

Instruction * dart::Instruction::Canonicalize ( FlowGraph flow_graph)
virtual

◆ CanTriggerGC()

bool dart::Instruction::CanTriggerGC ( ) const
virtual

Definition at line 1619 of file il.cc.

1619 {
1620 return (kInstructionAttrs[tag()] & InstrAttrs::kNoGC) == 0;
1621}
static const intptr_t kInstructionAttrs[kNumInstructions]
Definition il.h:962
virtual Tag tag() const =0

◆ Cast()

template<typename T >
const T * dart::Instruction::Cast ( ) const
inline

Definition at line 1180 of file il.h.

1180 {
1181 return static_cast<const T*>(this);
1182 }
#define T

◆ CheckField()

void dart::Instruction::CheckField ( const Field field) const
inline

Definition at line 1147 of file il.h.

1147{}

◆ ClearEnv()

void dart::Instruction::ClearEnv ( )
inline

Definition at line 1358 of file il.h.

1358{ env_ = nullptr; }

◆ ComputeCanDeoptimize()

virtual bool dart::Instruction::ComputeCanDeoptimize ( ) const
pure virtual

◆ ComputeCanDeoptimizeAfterCall()

virtual bool dart::Instruction::ComputeCanDeoptimizeAfterCall ( ) const
inlinevirtual

Reimplemented in dart::TemplateDartCall< kExtraInputs >, dart::TemplateDartCall< 0 >, dart::TemplateDartCall< 1 >, dart::StaticCallInstr, dart::CachableIdempotentCallInstr, dart::FfiCallInstr, and dart::AllocationInstr.

Definition at line 1064 of file il.h.

1064 {
1065 // TODO(dartbug.com/45213): Incrementally migrate IR instructions from using
1066 // [ComputeCanDeoptimize] to [ComputeCanDeoptimizeAfterCall] if they
1067 // can only lazy deoptimize.
1068 return false;
1069 }

◆ CopyDeoptIdFrom()

virtual void dart::Instruction::CopyDeoptIdFrom ( const Instruction instr)
inlineprotectedvirtual

Reimplemented in dart::BranchInstr, dart::IfThenElseInstr, and dart::CheckConditionInstr.

Definition at line 1405 of file il.h.

1405 {
1406 deopt_id_ = instr.deopt_id_;
1407 }

◆ DebugName()

virtual const char * dart::Instruction::DebugName ( ) const
pure virtual

◆ DECLARE_INSTRUCTION_TYPE_CHECK()

dart::Instruction::DECLARE_INSTRUCTION_TYPE_CHECK ( BlockEntryWithInitialDefs  ,
BlockEntryWithInitialDefs   
)
inline

Definition at line 1166 of file il.h.

1175 {
1176 return static_cast<T*>(this);
1177 }

◆ deopt_id()

intptr_t dart::Instruction::deopt_id ( ) const
inline

Definition at line 987 of file il.h.

987 {
990 CompilerState::Current().is_aot());
991 return GetDeoptId();
992 }
static CompilerState & Current()
intptr_t GetDeoptId() const
Definition il.h:1403
virtual bool MayThrow() const =0
virtual bool CanBecomeDeoptimizationTarget() const
Definition il.h:1337

◆ DeoptimizationTarget()

virtual intptr_t dart::Instruction::DeoptimizationTarget ( ) const
inlinevirtual

◆ EmitNativeCode()

virtual void dart::Instruction::EmitNativeCode ( FlowGraphCompiler compiler)
inlinevirtual

Reimplemented in dart::ComparisonInstr.

Definition at line 1207 of file il.h.

1207{ UNIMPLEMENTED(); }
#define UNIMPLEMENTED

◆ env()

Environment * dart::Instruction::env ( ) const
inline

Definition at line 1209 of file il.h.

1209{ return env_; }

◆ Equals()

bool dart::Instruction::Equals ( const Instruction other) const

Definition at line 617 of file il.cc.

617 {
618 if (tag() != other.tag()) return false;
619 if (InputCount() != other.InputCount()) return false;
620 for (intptr_t i = 0; i < InputCount(); ++i) {
621 if (!InputAt(i)->Equals(*other.InputAt(i))) return false;
622 }
623 return AttributesEqual(other);
624}
virtual bool AttributesEqual(const Instruction &other) const
Definition il.h:1325
virtual intptr_t InputCount() const =0
bool Equals(const Value &other) const
Definition il.cc:631

◆ GetBlock()

BlockEntryInstr * dart::Instruction::GetBlock ( )
virtual

Reimplemented in dart::PhiInstr.

Definition at line 1350 of file il.cc.

1350 {
1351 // TODO(fschneider): Implement a faster way to get the block of an
1352 // instruction.
1354 while ((result != nullptr) && !result->IsBlockEntry()) {
1355 result = result->previous();
1356 }
1357 // InlineExitCollector::RemoveUnreachableExits may call
1358 // Instruction::GetBlock on instructions which are not properly linked
1359 // to the flow graph (as collected exits may belong to unreachable
1360 // fragments), so this code should gracefully handle the absence of
1361 // BlockEntry.
1362 return (result != nullptr) ? result->AsBlockEntry() : nullptr;
1363}
Instruction * previous() const
Definition il.h:1081
GAsyncResult * result

◆ GetDeoptId()

intptr_t dart::Instruction::GetDeoptId ( ) const
inlineprotected

Definition at line 1403 of file il.h.

1403{ return deopt_id_; }

◆ GetICData()

const ICData * dart::Instruction::GetICData ( const ZoneGrowableArray< const ICData * > &  ic_data_array,
intptr_t  deopt_id,
bool  is_static_call 
)
static

Definition at line 593 of file il.cc.

596 {
597 // The deopt_id can be outside the range of the IC data array for
598 // computations added in the optimizing compiler.
600 if (deopt_id >= ic_data_array.length()) {
601 return nullptr;
602 }
603 const ICData* result = ic_data_array[deopt_id];
604 ASSERT(result == nullptr || is_static_call == result->is_static_call());
605 return result;
606}

◆ GetMoveArguments()

virtual MoveArgumentsArray * dart::Instruction::GetMoveArguments ( ) const
inlinevirtual

Reimplemented in dart::BranchInstr, dart::TemplateDartCall< kExtraInputs >, dart::TemplateDartCall< 0 >, and dart::TemplateDartCall< 1 >.

Definition at line 1044 of file il.h.

1044 {
1045 UNREACHABLE();
1046 return nullptr;
1047 }

◆ GetPassSpecificId()

intptr_t dart::Instruction::GetPassSpecificId ( CompilerPass::Id  pass) const
inline

Definition at line 1218 of file il.h.

1218 {
1219 return (PassSpecificId::DecodePass(pass_specific_id_) == pass)
1220 ? PassSpecificId::DecodeId(pass_specific_id_)
1221 : PassSpecificId::kNoId;
1222 }

◆ Goto()

void dart::Instruction::Goto ( JoinEntryInstr entry)

Definition at line 2021 of file il.cc.

2021 {
2022 LinkTo(new GotoInstr(entry, CompilerState::Current().GetNextDeoptId()));
2023}

◆ has_inlining_id()

virtual bool dart::Instruction::has_inlining_id ( ) const
inlinevirtual

Reimplemented in dart::BranchInstr.

Definition at line 1311 of file il.h.

1311{ return inlining_id_ >= 0; }

◆ Hash()

uword dart::Instruction::Hash ( ) const
virtual

Reimplemented in dart::PhiInstr.

Definition at line 608 of file il.cc.

608 {
609 uword result = tag();
610 for (intptr_t i = 0; i < InputCount(); ++i) {
611 Value* value = InputAt(i);
612 result = CombineHashes(result, value->definition()->ssa_temp_index());
613 }
614 return FinalizeHash(result, kBitsPerInt32 - 1);
615}
uint8_t value
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
Definition hash.h:12
uintptr_t uword
Definition globals.h:501
constexpr intptr_t kBitsPerInt32
Definition globals.h:466
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
Definition hash.h:20

◆ HasLocs()

bool dart::Instruction::HasLocs ( ) const
inline

Definition at line 1191 of file il.h.

1191{ return locs_ != nullptr; }

◆ HasMoveArguments()

bool dart::Instruction::HasMoveArguments ( ) const
inline

Definition at line 1053 of file il.h.

1053{ return GetMoveArguments() != nullptr; }

◆ HasPassSpecificId()

bool dart::Instruction::HasPassSpecificId ( CompilerPass::Id  pass) const
inline

Definition at line 1226 of file il.h.

1226 {
1227 return (PassSpecificId::DecodePass(pass_specific_id_) == pass) &&
1228 (PassSpecificId::DecodeId(pass_specific_id_) !=
1229 PassSpecificId::kNoId);
1230 }

◆ HasUnknownSideEffects()

virtual bool dart::Instruction::HasUnknownSideEffects ( ) const
pure virtual

◆ HasUnmatchedInputRepresentations()

bool dart::Instruction::HasUnmatchedInputRepresentations ( ) const

Definition at line 1600 of file il.cc.

1600 {
1601 for (intptr_t i = 0; i < InputCount(); i++) {
1602 Definition* input = InputAt(i)->definition();
1603 const Representation input_representation = RequiredInputRepresentation(i);
1604 if (input_representation != kNoRepresentation &&
1605 input_representation != input->representation()) {
1606 return true;
1607 }
1608 }
1609
1610 return false;
1611}
virtual Representation RequiredInputRepresentation(intptr_t idx) const
Definition il.h:1235
Representation
Definition locations.h:66

◆ InheritDeoptTarget()

void dart::Instruction::InheritDeoptTarget ( Zone zone,
Instruction other 
)

Definition at line 1560 of file il.cc.

1560 {
1561 ASSERT(other->env() != nullptr);
1562 CopyDeoptIdFrom(*other);
1563 other->env()->DeepCopyTo(zone, this);
1564}
virtual void CopyDeoptIdFrom(const Instruction &instr)
Definition il.h:1405

◆ InheritDeoptTargetAfter()

void dart::Instruction::InheritDeoptTargetAfter ( FlowGraph flow_graph,
Definition call,
Definition result 
)

Definition at line 1549 of file il.cc.

1551 {
1552 ASSERT(call->env() != nullptr);
1553 deopt_id_ = DeoptId::ToDeoptAfter(call->deopt_id_);
1554 call->env()->DeepCopyAfterTo(
1555 flow_graph->zone(), this, call->ArgumentCount(),
1556 flow_graph->constant_dead(),
1557 result != nullptr ? result : flow_graph->constant_dead());
1558}
static intptr_t ToDeoptAfter(intptr_t deopt_id)
Definition deopt_id.h:31
call(args)
Definition dom.py:159

◆ InitializeLocationSummary()

void dart::Instruction::InitializeLocationSummary ( Zone zone,
bool  optimizing 
)
inline

Definition at line 1196 of file il.h.

1196 {
1197 ASSERT(locs_ == nullptr);
1198 locs_ = MakeLocationSummary(zone, optimizing);
1199 }
virtual LocationSummary * MakeLocationSummary(Zone *zone, bool is_optimizing) const =0

◆ inlining_id()

virtual intptr_t dart::Instruction::inlining_id ( ) const
inlinevirtual

Reimplemented in dart::BranchInstr.

Definition at line 1305 of file il.h.

1305{ return inlining_id_; }

◆ InputAt()

virtual Value * dart::Instruction::InputAt ( intptr_t  i) const
pure virtual

◆ InputCount()

virtual intptr_t dart::Instruction::InputCount ( ) const
pure virtual

◆ inputs()

InputsIterable dart::Instruction::inputs ( )
inline

Definition at line 1027 of file il.h.

1027{ return InputsIterable(this); }
InstructionIndexedPropertyIterable< InputsTrait > InputsIterable
Definition il.h:1025

◆ InsertAfter()

void dart::Instruction::InsertAfter ( Instruction prev)

Definition at line 1323 of file il.cc.

1323 {
1324 ASSERT(previous_ == nullptr);
1325 ASSERT(next_ == nullptr);
1326 previous_ = prev;
1327 next_ = prev->next_;
1328 next_->previous_ = this;
1329 previous_->next_ = this;
1330
1331 // Update def-use chains whenever instructions are added to the graph
1332 // after initial graph construction.
1333 for (intptr_t i = InputCount() - 1; i >= 0; --i) {
1334 Value* input = InputAt(i);
1335 input->definition()->AddInputUse(input);
1336 }
1337}
static float prev(float f)

◆ InsertBefore()

void dart::Instruction::InsertBefore ( Instruction next)
inline

Definition at line 1274 of file il.h.

1274{ InsertAfter(next->previous()); }
Instruction * next() const
Definition il.h:1087
void InsertAfter(Instruction *prev)
Definition il.cc:1323

◆ IsDominatedBy()

bool dart::Instruction::IsDominatedBy ( Instruction dom)

Definition at line 1572 of file il.cc.

1572 {
1573 BlockEntryInstr* block = GetBlock();
1574 BlockEntryInstr* dom_block = dom->GetBlock();
1575
1576 if (dom->IsPhi()) {
1577 dom = dom_block;
1578 }
1579
1580 if (block == dom_block) {
1581 if ((block == dom) || (this == block->last_instruction())) {
1582 return true;
1583 }
1584
1585 if (IsPhi()) {
1586 return false;
1587 }
1588
1589 for (Instruction* curr = dom->next(); curr != nullptr;
1590 curr = curr->next()) {
1591 if (curr == this) return true;
1592 }
1593
1594 return false;
1595 }
1596
1597 return dom_block->Dominates(block);
1598}
friend class BlockEntryInstr
Definition il.h:1397
Definition dom.py:1

◆ LinkTo()

void dart::Instruction::LinkTo ( Instruction next)
inline

Definition at line 1102 of file il.h.

1102 {
1103 ASSERT(this != next);
1104 this->set_next(next);
1105 next->set_previous(this);
1106 }
void set_previous(Instruction *instr)
Definition il.h:1082
void set_next(Instruction *instr)
Definition il.h:1088

◆ locs()

LocationSummary * dart::Instruction::locs ( )
inline

Definition at line 1186 of file il.h.

1186 {
1187 ASSERT(locs_ != nullptr);
1188 return locs_;
1189 }

◆ MakeCallSummary()

static LocationSummary * dart::Instruction::MakeCallSummary ( Zone zone,
const Instruction instr,
LocationSummary locs = nullptr 
)
static

◆ MakeLocationSummary()

virtual LocationSummary * dart::Instruction::MakeLocationSummary ( Zone zone,
bool  is_optimizing 
) const
pure virtual

◆ MayHaveVisibleEffect()

virtual bool dart::Instruction::MayHaveVisibleEffect ( ) const
inlinevirtual

Reimplemented in dart::TemplateAllocation< N >, dart::TemplateAllocation< 0 >, dart::TemplateAllocation< 3 >, and dart::AllocateObjectInstr.

Definition at line 1346 of file il.h.

1346 {
1347 return HasUnknownSideEffects() || MayThrow();
1348 }
virtual bool HasUnknownSideEffects() const =0

◆ MayThrow()

virtual bool dart::Instruction::MayThrow ( ) const
pure virtual

◆ NeedsEnvironment()

bool dart::Instruction::NeedsEnvironment ( ) const
inline

Definition at line 1332 of file il.h.

◆ next()

Instruction * dart::Instruction::next ( ) const
inline

Definition at line 1087 of file il.h.

1087{ return next_; }

◆ NumberOfInputsConsumedBeforeCall()

virtual intptr_t dart::Instruction::NumberOfInputsConsumedBeforeCall ( ) const
inlinevirtual

◆ previous()

Instruction * dart::Instruction::previous ( ) const
inline

Definition at line 1081 of file il.h.

1081{ return previous_; }

◆ RawSetInputAt()

virtual void dart::Instruction::RawSetInputAt ( intptr_t  i,
Value value 
)
privatepure virtual

◆ ReadExtraWithoutInputs()

void dart::Instruction::ReadExtraWithoutInputs ( FlowGraphDeserializer d)
protected

Definition at line 1117 of file il_serializer.cc.

1117 {
1118 Environment* env = d->Read<Environment*>();
1120 locs_ = d->Read<LocationSummary*>();
1121}
void SetEnvironment(Environment *deopt_env)
Definition il.cc:1270
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
Definition __init__.py:1

◆ RegisterKindForResult()

Location::Kind dart::Instruction::RegisterKindForResult ( ) const
inline

Definition at line 1378 of file il.h.

1378 {
1379 const Representation rep = representation();
1380 if ((rep == kUnboxedFloat) || (rep == kUnboxedDouble) ||
1381 (rep == kUnboxedFloat32x4) || (rep == kUnboxedInt32x4) ||
1382 (rep == kUnboxedFloat64x2)) {
1384 }
1385 return Location::kRegister;
1386 }
virtual Representation representation() const
Definition il.h:1254

◆ RemoveEnvironment()

void dart::Instruction::RemoveEnvironment ( )

Definition at line 1280 of file il.cc.

1280 {
1281 for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) {
1282 it.CurrentValue()->RemoveFromUseList();
1283 }
1284 env_ = nullptr;
1285}

◆ RemoveFromGraph()

Instruction * dart::Instruction::RemoveFromGraph ( bool  return_previous = true)

Definition at line 1299 of file il.cc.

1299 {
1300 ASSERT(!IsBlockEntry());
1301 ASSERT(!IsBranch());
1302 ASSERT(!IsThrow());
1303 ASSERT(!IsReturnBase());
1304 ASSERT(!IsReThrow());
1305 ASSERT(!IsGoto());
1306 ASSERT(previous() != nullptr);
1307 // We cannot assert that the instruction, if it is a definition, has no
1308 // uses. This function is used to remove instructions from the graph and
1309 // reinsert them elsewhere (e.g., hoisting).
1310 Instruction* prev_instr = previous();
1311 Instruction* next_instr = next();
1312 ASSERT(next_instr != nullptr);
1313 ASSERT(!next_instr->IsBlockEntry());
1314 prev_instr->LinkTo(next_instr);
1316 // Reset the successor and previous instruction to indicate that the
1317 // instruction is removed from the graph.
1318 set_previous(nullptr);
1319 set_next(nullptr);
1320 return return_previous ? prev_instr : next_instr;
1321}
void UnuseAllInputs()
Definition il.cc:1525

◆ RepairArgumentUsesInEnvironment()

void dart::Instruction::RepairArgumentUsesInEnvironment ( ) const

Definition at line 1534 of file il.cc.

1534 {
1535 // Some calls (e.g. closure calls) have more inputs than actual arguments.
1536 // Those extra inputs will be consumed from the stack before the call.
1537 const intptr_t after_args_input_count = env()->LazyDeoptPruneCount();
1538 MoveArgumentsArray* move_arguments = GetMoveArguments();
1539 ASSERT(move_arguments != nullptr);
1540 const intptr_t arg_count = ArgumentCount();
1541 ASSERT((arg_count + after_args_input_count) <= env()->Length());
1542 const intptr_t env_base =
1543 env()->Length() - arg_count - after_args_input_count;
1544 for (intptr_t i = 0; i < arg_count; ++i) {
1545 env()->ValueAt(env_base + i)->BindToEnvironment(move_arguments->At(i));
1546 }
1547}
intptr_t Length() const
Definition il.h:11658
intptr_t LazyDeoptPruneCount() const
Definition il.h:11616
Value * ValueAt(intptr_t ix) const
Definition il.h:11654
virtual intptr_t ArgumentCount() const
Definition il.h:1035
void BindToEnvironment(Definition *definition)
Definition il.h:2706

◆ ReplaceInEnvironment()

void dart::Instruction::ReplaceInEnvironment ( Definition current,
Definition replacement 
)

Definition at line 1287 of file il.cc.

1288 {
1289 for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) {
1290 Value* use = it.CurrentValue();
1291 if (use->definition() == current) {
1292 use->RemoveFromUseList();
1293 use->set_definition(replacement);
1294 replacement->AddEnvUse(use);
1295 }
1296 }
1297}

◆ ReplaceInputsWithMoveArguments()

virtual void dart::Instruction::ReplaceInputsWithMoveArguments ( MoveArgumentsArray move_arguments)
inlinevirtual

Reimplemented in dart::TemplateDartCall< kExtraInputs >, dart::TemplateDartCall< 0 >, and dart::TemplateDartCall< 1 >.

Definition at line 1049 of file il.h.

1050 {
1051 UNREACHABLE();
1052 }

◆ representation()

virtual Representation dart::Instruction::representation ( ) const
inlinevirtual

◆ RequiredInputRepresentation()

virtual Representation dart::Instruction::RequiredInputRepresentation ( intptr_t  idx) const
inlinevirtual

◆ set_inlining_id()

virtual void dart::Instruction::set_inlining_id ( intptr_t  value)
inlinevirtual

Reimplemented in dart::BranchInstr.

Definition at line 1306 of file il.h.

1306 {
1307 ASSERT(value >= 0);
1308 ASSERT(!has_inlining_id() || inlining_id_ == value);
1309 inlining_id_ = value;
1310 }
virtual bool has_inlining_id() const
Definition il.h:1311

◆ set_next()

void dart::Instruction::set_next ( Instruction instr)
inline

Definition at line 1088 of file il.h.

1088 {
1089 ASSERT(!IsGraphEntry());
1090 ASSERT(!IsReturnBase());
1091 ASSERT(!IsBranch() || (instr == nullptr));
1092 ASSERT(!IsPhi());
1093 ASSERT(instr == nullptr || !instr->IsBlockEntry());
1094 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions
1095 // that do not have a successor. Currently, the graph builder will continue
1096 // to append instruction in case of a Throw inside an expression. This
1097 // condition should be handled in the graph builder
1098 next_ = instr;
1099 }

◆ set_previous()

void dart::Instruction::set_previous ( Instruction instr)
inline

Definition at line 1082 of file il.h.

1082 {
1083 ASSERT(!IsBlockEntry());
1084 previous_ = instr;
1085 }

◆ SetEnvironment()

void dart::Instruction::SetEnvironment ( Environment deopt_env)

Definition at line 1270 of file il.cc.

1270 {
1271 intptr_t use_index = 0;
1272 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) {
1273 Value* use = it.CurrentValue();
1274 use->set_instruction(this);
1275 use->set_use_index(use_index++);
1276 }
1277 env_ = deopt_env;
1278}

◆ SetInputAt()

void dart::Instruction::SetInputAt ( intptr_t  i,
Value value 
)
inline

Definition at line 1008 of file il.h.

1008 {
1009 ASSERT(value != nullptr);
1010 value->set_instruction(this);
1011 value->set_use_index(i);
1012 RawSetInputAt(i, value);
1013 }
virtual void RawSetInputAt(intptr_t i, Value *value)=0

◆ SetMoveArguments()

virtual void dart::Instruction::SetMoveArguments ( MoveArgumentsArray move_arguments)
inlinevirtual

◆ SetPassSpecificId()

void dart::Instruction::SetPassSpecificId ( CompilerPass::Id  pass,
intptr_t  id 
)
inline

Definition at line 1223 of file il.h.

1223 {
1224 pass_specific_id_ = PassSpecificId::Encode(pass, id);
1225 }

◆ SlowPathSharingSupported()

static bool dart::Instruction::SlowPathSharingSupported ( bool  is_optimizing)
inlinestatic

Definition at line 1362 of file il.h.

1362 {
1363#if defined(TARGET_ARCH_IA32)
1364 return false;
1365#else
1366 return FLAG_enable_slow_path_sharing && FLAG_precompiled_mode &&
1367 is_optimizing;
1368#endif
1369 }

◆ source()

InstructionSource dart::Instruction::source ( ) const
inline

Definition at line 1002 of file il.h.

1002 {
1003 return InstructionSource(token_pos(), inlining_id());
1004 }
virtual TokenPosition token_pos() const
Definition il.h:999
virtual intptr_t inlining_id() const
Definition il.h:1305

◆ SpeculativeModeOfInput()

virtual SpeculativeMode dart::Instruction::SpeculativeModeOfInput ( intptr_t  index) const
inlinevirtual

◆ SpeculativeModeOfInputs()

SpeculativeMode dart::Instruction::SpeculativeModeOfInputs ( ) const
inline

Definition at line 1239 of file il.h.

1239 {
1240 for (intptr_t i = 0; i < InputCount(); i++) {
1242 return kGuardInputs;
1243 }
1244 }
1245 return kNotSpeculative;
1246 }
virtual SpeculativeMode SpeculativeModeOfInput(intptr_t index) const
Definition il.h:1249

◆ statistics_tag()

virtual intptr_t dart::Instruction::statistics_tag ( ) const
inlinevirtual

Definition at line 985 of file il.h.

985{ return tag(); }

◆ SuccessorAt()

BlockEntryInstr * dart::Instruction::SuccessorAt ( intptr_t  index) const
virtual

Reimplemented in dart::BranchInstr.

Definition at line 1972 of file il.cc.

1972 {
1973 // Called only if index is in range. Only control-transfer instructions
1974 // can have non-zero successor counts and they override this function.
1975 UNREACHABLE();
1976 return nullptr;
1977}

◆ SuccessorCount()

intptr_t dart::Instruction::SuccessorCount ( ) const
virtual

Reimplemented in dart::BranchInstr.

Definition at line 1968 of file il.cc.

1968 {
1969 return 0;
1970}

◆ successors()

SuccessorsIterable dart::Instruction::successors ( ) const
inline

Definition at line 1132 of file il.h.

1132 {
1133 return SuccessorsIterable(this);
1134 }
InstructionIndexedPropertyIterable< SuccessorsTrait > SuccessorsIterable
Definition il.h:1130

◆ tag()

virtual Tag dart::Instruction::tag ( ) const
pure virtual

◆ ToCString()

const char * dart::Instruction::ToCString ( ) const

Definition at line 1669 of file il_printer.cc.

1669 {
1670 return DebugName();
1671}
virtual const char * DebugName() const =0

◆ token_pos()

virtual TokenPosition dart::Instruction::token_pos ( ) const
inlinevirtual

◆ Unsupported()

void dart::Instruction::Unsupported ( FlowGraphCompiler compiler)

Definition at line 626 of file il.cc.

626 {
627 compiler->Bailout(ToCString());
628 UNREACHABLE();
629}
const char * ToCString() const

◆ UnuseAllInputs()

void dart::Instruction::UnuseAllInputs ( )

Definition at line 1525 of file il.cc.

1525 {
1526 for (intptr_t i = InputCount() - 1; i >= 0; --i) {
1528 }
1529 for (Environment::DeepIterator it(env()); !it.Done(); it.Advance()) {
1530 it.CurrentValue()->RemoveFromUseList();
1531 }
1532}
void RemoveFromUseList()
Definition il.cc:1448

◆ UseSharedSlowPathStub()

virtual bool dart::Instruction::UseSharedSlowPathStub ( bool  is_optimizing) const
inlinevirtual

Definition at line 1371 of file il.h.

1371{ return false; }

◆ WasEliminated()

bool dart::Instruction::WasEliminated ( ) const
inline

Definition at line 1256 of file il.h.

1256{ return next() == nullptr; }

◆ WriteExtraWithoutInputs()

void dart::Instruction::WriteExtraWithoutInputs ( FlowGraphSerializer s)
protected

Definition at line 1112 of file il_serializer.cc.

1112 {
1113 s->Write<Environment*>(env_);
1114 s->Write<LocationSummary*>(locs_);
1115}
struct MyStruct s

Friends And Related Symbol Documentation

◆ BlockEntryInstr

friend class BlockEntryInstr
friend

Definition at line 1397 of file il.h.

◆ BranchInstr

friend class BranchInstr
friend

Definition at line 1416 of file il.h.

◆ CallSiteInliner

friend class CallSiteInliner
friend

Definition at line 1393 of file il.h.

◆ CatchBlockEntryInstr

friend class CatchBlockEntryInstr
friend

Definition at line 1398 of file il.h.

◆ CheckConditionInstr

friend class CheckConditionInstr
friend

Definition at line 1418 of file il.h.

◆ ComparisonInstr

friend class ComparisonInstr
friend

Definition at line 1395 of file il.h.

◆ DebugStepCheckInstr

friend class DebugStepCheckInstr
friend

Definition at line 1399 of file il.h.

◆ IfThenElseInstr

friend class IfThenElseInstr
friend

Definition at line 1417 of file il.h.

◆ LICM

friend class LICM
friend

Definition at line 1394 of file il.h.

◆ Scheduler

friend class Scheduler
friend

Definition at line 1396 of file il.h.

◆ StrictCompareInstr

friend class StrictCompareInstr
friend

Definition at line 1400 of file il.h.

Member Data Documentation

◆ kInstructionAttrs

const intptr_t dart::Instruction::kInstructionAttrs
static
Initial value:
= {
#define INSTR_ATTRS(type, attrs)
}

Definition at line 962 of file il.h.


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