Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 >

Public Types

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

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
 

Static Public Member Functions

static Representation ReturnRepresentation (intptr_t array_cid)
 

Additional Inherited Members

- Protected Attributes inherited from dart::TemplateDefinition< 2, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 6725 of file il.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kArrayPos 
kIndexPos 

Definition at line 6737 of file il.h.

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 6831 of file il.cc.

6840 : TemplateDefinition(source, deopt_id),
6841 index_unboxed_(index_unboxed),
6842 index_scale_(index_scale),
6843 class_id_(class_id),
6844 alignment_(StrengthenAlignment(class_id, alignment)),
6845 token_pos_(source.token_pos),
6846 result_type_(result_type) {
6847 // In particular, notice that kPointerCid is _not_ supported because it gives
6848 // no information about whether the elements are signed for elements with
6849 // unboxed integer representations. The constructor must take that
6850 // information separately to allow kPointerCid.
6851 ASSERT(class_id != kPointerCid);
6852 SetInputAt(kArrayPos, array);
6853 SetInputAt(kIndexPos, index);
6854}
intptr_t class_id() const
Definition il.h:6759
Value * array() const
Definition il.h:6756
intptr_t index_scale() const
Definition il.h:6758
Value * index() const
Definition il.h:6757
TemplateDefinition(intptr_t deopt_id=DeoptId::kNone)
Definition il.h:2731
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28
static AlignmentType StrengthenAlignment(intptr_t cid, AlignmentType alignment)
Definition il.cc:6813

Member Function Documentation

◆ aligned()

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

Definition at line 6760 of file il.h.

6760{ return alignment_ == kAlignedAccess; }
@ kAlignedAccess
Definition il.h:6722

◆ array()

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

Definition at line 6756 of file il.h.

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

◆ Canonicalize()

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

Definition at line 6856 of file il.cc.

6856 {
6857 flow_graph->ExtractExternalUntaggedPayload(this, array(), class_id());
6858
6859 if (auto box = index()->definition()->AsBoxInt64()) {
6860 // TODO(dartbug.com/39432): Make LoadIndexed fully suport unboxed indices.
6861 if (!box->ComputeCanDeoptimize() && compiler::target::kWordSize == 8) {
6862 auto Z = flow_graph->zone();
6863 auto load = new (Z) LoadIndexedInstr(
6864 array()->CopyWithType(Z), box->value()->CopyWithType(Z),
6865 /*index_unboxed=*/true, index_scale(), class_id(), alignment_,
6866 GetDeoptId(), source(), result_type_);
6867 flow_graph->InsertBefore(this, load, env(), FlowGraph::kValue);
6868 return load;
6869 }
6870 }
6871 return this;
6872}
SI T load(const P *ptr)
#define Z
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:6831
Value * CopyWithType(Zone *zone)
Definition il.h:138
Definition __init__.py:1

◆ class_id()

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

Definition at line 6759 of file il.h.

6759{ return class_id_; }

◆ ComputeCanDeoptimize()

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

Definition at line 6768 of file il.h.

6768{ return false; }

◆ ComputeType()

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

Definition at line 1899 of file type_propagator.cc.

1899 {
1900 // Use the precise array element representation instead of the returned
1901 // representation, since for small elements, that results in a Smi type
1902 // instead of a Int type on 32-bit architectures.
1903 auto const rep =
1907 }
1908 switch (class_id()) {
1909 case kArrayCid:
1910 case kImmutableArrayCid: {
1911 CompileType elem_type = ComputeArrayElementType(array());
1912 if (result_type_ != nullptr &&
1913 !CompileType::Dynamic().IsEqualTo(result_type_)) {
1914 // The original call knew something.
1915 return *CompileType::ComputeRefinedType(&elem_type, result_type_);
1916 }
1917 return elem_type;
1918 }
1919
1920 case kTypeArgumentsCid:
1921 return CompileType::FromAbstractType(Object::dynamic_type(),
1924
1925 case kRecordCid:
1926 return CompileType::Dynamic();
1927
1928 default:
1929 UNIMPLEMENTED();
1930 return CompileType::Dynamic();
1931 }
1932}
static CompileType * ComputeRefinedType(CompileType *old_type, CompileType *new_type)
static constexpr bool kCannotBeSentinel
static constexpr bool kCannotBeNull
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

Definition at line 6762 of file il.h.

6762 {
6763 // Direct access since this instruction cannot deoptimize, and the deopt-id
6764 // was inherited from another instruction that could deoptimize.
6765 return GetDeoptId();
6766 }

◆ HasUnknownSideEffects()

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

Definition at line 6781 of file il.h.

6781{ return false; }

◆ index()

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

Definition at line 6757 of file il.h.

6757{ return inputs_[kIndexPos]; }

◆ index_scale()

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

Definition at line 6758 of file il.h.

6758{ 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 6752 of file il.h.

6752 {
6753 return array()->definition()->representation() == kUntagged;
6754 }
virtual Representation representation() const
Definition il.h:1254
Definition * definition() const
Definition il.h:103

◆ RecomputeType()

bool dart::LoadIndexedInstr::RecomputeType ( )
virtual

Definition at line 1934 of file type_propagator.cc.

1934 {
1935 if ((class_id_ == kArrayCid) || (class_id_ == kImmutableArrayCid)) {
1936 // Array element type computation depends on computed
1937 // types of other instructions and may change over time.
1938 return UpdateType(ComputeType());
1939 }
1940 return false;
1941}
virtual CompileType ComputeType() const

◆ representation()

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

Definition at line 6775 of file il.h.

6775 {
6777 }
static Representation ReturnRepresentation(intptr_t array_cid)
Definition il.cc:6874

◆ RequiredInputRepresentation()

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

Definition at line 6745 of file il.h.

6745 {
6746 // The array may be tagged or untagged (for external arrays).
6747 if (idx == kArrayPos) return kNoRepresentation;
6748 ASSERT_EQUAL(idx, kIndexPos);
6749 return index_unboxed_ ? kUnboxedIntPtr : kTagged;
6750 }
#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 6874 of file il.cc.

6874 {
6877}
static constexpr Representation NativeRepresentation(Representation rep)
Definition il.h:8456

◆ token_pos()

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

Definition at line 6739 of file il.h.

6739{ return token_pos_; }

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