Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
dart::Definition Class Reference

#include <il.h>

Inheritance diagram for dart::Definition:
dart::Instruction dart::ZoneAllocated dart::AllocationInstr dart::ComparisonInstr dart::DropTempsInstr dart::IfThenElseInstr dart::PureDefinition dart::SimdOpInstr dart::VariadicDefinition dart::TemplateAllocation< 3 > dart::TemplateAllocation< 0 > dart::AllocateObjectInstr dart::ArrayAllocationInstr dart::TemplateAllocation< N > dart::PureComparison dart::TemplateComparison< 1, NoThrow, Pure > dart::TemplateComparison< 2, NoThrow, Pure > dart::TemplateDefinition< 4, Throws, Pure > dart::TemplateDefinition< 1, Throws, Pure > dart::TemplateDefinition< 2, NoThrow, Pure > dart::TemplateDefinition< 1, NoThrow, Pure > dart::TemplateDefinition< 4, NoThrow, Pure > dart::TemplateDefinition< 0, NoThrow, Pure > dart::TemplateInstruction< 5, Throws, Pure > dart::TemplateInstruction< 2, NoThrow, Pure > dart::TemplateInstruction< 1, NoThrow, Pure > dart::TemplateInstruction< 0, NoThrow, Pure > dart::TemplateInstruction< 1, Throws, Pure > dart::TemplateDartCall< 0 > dart::TemplateDartCall< 1 > dart::FfiCallInstr dart::InvokeMathCFunctionInstr dart::LeafRuntimeCallInstr dart::MaterializeObjectInstr dart::PhiInstr dart::TemplateDartCall< kExtraInputs >

Public Member Functions

 Definition (intptr_t deopt_id=DeoptId::kNone)
 
 Definition (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
virtual intptr_t CallCount () const
 
intptr_t temp_index () const
 
void set_temp_index (intptr_t index)
 
void ClearTempIndex ()
 
bool HasTemp () const
 
intptr_t ssa_temp_index () const
 
void set_ssa_temp_index (intptr_t index)
 
bool HasSSATemp () const
 
void ClearSSATempIndex ()
 
intptr_t vreg (intptr_t index) const
 
intptr_t location_count () const
 
bool HasPairRepresentation () const
 
CompileTypeType ()
 
bool HasType () const
 
bool IsInt64Definition ()
 
bool IsInt32Definition ()
 
virtual CompileType ComputeType () const
 
virtual bool RecomputeType ()
 
PRINT_OPERANDS_TO_SUPPORT PRINT_TO_SUPPORT bool UpdateType (CompileType new_type)
 
bool HasUses () const
 
bool HasOnlyUse (Value *use) const
 
bool HasOnlyInputUse (Value *use) const
 
Valueinput_use_list () const
 
void set_input_use_list (Value *head)
 
Valueenv_use_list () const
 
void set_env_use_list (Value *head)
 
ValueListIterable input_uses () const
 
void AddInputUse (Value *value)
 
void AddEnvUse (Value *value)
 
virtual bool MayCreateUnsafeUntaggedPointer () const
 
virtual bool CanReplaceWithConstant () const
 
virtual bool CanEliminate (const BlockEntryInstr *block) const
 
void ReplaceUsesWith (Definition *other)
 
void ReplaceWithResult (Instruction *replacement, Definition *replacement_for_uses, ForwardInstructionIterator *iterator)
 
void ReplaceWith (Definition *other, ForwardInstructionIterator *iterator)
 
Objectconstant_value ()
 
virtual void InferRange (RangeAnalysis *analysis, Range *range)
 
Rangerange () const
 
void set_range (const Range &)
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
DefinitionReplacement ()
 
void SetReplacement (Definition *other)
 
virtual AliasIdentity Identity () const
 
virtual void SetIdentity (AliasIdentity identity)
 
DefinitionOriginalDefinition ()
 
virtual ValueRedefinedValue () const
 
DefinitionOriginalDefinitionIgnoreBoxingAndConstraints ()
 
virtual DefinitionAsDefinition ()
 
virtual const DefinitionAsDefinition () 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 bool IsArrayLength (Definition *def)
 
- 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)
 

Static Public Attributes

static constexpr intptr_t kReplacementMarker = -2
 
- Static Public Attributes inherited from dart::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 

Protected Member Functions

void set_type (CompileType *type)
 
- 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

Rangerange_ = nullptr
 

Friends

class RangeAnalysis
 
class Value
 

Additional Inherited Members

- 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 >
 

Detailed Description

Definition at line 2486 of file il.h.

Constructor & Destructor Documentation

◆ Definition() [1/2]

dart::Definition::Definition ( intptr_t  deopt_id = DeoptId::kNone)
inlineexplicit

Definition at line 2488 of file il.h.

2489 : Instruction(deopt_id) {}
Instruction(const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:980
intptr_t deopt_id() const
Definition: il.h:993

◆ Definition() [2/2]

dart::Definition::Definition ( const InstructionSource source,
intptr_t  deopt_id = DeoptId::kNone 
)
inlineexplicit

Definition at line 2491 of file il.h.

InstructionSource source() const
Definition: il.h:1008

Member Function Documentation

◆ AddEnvUse()

void dart::Definition::AddEnvUse ( Value value)
inline

Definition at line 2586 of file il.h.

2586{ Value::AddToList(value, &env_use_list_); }
static void AddToList(Value *value, Value **list)
Definition: il.cc:1446
uint8_t value

◆ AddInputUse()

void dart::Definition::AddInputUse ( Value value)
inline

Definition at line 2585 of file il.h.

2585{ Value::AddToList(value, &input_use_list_); }

◆ AsDefinition() [1/2]

virtual Definition * dart::Definition::AsDefinition ( )
inlinevirtual

Definition at line 2683 of file il.h.

2683{ return this; }

◆ AsDefinition() [2/2]

virtual const Definition * dart::Definition::AsDefinition ( ) const
inlinevirtual

Definition at line 2684 of file il.h.

2684{ return this; }

◆ CallCount()

virtual intptr_t dart::Definition::CallCount ( ) const
inlinevirtual

Reimplemented in dart::ClosureCallInstr, dart::InstanceCallInstr, dart::PolymorphicInstanceCallInstr, and dart::StaticCallInstr.

Definition at line 2496 of file il.h.

2496{ return -1; }

◆ CanEliminate()

virtual bool dart::Definition::CanEliminate ( const BlockEntryInstr block) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 2603 of file il.h.

2603 {
2604 // Basic blocks should not end in a definition, so treat this as replacing
2605 // the definition with a constant (that is then unused).
2606 return CanReplaceWithConstant();
2607 }
virtual bool CanReplaceWithConstant() const
Definition: il.h:2599

◆ Canonicalize()

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

◆ CanReplaceWithConstant()

virtual bool dart::Definition::CanReplaceWithConstant ( ) const
inlinevirtual

Reimplemented in dart::MaterializeObjectInstr.

Definition at line 2599 of file il.h.

2599 {
2600 return !MayHaveVisibleEffect() && !CanDeoptimize();
2601 }
virtual bool MayHaveVisibleEffect() const
Definition: il.h:1352
bool CanDeoptimize() const
Definition: il.h:1079

◆ ClearSSATempIndex()

void dart::Definition::ClearSSATempIndex ( )
inline

Definition at line 2509 of file il.h.

2509{ ssa_temp_index_ = -1; }

◆ ClearTempIndex()

void dart::Definition::ClearTempIndex ( )
inline

Definition at line 2500 of file il.h.

2500{ temp_index_ = -1; }

◆ ComputeType()

virtual CompileType dart::Definition::ComputeType ( ) const
inlinevirtual

Reimplemented in dart::PhiInstr, dart::ConstantInstr, dart::AssertAssignableInstr, dart::AssertBooleanInstr, dart::InstanceCallBaseInstr, dart::PolymorphicInstanceCallInstr, dart::DispatchTableCallInstr, dart::StrictCompareInstr, dart::TestIntInstr, dart::TestCidsInstr, dart::TestRangeInstr, dart::EqualityCompareInstr, dart::RelationalOpInstr, dart::IfThenElseInstr, dart::StaticCallInstr, dart::DropTempsInstr, dart::LeafRuntimeCallInstr, dart::OneByteStringFromCharCodeInstr, dart::StringToCharCodeInstr, dart::AllocateObjectInstr, dart::AllocateClosureInstr, dart::AllocateUninitializedContextInstr, dart::AllocateRecordInstr, dart::AllocateSmallRecordInstr, dart::CreateArrayInstr, dart::AllocateTypedDataInstr, dart::LoadClassIdInstr, dart::AllocateContextInstr, dart::BoxInstr, dart::BoxIntegerInstr, dart::CaseInsensitiveCompareInstr, dart::MathMinMaxInstr, dart::DoubleTestOpInstr, dart::HashDoubleOpInstr, dart::HashIntegerOpInstr, dart::UnarySmiOpInstr, dart::BinarySmiOpInstr, dart::DoubleToIntegerInstr, dart::DoubleToSmiInstr, dart::ExtractNthOutputInstr, dart::UnboxLaneInstr, dart::BoxLanesInstr, dart::CheckNullInstr, dart::CheckArrayBoundInstr, dart::GenericCheckBoundInstr, and dart::SimdOpInstr.

Definition at line 2542 of file il.h.

2542 {
2543 // TODO(vegorov) use range information to improve type if available.
2545 }
static CompileType FromRepresentation(Representation rep)
virtual Representation representation() const
Definition: il.h:1260

◆ constant_value()

Object & dart::Definition::constant_value ( )

Definition at line 525 of file il.cc.

525 {
526 if (constant_value_ == nullptr) {
528 }
529 return *constant_value_;
530}
static ObjectPtr Unknown()
static Object & ZoneHandle()
Definition: object.h:419

◆ env_use_list()

Value * dart::Definition::env_use_list ( ) const
inline

Definition at line 2578 of file il.h.

2578{ return env_use_list_; }

◆ HasOnlyInputUse()

bool dart::Definition::HasOnlyInputUse ( Value use) const

Definition at line 1489 of file il.cc.

1489 {
1490 return (input_use_list() == use) && (use->next_use() == nullptr);
1491}
Value * input_use_list() const
Definition: il.h:2575

◆ HasOnlyUse()

bool dart::Definition::HasOnlyUse ( Value use) const

Definition at line 1477 of file il.cc.

1477 {
1478 if (!HasOnlyInputUse(use)) {
1479 return false;
1480 }
1481
1482 Instruction* target = use->instruction();
1483 for (Value::Iterator it(env_use_list()); !it.Done(); it.Advance()) {
1484 if (it.Current()->instruction() != target) return false;
1485 }
1486 return true;
1487}
Value * env_use_list() const
Definition: il.h:2578
bool HasOnlyInputUse(Value *use) const
Definition: il.cc:1489
uint32_t * target

◆ HasPairRepresentation()

bool dart::Definition::HasPairRepresentation ( ) const
inline

Definition at line 2517 of file il.h.

2517{ return location_count() == 2; }
intptr_t location_count() const
Definition: il.h:2516

◆ HasSSATemp()

bool dart::Definition::HasSSATemp ( ) const
inline

Definition at line 2508 of file il.h.

2508{ return ssa_temp_index_ >= 0; }

◆ HasTemp()

bool dart::Definition::HasTemp ( ) const
inline

Definition at line 2501 of file il.h.

2501{ return temp_index_ >= 0; }

◆ HasType()

bool dart::Definition::HasType ( ) const
inline

Definition at line 2530 of file il.h.

2530{ return (type_ != nullptr); }

◆ HasUses()

bool dart::Definition::HasUses ( ) const
inline

Definition at line 2569 of file il.h.

2569 {
2570 return (input_use_list_ != nullptr) || (env_use_list_ != nullptr);
2571 }

◆ Identity()

virtual AliasIdentity dart::Definition::Identity ( ) const
inlinevirtual

Reimplemented in dart::StaticCallInstr, dart::CachableIdempotentCallInstr, and dart::AllocationInstr.

Definition at line 2660 of file il.h.

2660{ return AliasIdentity::Unknown(); }
static AliasIdentity Unknown()
Definition: il.h:2417

◆ InferRange()

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

Reimplemented in dart::PhiInstr, dart::ConstantInstr, dart::AssertAssignableInstr, dart::IfThenElseInstr, dart::LoadClassIdInstr, dart::BoxIntegerInstr, dart::UnboxIntegerInstr, dart::BinaryIntegerOpInstr, dart::BinarySmiOpInstr, dart::ShiftIntegerOpInstr, and dart::IntConverterInstr.

Definition at line 2650 of file range_analysis.cc.

2650 {
2651 if (Type()->ToCid() == kSmiCid) {
2653 } else if (IsInt64Definition()) {
2655 } else if (IsInt32Definition()) {
2657 } else if (Type()->IsInt()) {
2659 } else {
2660 // Only Smi and Mint supported.
2661 FATAL("Unsupported type in: %s", ToCString());
2662 }
2663
2664 // If the representation also gives us range information, then refine
2665 // the range from the type by using the intersection of the two.
2668 }
2669}
bool IsInt64Definition()
Definition: il.h:8884
Range * range() const
Definition: il.h:2636
CompileType * Type()
Definition: il.h:2521
bool IsInt32Definition()
Definition: il.h:2534
const char * ToCString() const
Definition: il_printer.cc:1683
Range Intersect(const Range *other) const
static Range Full(RangeBoundary::RangeSize size)
#define FATAL(error)
static constexpr bool IsUnboxedInteger(Representation rep)
Definition: locations.h:92

◆ input_use_list()

Value * dart::Definition::input_use_list ( ) const
inline

Definition at line 2575 of file il.h.

2575{ return input_use_list_; }

◆ input_uses()

ValueListIterable dart::Definition::input_uses ( ) const
inline

Definition at line 2581 of file il.h.

2581 {
2582 return ValueListIterable(input_use_list_);
2583 }

◆ IsArrayLength()

bool dart::Definition::IsArrayLength ( Definition def)
static

Definition at line 585 of file il.cc.

585 {
586 if (def != nullptr) {
587 if (auto load = def->OriginalDefinitionIgnoreBoxingAndConstraints()
588 ->AsLoadField()) {
589 return load->IsImmutableLengthLoad();
590 }
591 }
592 return false;
593}
SI T load(const P *ptr)
Definition: Transform_inl.h:98

◆ IsInt32Definition()

bool dart::Definition::IsInt32Definition ( )
inline

Definition at line 2534 of file il.h.

2534 {
2535 return IsBinaryInt32Op() || IsBoxInt32() || IsUnboxInt32() ||
2536 IsIntConverter();
2537 }

◆ IsInt64Definition()

bool dart::Definition::IsInt64Definition ( )
inline

Definition at line 8884 of file il.h.

8884 {
8885 return (Type()->ToCid() == kMintCid) || IsBinaryInt64Op() ||
8886 IsUnaryInt64Op() || IsShiftInt64Op() || IsSpeculativeShiftInt64Op() ||
8887 IsBoxInt64() || IsUnboxInt64();
8888}

◆ location_count()

intptr_t dart::Definition::location_count ( ) const
inline

Definition at line 2516 of file il.h.

2516{ return LocationCount(representation()); }
intptr_t LocationCount(Representation rep)
Definition: locations.h:75

◆ MayCreateUnsafeUntaggedPointer()

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

Reimplemented in dart::PhiInstr, dart::CachableIdempotentCallInstr, dart::FfiCallInstr, dart::LeafRuntimeCallInstr, dart::IntConverterInstr, and dart::LoadThreadInstr.

Definition at line 2591 of file il.h.

2591 {
2592 // To ensure the default is safe, conservatively assume any untagged
2593 // result may be a GC-movable address.
2594 return representation() == kUntagged;
2595 }

◆ OriginalDefinition()

Definition * dart::Definition::OriginalDefinition ( )

Definition at line 532 of file il.cc.

532 {
533 Definition* defn = this;
534 Value* unwrapped;
535 while ((unwrapped = defn->RedefinedValue()) != nullptr) {
536 defn = unwrapped->definition();
537 }
538 return defn;
539}
Definition(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:2488

◆ OriginalDefinitionIgnoreBoxingAndConstraints()

Definition * dart::Definition::OriginalDefinitionIgnoreBoxingAndConstraints ( )

Definition at line 569 of file il.cc.

569 {
570 Definition* def = this;
571 while (true) {
572 Definition* orig;
573 if (def->IsConstraint() || def->IsBox() || def->IsUnbox() ||
574 def->IsIntConverter() || def->IsFloatToDouble() ||
575 def->IsDoubleToFloat()) {
576 orig = def->InputAt(0)->definition();
577 } else {
578 orig = def->OriginalDefinition();
579 }
580 if (orig == def) return def;
581 def = orig;
582 }
583}

◆ range()

Range * dart::Definition::range ( ) const
inline

Definition at line 2636 of file il.h.

2636{ return range_; }
Range * range_
Definition: il.h:2692

◆ RecomputeType()

virtual bool dart::Definition::RecomputeType ( )
inlinevirtual

◆ RedefinedValue()

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

Reimplemented in dart::AssertAssignableInstr, dart::AssertBooleanInstr, dart::CheckNullInstr, dart::CheckBoundBaseInstr, and dart::CheckWritableInstr.

Definition at line 541 of file il.cc.

541 {
542 return nullptr;
543}

◆ Replacement()

Definition * dart::Definition::Replacement ( )
inline

Definition at line 2646 of file il.h.

2646 {
2647 if (ssa_temp_index_ == kReplacementMarker) {
2648 return reinterpret_cast<Definition*>(temp_index_);
2649 }
2650 return this;
2651 }
static constexpr intptr_t kReplacementMarker
Definition: il.h:2644

◆ ReplaceUsesWith()

void dart::Definition::ReplaceUsesWith ( Definition other)

Definition at line 1493 of file il.cc.

1493 {
1494 ASSERT(other != nullptr);
1495 ASSERT(this != other);
1496
1497 Value* current = nullptr;
1499 if (next != nullptr) {
1500 // Change all the definitions.
1501 while (next != nullptr) {
1502 current = next;
1503 current->set_definition(other);
1504 current->RefineReachingType(other->Type());
1505 next = current->next_use();
1506 }
1507
1508 // Concatenate the lists.
1509 next = other->input_use_list();
1510 current->set_next_use(next);
1511 if (next != nullptr) next->set_previous_use(current);
1512 other->set_input_use_list(input_use_list());
1513 set_input_use_list(nullptr);
1514 }
1515
1516 // Repeat for environment uses.
1517 current = nullptr;
1518 next = env_use_list();
1519 if (next != nullptr) {
1520 while (next != nullptr) {
1521 current = next;
1522 current->set_definition(other);
1523 current->RefineReachingType(other->Type());
1524 next = current->next_use();
1525 }
1526 next = other->env_use_list();
1527 current->set_next_use(next);
1528 if (next != nullptr) next->set_previous_use(current);
1529 other->set_env_use_list(env_use_list());
1530 set_env_use_list(nullptr);
1531 }
1532}
void set_input_use_list(Value *head)
Definition: il.h:2576
void set_env_use_list(Value *head)
Definition: il.h:2579
Instruction * next() const
Definition: il.h:1093
#define ASSERT(E)

◆ ReplaceWith()

void dart::Definition::ReplaceWith ( Definition other,
ForwardInstructionIterator iterator 
)

Definition at line 1662 of file il.cc.

1663 {
1664 // Reuse this instruction's SSA name for other.
1665 ASSERT(!other->HasSSATemp());
1666 if (HasSSATemp()) {
1667 other->set_ssa_temp_index(ssa_temp_index());
1668 }
1669 ReplaceWithResult(other, other, iterator);
1670}
bool HasSSATemp() const
Definition: il.h:2508
void ReplaceWithResult(Instruction *replacement, Definition *replacement_for_uses, ForwardInstructionIterator *iterator)
Definition: il.cc:1632
intptr_t ssa_temp_index() const
Definition: il.h:2503

◆ ReplaceWithResult()

void dart::Definition::ReplaceWithResult ( Instruction replacement,
Definition replacement_for_uses,
ForwardInstructionIterator iterator 
)

Definition at line 1632 of file il.cc.

1634 {
1635 // Record replacement's input uses.
1636 for (intptr_t i = replacement->InputCount() - 1; i >= 0; --i) {
1637 Value* input = replacement->InputAt(i);
1638 input->definition()->AddInputUse(input);
1639 }
1640 // Take replacement's environment from this definition.
1641 ASSERT(replacement->env() == nullptr);
1642 replacement->SetEnvironment(env());
1643 ClearEnv();
1644 // Replace all uses of this definition with replacement_for_uses.
1645 ReplaceUsesWith(replacement_for_uses);
1646
1647 // Finally replace this one with the replacement instruction in the graph.
1648 previous()->LinkTo(replacement);
1649 if ((iterator != nullptr) && (this == iterator->Current())) {
1650 // Remove through the iterator.
1651 replacement->LinkTo(this);
1652 iterator->RemoveCurrentFromGraph();
1653 } else {
1654 replacement->LinkTo(next());
1655 // Remove this definition's input uses.
1657 }
1658 set_previous(nullptr);
1659 set_next(nullptr);
1660}
void ReplaceUsesWith(Definition *other)
Definition: il.cc:1493
void set_previous(Instruction *instr)
Definition: il.h:1088
void LinkTo(Instruction *next)
Definition: il.h:1108
Environment * env() const
Definition: il.h:1215
void UnuseAllInputs()
Definition: il.cc:1534
void set_next(Instruction *instr)
Definition: il.h:1094
void ClearEnv()
Definition: il.h:1364
Instruction * previous() const
Definition: il.h:1087

◆ set_env_use_list()

void dart::Definition::set_env_use_list ( Value head)
inline

Definition at line 2579 of file il.h.

2579{ env_use_list_ = head; }

◆ set_input_use_list()

void dart::Definition::set_input_use_list ( Value head)
inline

Definition at line 2576 of file il.h.

2576{ input_use_list_ = head; }

◆ set_range()

void dart::Definition::set_range ( const Range range)

Definition at line 2643 of file range_analysis.cc.

2643 {
2644 if (range_ == nullptr) {
2645 range_ = new Range();
2646 }
2647 *range_ = range;
2648}

◆ set_ssa_temp_index()

void dart::Definition::set_ssa_temp_index ( intptr_t  index)
inline

Definition at line 2504 of file il.h.

2504 {
2505 ASSERT(index >= 0);
2506 ssa_temp_index_ = index;
2507 }

◆ set_temp_index()

void dart::Definition::set_temp_index ( intptr_t  index)
inline

Definition at line 2499 of file il.h.

2499{ temp_index_ = index; }

◆ set_type()

void dart::Definition::set_type ( CompileType type)
inlineprotected

Definition at line 2694 of file il.h.

2694 {
2695 ASSERT(type->owner() == this);
2696 type_ = type;
2697 }
GLenum type

◆ SetIdentity()

virtual void dart::Definition::SetIdentity ( AliasIdentity  identity)
inlinevirtual

Reimplemented in dart::StaticCallInstr, dart::CachableIdempotentCallInstr, and dart::AllocationInstr.

Definition at line 2662 of file il.h.

2662{ UNREACHABLE(); }
#define UNREACHABLE()
Definition: assert.h:248

◆ SetReplacement()

void dart::Definition::SetReplacement ( Definition other)
inline

Definition at line 2653 of file il.h.

2653 {
2654 ASSERT(ssa_temp_index_ >= 0);
2656 ssa_temp_index_ = kReplacementMarker;
2657 temp_index_ = reinterpret_cast<intptr_t>(other);
2658 }
bool WasEliminated() const
Definition: il.h:1262

◆ ssa_temp_index()

intptr_t dart::Definition::ssa_temp_index ( ) const
inline

Definition at line 2503 of file il.h.

2503{ return ssa_temp_index_; }

◆ temp_index()

intptr_t dart::Definition::temp_index ( ) const
inline

Definition at line 2498 of file il.h.

2498{ return temp_index_; }

◆ Type()

CompileType * dart::Definition::Type ( )
inline

Definition at line 2521 of file il.h.

2521 {
2522 if (type_ == nullptr) {
2523 auto type = new CompileType(ComputeType());
2524 type->set_owner(this);
2525 set_type(type);
2526 }
2527 return type_;
2528 }
virtual CompileType ComputeType() const
Definition: il.h:2542
void set_type(CompileType *type)
Definition: il.h:2694

◆ UpdateType()

PRINT_OPERANDS_TO_SUPPORT PRINT_TO_SUPPORT bool dart::Definition::UpdateType ( CompileType  new_type)
inline

Definition at line 2553 of file il.h.

2553 {
2554 if (type_ == nullptr) {
2555 auto type = new CompileType(new_type);
2556 type->set_owner(this);
2557 set_type(type);
2558 return true;
2559 }
2560
2561 if (type_->IsNone() || !type_->IsEqualTo(&new_type)) {
2562 *type_ = new_type;
2563 return true;
2564 }
2565
2566 return false;
2567 }
bool IsEqualTo(CompileType *other)
Definition: compile_type.h:214
bool IsNone() const
Definition: compile_type.h:221

◆ vreg()

intptr_t dart::Definition::vreg ( intptr_t  index) const
inline

Definition at line 2511 of file il.h.

2511 {
2512 ASSERT((index >= 0) && (index < location_count()));
2513 if (ssa_temp_index_ == -1) return -1;
2514 return ssa_temp_index_ * kMaxLocationCount + index;
2515 }
static constexpr intptr_t kMaxLocationCount
Definition: locations.h:73

Friends And Related Function Documentation

◆ RangeAnalysis

friend class RangeAnalysis
friend

Definition at line 2689 of file il.h.

◆ Value

friend class Value
friend

Definition at line 2690 of file il.h.

Member Data Documentation

◆ kReplacementMarker

constexpr intptr_t dart::Definition::kReplacementMarker = -2
staticconstexpr

Definition at line 2644 of file il.h.

◆ range_

Range* dart::Definition::range_ = nullptr
protected

Definition at line 2692 of file il.h.


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