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

#include <il.h>

Inheritance diagram for dart::CalculateElementAddressInstr:
dart::TemplateDefinition< 3, NoThrow >

Public Types

enum  { kBasePos , kIndexPos , kOffsetPos }
 
- Public Types inherited from dart::TemplateDefinition< 3, NoThrow >
using BaseClass = typename NoCSE< Definition, PureDefinition >::Base
 

Public Member Functions

 CalculateElementAddressInstr (Value *base, Value *index, intptr_t index_scale, Value *offset)
 
virtual Representation representation () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
Valuebase () const
 
Valueindex () const
 
Valueoffset () const
 
intptr_t index_scale () const
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
virtual bool MayCreateUnsafeUntaggedPointer () const
 
virtual bool AllowsCSE () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool HasUnknownSideEffects () const
 
virtual bool AttributesEqual (const Instruction &other) const
 
- Public Member Functions inherited from dart::TemplateDefinition< 3, 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
 

Additional Inherited Members

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

Detailed Description

Definition at line 7943 of file il.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kBasePos 
kIndexPos 
kOffsetPos 

Definition at line 7945 of file il.h.

Constructor & Destructor Documentation

◆ CalculateElementAddressInstr()

dart::CalculateElementAddressInstr::CalculateElementAddressInstr ( Value base,
Value index,
intptr_t  index_scale,
Value offset 
)
inline

Definition at line 7946 of file il.h.

7950 : index_scale_(index_scale) {
7951 ASSERT(base->definition()->representation() == kUntagged);
7953 ASSERT(1 <= index_scale && index_scale <= 16);
7954 SetInputAt(kBasePos, base);
7955 SetInputAt(kIndexPos, index);
7956 SetInputAt(kOffsetPos, offset);
7957 }
intptr_t index_scale() const
Definition il.h:7972
static constexpr bool IsPowerOfTwo(T x)
Definition utils.h:61
#define ASSERT(E)

Member Function Documentation

◆ AllowsCSE()

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

Definition at line 7980 of file il.h.

7980{ return !MayCreateUnsafeUntaggedPointer(); }
virtual bool MayCreateUnsafeUntaggedPointer() const
Definition il.h:7976

◆ AttributesEqual()

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

Definition at line 7985 of file il.h.

7985 {
7986 return other.AsCalculateElementAddress()->index_scale_ == index_scale_;
7987 }

◆ base()

Value * dart::CalculateElementAddressInstr::base ( ) const
inline

Definition at line 7969 of file il.h.

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

◆ Canonicalize()

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

Definition at line 3777 of file il.cc.

3777 {
3778 if (index()->BindsToSmiConstant() && offset()->BindsToSmiConstant()) {
3779 const intptr_t offset_in_bytes = Utils::AddWithWrapAround(
3780 Utils::MulWithWrapAround<intptr_t>(index()->BoundSmiConstant(),
3781 index_scale()),
3782 offset()->BoundSmiConstant());
3783
3784 if (offset_in_bytes == 0) return base()->definition();
3785
3786 if (compiler::target::IsSmi(offset_in_bytes)) {
3787 auto* const Z = flow_graph->zone();
3788 auto* const new_adjust = new (Z) CalculateElementAddressInstr(
3789 base()->CopyWithType(Z),
3790 new (Z) Value(
3791 flow_graph->GetConstant(Object::smi_zero(), kUnboxedIntPtr)),
3792 /*index_scale=*/1,
3793 new (Z) Value(flow_graph->GetConstant(
3794 Smi::Handle(Smi::New(offset_in_bytes)), kUnboxedIntPtr)));
3795 flow_graph->InsertBefore(this, new_adjust, env(), FlowGraph::kValue);
3796 return new_adjust;
3797 }
3798 }
3799 return this;
3800}
#define Z
CalculateElementAddressInstr(Value *base, Value *index, intptr_t index_scale, Value *offset)
Definition il.h:7946
static Object & Handle()
Definition object.h:407
static SmiPtr New(intptr_t value)
Definition object.h:9985
static T AddWithWrapAround(T a, T b)
Definition utils.h:416
Value * CopyWithType(Zone *zone)
Definition il.h:138
Definition * definition() const
Definition il.h:103
bool IsSmi(int64_t v)
static constexpr Representation kUnboxedIntPtr
Definition locations.h:176
Definition __init__.py:1

◆ ComputeCanDeoptimize()

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

Definition at line 7982 of file il.h.

7982{ return false; }

◆ HasUnknownSideEffects()

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

Definition at line 7984 of file il.h.

7984{ return false; }

◆ index()

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

Definition at line 7970 of file il.h.

7970{ return inputs_[kIndexPos]; }

◆ index_scale()

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

Definition at line 7972 of file il.h.

7972{ return index_scale_; }

◆ MayCreateUnsafeUntaggedPointer()

virtual bool dart::CalculateElementAddressInstr::MayCreateUnsafeUntaggedPointer ( ) const
inlinevirtual

Definition at line 7976 of file il.h.

7976 {
7978 }
virtual bool MayCreateUnsafeUntaggedPointer() const
Definition il.h:2573

◆ offset()

Value * dart::CalculateElementAddressInstr::offset ( ) const
inline

Definition at line 7971 of file il.h.

7971{ return inputs_[kOffsetPos]; }

◆ representation()

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

Definition at line 7961 of file il.h.

7961{ return kUntagged; }

◆ RequiredInputRepresentation()

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

Definition at line 7963 of file il.h.

7963 {
7964 if (idx == kBasePos) return kUntagged;
7965 ASSERT(idx == kIndexPos || idx == kOffsetPos);
7966 return kUnboxedIntPtr;
7967 }

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