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

#include <il.h>

Inheritance diagram for dart::RedefinitionInstr:
dart::TemplateDefinition< 1, NoThrow >

Public Member Functions

 RedefinitionInstr (Value *value, bool inserted_by_constant_propagation=false)
 
Valuevalue () const
 
virtual CompileType ComputeType () const
 
virtual bool RecomputeType ()
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
void set_constrained_type (CompileType *type)
 
CompileTypeconstrained_type () const
 
bool inserted_by_constant_propagation () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool HasUnknownSideEffects () const
 
virtual ValueRedefinedValue () const
 
- Public Member Functions inherited from dart::TemplateDefinition< 1, 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

- Public Types inherited from dart::TemplateDefinition< 1, NoThrow >
using BaseClass = typename NoCSE< Definition, PureDefinition >::Base
 
- Protected Attributes inherited from dart::TemplateDefinition< 1, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 4080 of file il.h.

Constructor & Destructor Documentation

◆ RedefinitionInstr()

dart::RedefinitionInstr::RedefinitionInstr ( Value value,
bool  inserted_by_constant_propagation = false 
)
inlineexplicit

Definition at line 4082 of file il.h.

4084 : constrained_type_(nullptr),
4085 inserted_by_constant_propagation_(inserted_by_constant_propagation) {
4086 SetInputAt(0, value);
4087 }
bool inserted_by_constant_propagation() const
Definition il.h:4101
Value * value() const
Definition il.h:4091

Member Function Documentation

◆ Canonicalize()

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

Definition at line 2628 of file il.cc.

2628 {
2629 // Must not remove Redefinitions without uses until LICM, even though
2630 // Redefinition might not have any uses itself it can still be dominating
2631 // uses of the value it redefines and must serve as a barrier for those
2632 // uses. RenameUsesDominatedByRedefinitions would normalize the graph and
2633 // route those uses through this redefinition.
2634 if (!HasUses() && !flow_graph->is_licm_allowed()) {
2635 return nullptr;
2636 }
2637 if (constrained_type() != nullptr &&
2638 constrained_type()->IsEqualTo(value()->Type())) {
2639 return value()->definition();
2640 }
2641 return this;
2642}
CompileType * constrained_type() const
Definition il.h:4099
Definition * definition() const
Definition il.h:103

◆ ComputeCanDeoptimize()

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

Definition at line 4105 of file il.h.

4105{ return false; }

◆ ComputeType()

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

Definition at line 1118 of file type_propagator.cc.

1118 {
1119 if (constrained_type_ != nullptr) {
1120 // Check if the type associated with this redefinition is more specific
1121 // than the type of its input. If yes, return it. Otherwise, fall back
1122 // to the input's type.
1123
1124 // If either type is non-nullable, the resulting type is non-nullable.
1125 const bool is_nullable =
1126 value()->Type()->is_nullable() && constrained_type_->is_nullable();
1127 // The resulting type can be the sentinel value only if both types can be.
1128 const bool can_be_sentinel = value()->Type()->can_be_sentinel() &&
1129 constrained_type_->can_be_sentinel();
1130
1131 // If either type has a concrete cid, stick with it.
1132 if (value()->Type()->ToNullableCid() != kDynamicCid) {
1133 return CompileType(is_nullable, can_be_sentinel,
1134 value()->Type()->ToNullableCid(), nullptr);
1135 }
1136 if (constrained_type_->ToNullableCid() != kDynamicCid) {
1137 return CompileType(is_nullable, can_be_sentinel,
1138 constrained_type_->ToNullableCid(), nullptr);
1139 }
1140
1141 CompileType result(
1142 value()->Type()->IsSubtypeOf(*constrained_type_->ToAbstractType())
1143 ? *value()->Type()
1144 : *constrained_type_);
1145 if (!is_nullable) {
1146 result = result.CopyNonNullable();
1147 }
1148 if (!can_be_sentinel) {
1149 result = result.CopyNonSentinel();
1150 }
1151 return result;
1152 }
1153 return *value()->Type();
1154}
bool can_be_sentinel() const
bool is_nullable() const
CompileType * Type()
GAsyncResult * result
@ kDynamicCid
Definition class_id.h:253

◆ constrained_type()

CompileType * dart::RedefinitionInstr::constrained_type ( ) const
inline

Definition at line 4099 of file il.h.

4099{ return constrained_type_; }

◆ HasUnknownSideEffects()

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

Definition at line 4106 of file il.h.

4106{ return false; }

◆ inserted_by_constant_propagation()

bool dart::RedefinitionInstr::inserted_by_constant_propagation ( ) const
inline

Definition at line 4101 of file il.h.

4101 {
4102 return inserted_by_constant_propagation_;
4103 }

◆ RecomputeType()

bool dart::RedefinitionInstr::RecomputeType ( )
virtual

Definition at line 1156 of file type_propagator.cc.

1156 {
1157 return UpdateType(ComputeType());
1158}
virtual CompileType ComputeType() const

◆ RedefinedValue()

Value * dart::RedefinitionInstr::RedefinedValue ( ) const
virtual

Definition at line 543 of file il.cc.

543 {
544 return value();
545}

◆ set_constrained_type()

void dart::RedefinitionInstr::set_constrained_type ( CompileType type)
inline

Definition at line 4098 of file il.h.

4098{ constrained_type_ = type; }

◆ value()

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

Definition at line 4091 of file il.h.

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

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