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

#include <il.h>

Inheritance diagram for dart::LoadIndexedInstr:
dart::TemplateDefinition< 2, NoThrow > dart::Instruction dart::ZoneAllocated

Public Types

enum  { kArrayPos = 0 , kIndexPos = 1 }
 
- Public Types inherited from dart::TemplateDefinition< 2, NoThrow >
using BaseClass = typename NoCSE< Definition, PureDefinition >::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

 LoadIndexedInstr (Value *array, Value *index, bool index_unboxed, intptr_t index_scale, intptr_t class_id, AlignmentType alignment, intptr_t deopt_id, const InstructionSource &source, CompileType *result_type=nullptr)
 
TokenPosition token_pos () const
 
virtual CompileType ComputeType () const
 
virtual bool RecomputeType ()
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
bool IsUntagged () const
 
Valuearray () const
 
Valueindex () const
 
intptr_t index_scale () const
 
intptr_t class_id () const
 
bool aligned () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual bool ComputeCanDeoptimize () const
 
Representation representation () const
 
virtual void InferRange (RangeAnalysis *analysis, Range *range)
 
virtual bool HasUnknownSideEffects () const
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
- Public Member Functions inherited from dart::TemplateDefinition< 2, NoThrow >
 TemplateDefinition (intptr_t deopt_id=DeoptId::kNone)
 
 TemplateDefinition (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 ReturnRepresentation (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::TemplateDefinition< 2, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 6769 of file il.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kArrayPos 
kIndexPos 

Definition at line 6781 of file il.h.

6781{ kArrayPos = 0, kIndexPos = 1 };

Constructor & Destructor Documentation

◆ LoadIndexedInstr()

dart::LoadIndexedInstr::LoadIndexedInstr ( Value array,
Value index,
bool  index_unboxed,
intptr_t  index_scale,
intptr_t  class_id,
AlignmentType  alignment,
intptr_t  deopt_id,
const InstructionSource source,
CompileType result_type = nullptr 
)

Definition at line 6824 of file il.cc.

6834 index_unboxed_(index_unboxed),
6835 index_scale_(index_scale),
6836 class_id_(class_id),
6837 alignment_(StrengthenAlignment(class_id, alignment)),
6838 token_pos_(source.token_pos),
6839 result_type_(result_type) {
6840 // In particular, notice that kPointerCid is _not_ supported because it gives
6841 // no information about whether the elements are signed for elements with
6842 // unboxed integer representations. The constructor must take that
6843 // information separately to allow kPointerCid.
6844 ASSERT(class_id != kPointerCid);
6847}
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
intptr_t class_id() const
Definition: il.h:6803
Value * array() const
Definition: il.h:6800
intptr_t index_scale() const
Definition: il.h:6802
Value * index() const
Definition: il.h:6801
TemplateDefinition(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:2749
#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::LoadIndexedInstr::aligned ( ) const
inline

Definition at line 6804 of file il.h.

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

◆ array()

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

Definition at line 6800 of file il.h.

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

◆ Canonicalize()

Definition * dart::LoadIndexedInstr::Canonicalize ( FlowGraph flow_graph)
virtual

Reimplemented from dart::Instruction.

Definition at line 6849 of file il.cc.

6849 {
6850 flow_graph->ExtractExternalUntaggedPayload(this, array(), class_id());
6851
6852 if (auto box = index()->definition()->AsBoxInt64()) {
6853 // TODO(dartbug.com/39432): Make LoadIndexed fully suport unboxed indices.
6854 if (!box->ComputeCanDeoptimize() && compiler::target::kWordSize == 8) {
6855 auto Z = flow_graph->zone();
6856 auto load = new (Z) LoadIndexedInstr(
6857 array()->CopyWithType(Z), box->value()->CopyWithType(Z),
6858 /*index_unboxed=*/true, index_scale(), class_id(), alignment_,
6859 GetDeoptId(), source(), result_type_);
6860 flow_graph->InsertBefore(this, load, env(), FlowGraph::kValue);
6861 return load;
6862 }
6863 }
6864 return this;
6865}
SI T load(const P *ptr)
Definition: Transform_inl.h:98
intptr_t GetDeoptId() const
Definition: il.h:1409
Environment * env() const
Definition: il.h:1215
LoadIndexedInstr(Value *array, Value *index, bool index_unboxed, intptr_t index_scale, intptr_t class_id, AlignmentType alignment, intptr_t deopt_id, const InstructionSource &source, CompileType *result_type=nullptr)
Definition: il.cc:6824
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::LoadIndexedInstr::class_id ( ) const
inline

Definition at line 6803 of file il.h.

6803{ return class_id_; }

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Definition at line 6812 of file il.h.

6812{ return false; }

◆ ComputeType()

CompileType dart::LoadIndexedInstr::ComputeType ( ) const
virtual

Definition at line 1891 of file type_propagator.cc.

1891 {
1892 // Use the precise array element representation instead of the returned
1893 // representation, since for small elements, that results in a Smi type
1894 // instead of a Int type on 32-bit architectures.
1895 auto const rep =
1899 }
1900 switch (class_id()) {
1901 case kArrayCid:
1902 case kImmutableArrayCid: {
1903 CompileType elem_type = ComputeArrayElementType(array());
1904 if (result_type_ != nullptr &&
1905 !CompileType::Dynamic().IsEqualTo(result_type_)) {
1906 // The original call knew something.
1907 return *CompileType::ComputeRefinedType(&elem_type, result_type_);
1908 }
1909 return elem_type;
1910 }
1911
1912 case kTypeArgumentsCid:
1913 return CompileType::FromAbstractType(Object::dynamic_type(),
1916
1917 case kRecordCid:
1918 return CompileType::Dynamic();
1919
1920 default:
1921 UNIMPLEMENTED();
1922 return CompileType::Dynamic();
1923 }
1924}
static CompileType * ComputeRefinedType(CompileType *old_type, CompileType *new_type)
static constexpr bool kCannotBeSentinel
Definition: compile_type.h:49
static constexpr bool kCannotBeNull
Definition: compile_type.h:46
static CompileType Dynamic()
static CompileType FromAbstractType(const AbstractType &type, bool can_be_null, bool can_be_sentinel)
static CompileType FromUnboxedRepresentation(Representation rep)
#define UNIMPLEMENTED
static CompileType ComputeArrayElementType(Value *array)
static constexpr bool IsUnboxed(Representation rep)
Definition: locations.h:101
static Representation RepresentationOfArrayElement(classid_t cid)
Definition: locations.cc:79

◆ DeoptimizationTarget()

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

Reimplemented from dart::Instruction.

Definition at line 6806 of file il.h.

6806 {
6807 // Direct access since this instruction cannot deoptimize, and the deopt-id
6808 // was inherited from another instruction that could deoptimize.
6809 return GetDeoptId();
6810 }

◆ HasUnknownSideEffects()

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

Implements dart::Instruction.

Definition at line 6825 of file il.h.

6825{ return false; }

◆ index()

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

Definition at line 6801 of file il.h.

6801{ return inputs_[kIndexPos]; }

◆ index_scale()

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

Definition at line 6802 of file il.h.

6802{ return index_scale_; }

◆ InferRange()

void dart::LoadIndexedInstr::InferRange ( RangeAnalysis analysis,
Range range 
)
virtual

Definition at line 2908 of file range_analysis.cc.

2908 {
2909 // Use the precise array element representation instead of the returned
2910 // representation to avoid overapproximating the range for small elements.
2911 auto const rep =
2914 *range = Range::Full(rep);
2915 } else {
2916 Definition::InferRange(analysis, range);
2917 }
2918}
virtual void InferRange(RangeAnalysis *analysis, Range *range)
static Range Full(RangeBoundary::RangeSize size)

◆ IsUntagged()

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

Definition at line 6796 of file il.h.

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

◆ RecomputeType()

bool dart::LoadIndexedInstr::RecomputeType ( )
virtual

Definition at line 1926 of file type_propagator.cc.

1926 {
1927 if ((class_id_ == kArrayCid) || (class_id_ == kImmutableArrayCid)) {
1928 // Array element type computation depends on computed
1929 // types of other instructions and may change over time.
1930 return UpdateType(ComputeType());
1931 }
1932 return false;
1933}
virtual CompileType ComputeType() const

◆ representation()

Representation dart::LoadIndexedInstr::representation ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 6819 of file il.h.

6819 {
6821 }
static Representation ReturnRepresentation(intptr_t array_cid)
Definition: il.cc:6867

◆ RequiredInputRepresentation()

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

Reimplemented from dart::Instruction.

Definition at line 6789 of file il.h.

6789 {
6790 // The array may be tagged or untagged (for external arrays).
6791 if (idx == kArrayPos) return kNoRepresentation;
6792 ASSERT_EQUAL(idx, kIndexPos);
6793 return index_unboxed_ ? kUnboxedIntPtr : kTagged;
6794 }
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309
static constexpr Representation kUnboxedIntPtr
Definition: locations.h:176

◆ ReturnRepresentation()

Representation dart::LoadIndexedInstr::ReturnRepresentation ( intptr_t  array_cid)
static

Definition at line 6867 of file il.cc.

6867 {
6870}
static constexpr Representation NativeRepresentation(Representation rep)
Definition: il.h:8504

◆ token_pos()

TokenPosition dart::LoadIndexedInstr::token_pos ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 6783 of file il.h.

6783{ return token_pos_; }

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