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

#include <il.h>

Inheritance diagram for dart::StoreIndexedInstr:
dart::TemplateInstruction< 3, NoThrow > dart::Instruction dart::ZoneAllocated

Public Types

enum  { kArrayPos = 0 , kIndexPos = 1 , kValuePos = 2 }
 
- Public Types inherited from dart::TemplateInstruction< 3, NoThrow >
using BaseClass = typename NoCSE< Instruction, PureInstruction >::Base
 
- Public Types inherited from dart::Instruction
enum  Tag { FOR_EACH_INSTRUCTION =(DECLARE_TAG) kNumInstructions }
 
enum  SpeculativeMode { kGuardInputs , kNotSpeculative }
 
using InputsIterable = InstructionIndexedPropertyIterable< InputsTrait >
 
using SuccessorsIterable = InstructionIndexedPropertyIterable< SuccessorsTrait >
 

Public Member Functions

 StoreIndexedInstr (Value *array, Value *index, Value *value, StoreBarrierType emit_store_barrier, bool index_unboxed, intptr_t index_scale, intptr_t class_id, AlignmentType alignment, intptr_t deopt_id, const InstructionSource &source, SpeculativeMode speculative_mode=kGuardInputs)
 
Valuearray () const
 
Valueindex () const
 
Valuevalue () const
 
intptr_t index_scale () const
 
intptr_t class_id () const
 
bool aligned () const
 
bool ShouldEmitStoreBarrier () const
 
void set_emit_store_barrier (StoreBarrierType value)
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual bool ComputeCanDeoptimize () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
bool IsUntagged () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual bool HasUnknownSideEffects () const
 
virtual bool MayHaveVisibleEffect () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
- Public Member Functions inherited from dart::TemplateInstruction< 3, NoThrow >
 TemplateInstruction (intptr_t deopt_id=DeoptId::kNone)
 
 TemplateInstruction (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
virtual intptr_t InputCount () const
 
virtual ValueInputAt (intptr_t i) const
 
virtual bool MayThrow () const
 
- Public Member Functions inherited from dart::Instruction
 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 Representation ValueRepresentation (intptr_t array_cid)
 
- Static Public Member Functions inherited from dart::Instruction
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)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 
- Protected Member Functions inherited from dart::Instruction
intptr_t GetDeoptId () const
 
virtual void CopyDeoptIdFrom (const Instruction &instr)
 
void WriteExtraWithoutInputs (FlowGraphSerializer *s)
 
void ReadExtraWithoutInputs (FlowGraphDeserializer *d)
 
- Protected Attributes inherited from dart::TemplateInstruction< 3, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 7064 of file il.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kArrayPos 
kIndexPos 
kValuePos 

Definition at line 7079 of file il.h.

Constructor & Destructor Documentation

◆ StoreIndexedInstr()

dart::StoreIndexedInstr::StoreIndexedInstr ( Value array,
Value index,
Value value,
StoreBarrierType  emit_store_barrier,
bool  index_unboxed,
intptr_t  index_scale,
intptr_t  class_id,
AlignmentType  alignment,
intptr_t  deopt_id,
const InstructionSource source,
SpeculativeMode  speculative_mode = kGuardInputs 
)

Definition at line 6872 of file il.cc.

6884 emit_store_barrier_(emit_store_barrier),
6885 index_unboxed_(index_unboxed),
6886 index_scale_(index_scale),
6887 class_id_(class_id),
6888 alignment_(StrengthenAlignment(class_id, alignment)),
6889 token_pos_(source.token_pos),
6890 speculative_mode_(speculative_mode) {
6891 // In particular, notice that kPointerCid is _not_ supported because it gives
6892 // no information about whether the elements are signed for elements with
6893 // unboxed integer representations. The constructor must take that information
6894 // separately to allow kPointerCid.
6895 ASSERT(class_id != kPointerCid);
6899}
void SetInputAt(intptr_t i, Value *value)
Definition: il.h:1014
InstructionSource source() const
Definition: il.h:1008
intptr_t deopt_id() const
Definition: il.h:993
Value * value() const
Definition: il.h:7083
Value * array() const
Definition: il.h:7081
intptr_t class_id() const
Definition: il.h:7086
intptr_t index_scale() const
Definition: il.h:7085
Value * index() const
Definition: il.h:7082
TemplateInstruction(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:1507
#define ASSERT(E)
static AlignmentType StrengthenAlignment(intptr_t cid, AlignmentType alignment)
Definition: il.cc:6806
const TokenPosition token_pos

Member Function Documentation

◆ aligned()

bool dart::StoreIndexedInstr::aligned ( ) const
inline

Definition at line 7087 of file il.h.

7087{ return alignment_ == kAlignedAccess; }
@ kAlignedAccess
Definition: il.h:6766

◆ array()

Value * dart::StoreIndexedInstr::array ( ) const
inline

Definition at line 7081 of file il.h.

7081{ return inputs_[kArrayPos]; }
EmbeddedArray< Value *, N > inputs_
Definition: il.h:1522

◆ Canonicalize()

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

Reimplemented from dart::Instruction.

Definition at line 6901 of file il.cc.

6901 {
6902 flow_graph->ExtractExternalUntaggedPayload(this, array(), class_id());
6903
6904 if (auto box = index()->definition()->AsBoxInt64()) {
6905 // TODO(dartbug.com/39432): Make StoreIndexed fully suport unboxed indices.
6906 if (!box->ComputeCanDeoptimize() && compiler::target::kWordSize == 8) {
6907 auto Z = flow_graph->zone();
6908 auto store = new (Z) StoreIndexedInstr(
6909 array()->CopyWithType(Z), box->value()->CopyWithType(Z),
6910 value()->CopyWithType(Z), emit_store_barrier_,
6911 /*index_unboxed=*/true, index_scale(), class_id(), alignment_,
6912 GetDeoptId(), source(), speculative_mode_);
6913 flow_graph->InsertBefore(this, store, env(), FlowGraph::kEffect);
6914 return nullptr;
6915 }
6916 }
6917 return this;
6918}
SI void store(P *ptr, const T &val)
intptr_t GetDeoptId() const
Definition: il.h:1409
Environment * env() const
Definition: il.h:1215
StoreIndexedInstr(Value *array, Value *index, Value *value, StoreBarrierType emit_store_barrier, bool index_unboxed, intptr_t index_scale, intptr_t class_id, AlignmentType alignment, intptr_t deopt_id, const InstructionSource &source, SpeculativeMode speculative_mode=kGuardInputs)
Definition: il.cc:6872
Value * CopyWithType(Zone *zone)
Definition: il.h:138
#define Z
Definition: il.cc:7430
static constexpr intptr_t kWordSize
Definition: runtime_api.h:274

◆ class_id()

intptr_t dart::StoreIndexedInstr::class_id ( ) const
inline

Definition at line 7086 of file il.h.

7086{ return class_id_; }

◆ ComputeCanDeoptimize()

virtual bool dart::StoreIndexedInstr::ComputeCanDeoptimize ( ) const
inlinevirtual

Implements dart::Instruction.

Definition at line 7105 of file il.h.

7105{ return false; }

◆ DeoptimizationTarget()

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

Reimplemented from dart::Instruction.

Definition at line 7118 of file il.h.

7118 {
7119 // Direct access since this instruction cannot deoptimize, and the deopt-id
7120 // was inherited from another instruction that could deoptimize.
7121 return GetDeoptId();
7122 }

◆ HasUnknownSideEffects()

virtual bool dart::StoreIndexedInstr::HasUnknownSideEffects ( ) const
inlinevirtual

Implements dart::Instruction.

Definition at line 7124 of file il.h.

7124{ return false; }

◆ index()

Value * dart::StoreIndexedInstr::index ( ) const
inline

Definition at line 7082 of file il.h.

7082{ return inputs_[kIndexPos]; }

◆ index_scale()

intptr_t dart::StoreIndexedInstr::index_scale ( ) const
inline

Definition at line 7085 of file il.h.

7085{ return index_scale_; }

◆ IsUntagged()

bool dart::StoreIndexedInstr::IsUntagged ( ) const
inline

Definition at line 7114 of file il.h.

7114 {
7115 return array()->definition()->representation() == kUntagged;
7116 }
virtual Representation representation() const
Definition: il.h:1260
Definition * definition() const
Definition: il.h:103

◆ MayHaveVisibleEffect()

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

Reimplemented from dart::Instruction.

Definition at line 7126 of file il.h.

7126{ return true; }

◆ RequiredInputRepresentation()

Representation dart::StoreIndexedInstr::RequiredInputRepresentation ( intptr_t  idx) const
virtual

Reimplemented from dart::Instruction.

Definition at line 6925 of file il.cc.

6926 {
6927 // Array can be a Dart object or a pointer to external data.
6928 if (idx == 0) return kNoRepresentation; // Flexible input representation.
6929 if (idx == 1) {
6930 if (index_unboxed_) {
6931#if defined(TARGET_ARCH_IS_64_BIT)
6932 return kUnboxedInt64;
6933#else
6934 // TODO(dartbug.com/39432): kUnboxedInt32 || kUnboxedUint32 on 32-bit
6935 // architectures.
6936 return kNoRepresentation; // Index can be any unboxed representation.
6937#endif
6938 } else {
6939 return kTagged; // Index is a smi.
6940 }
6941 }
6942 ASSERT(idx == 2);
6943 return ValueRepresentation(class_id());
6944}
static Representation ValueRepresentation(intptr_t array_cid)
Definition: il.cc:6920

◆ set_emit_store_barrier()

void dart::StoreIndexedInstr::set_emit_store_barrier ( StoreBarrierType  value)
inline

Definition at line 7097 of file il.h.

7097 {
7098 emit_store_barrier_ = value;
7099 }

◆ ShouldEmitStoreBarrier()

bool dart::StoreIndexedInstr::ShouldEmitStoreBarrier ( ) const
inline

Definition at line 7089 of file il.h.

7089 {
7090 if (value()->definition()->Type()->IsBool()) {
7091 return false;
7092 }
7093 return value()->NeedsWriteBarrier() &&
7094 (emit_store_barrier_ == kEmitStoreBarrier);
7095 }
Type
Definition: SortBench.cpp:56
bool NeedsWriteBarrier()
Definition: il.cc:1390
@ kEmitStoreBarrier
Definition: il.h:6301

◆ SpeculativeModeOfInput()

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

Reimplemented from dart::Instruction.

Definition at line 7101 of file il.h.

7101 {
7102 return speculative_mode_;
7103 }

◆ value()

Value * dart::StoreIndexedInstr::value ( ) const
inline

Definition at line 7083 of file il.h.

7083{ return inputs_[kValuePos]; }

◆ ValueRepresentation()

Representation dart::StoreIndexedInstr::ValueRepresentation ( intptr_t  array_cid)
static

Definition at line 6920 of file il.cc.

6920 {
6923}
static constexpr Representation NativeRepresentation(Representation rep)
Definition: il.h:8504
static Representation RepresentationOfArrayElement(classid_t cid)
Definition: locations.cc:79

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