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

#include <il.h>

Inheritance diagram for dart::PhiInstr:
dart::VariadicDefinition dart::Definition dart::Instruction dart::ZoneAllocated

Public Types

enum  ReceiverType { kUnknownReceiver = -1 , kNotReceiver = 0 , kReceiver = 1 }
 
- 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

 PhiInstr (JoinEntryInstr *block, intptr_t num_inputs)
 
virtual BlockEntryInstrGetBlock ()
 
JoinEntryInstrblock () const
 
virtual CompileType ComputeType () const
 
virtual bool RecomputeType ()
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool HasUnknownSideEffects () const
 
bool is_alive () const
 
void mark_alive ()
 
void mark_dead ()
 
virtual Representation RequiredInputRepresentation (intptr_t i) const
 
virtual Representation representation () const
 
virtual bool MayCreateUnsafeUntaggedPointer () const
 
virtual void set_representation (Representation r)
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual uword Hash () const
 
virtual void InferRange (RangeAnalysis *analysis, Range *range)
 
BitVectorreaching_defs () const
 
void set_reaching_defs (BitVector *reaching_defs)
 
virtual bool MayThrow () const
 
bool IsRedundant () const
 
DefinitionGetReplacementForRedundantPhi () const
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
ReceiverType is_receiver () const
 
void set_is_receiver (ReceiverType is_receiver)
 
- Public Member Functions inherited from dart::VariadicDefinition
 VariadicDefinition (InputsArray &&inputs, intptr_t deopt_id=DeoptId::kNone)
 
 VariadicDefinition (InputsArray &&inputs, const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
 VariadicDefinition (const intptr_t num_inputs, intptr_t deopt_id=DeoptId::kNone)
 
intptr_t InputCount () const
 
ValueInputAt (intptr_t i) const
 
- Public Member Functions inherited from dart::Definition
 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 ()
 
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 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 ()
 
Rangerange () const
 
void set_range (const Range &)
 
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
 
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 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
 
SpeculativeMode SpeculativeModeOfInputs () const
 
bool WasEliminated () const
 
virtual intptr_t DeoptimizationTarget () const
 
void InsertBefore (Instruction *next)
 
void InsertAfter (Instruction *prev)
 
InstructionAppendInstruction (Instruction *tail)
 
virtual bool AllowsCSE () const
 
virtual bool CanCallDart () const
 
virtual bool CanTriggerGC () const
 
virtual intptr_t inlining_id () const
 
virtual void set_inlining_id (intptr_t value)
 
virtual bool has_inlining_id () 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 MayHaveVisibleEffect () 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)
 

Friends

class ConstantPropagator
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::Definition
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 inherited from dart::Definition
static constexpr intptr_t kReplacementMarker = -2
 
- Static Public Attributes inherited from dart::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 
- Protected Member Functions inherited from dart::Definition
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 inherited from dart::VariadicDefinition
InputsArray inputs_
 
- Protected Attributes inherited from dart::Definition
Rangerange_ = nullptr
 

Detailed Description

Definition at line 2788 of file il.h.

Member Enumeration Documentation

◆ ReceiverType

Enumerator
kUnknownReceiver 
kNotReceiver 
kReceiver 

Definition at line 2866 of file il.h.

2866{ kUnknownReceiver = -1, kNotReceiver = 0, kReceiver = 1 };
@ kNotReceiver
Definition il.h:2866
@ kUnknownReceiver
Definition il.h:2866

Constructor & Destructor Documentation

◆ PhiInstr()

dart::PhiInstr::PhiInstr ( JoinEntryInstr block,
intptr_t  num_inputs 
)
inline

Definition at line 2790 of file il.h.

2791 : VariadicDefinition(num_inputs),
2792 block_(block),
2793 representation_(kTagged),
2794 is_alive_(false),
2795 is_receiver_(kUnknownReceiver) {}
JoinEntryInstr * block() const
Definition il.h:2799
VariadicDefinition(InputsArray &&inputs, intptr_t deopt_id=DeoptId::kNone)
Definition il.h:2755

Member Function Documentation

◆ block()

JoinEntryInstr * dart::PhiInstr::block ( ) const
inline

Definition at line 2799 of file il.h.

2799{ return block_; }

◆ Canonicalize()

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

Reimplemented from dart::Definition.

Definition at line 6700 of file il.cc.

6700 {
6702 if (replacement != nullptr && flow_graph->is_licm_allowed() &&
6704 // If we are replacing a Phi which has redefinitions as all of its inputs
6705 // then to maintain the redefinition chain we are going to insert a
6706 // redefinition. If any input is *not* a redefinition that means that
6707 // whatever properties were inferred for a Phi also hold on a path
6708 // that does not pass through any redefinitions so there is no need
6709 // to redefine this value.
6710 auto zone = flow_graph->zone();
6711 auto redef = new (zone) RedefinitionInstr(new (zone) Value(replacement));
6712 flow_graph->InsertAfter(block(), redef, /*env=*/nullptr, FlowGraph::kValue);
6713
6714 // Redefinition is not going to dominate the block entry itself, so we
6715 // have to handle environment uses at the block entry specially.
6716 Value* next_use;
6717 for (Value* use = env_use_list(); use != nullptr; use = next_use) {
6718 next_use = use->next_use();
6719 if (use->instruction() == block()) {
6720 use->RemoveFromUseList();
6721 use->set_definition(replacement);
6722 replacement->AddEnvUse(use);
6723 }
6724 }
6725 return redef;
6726 }
6727
6728 return (replacement != nullptr) ? replacement : this;
6729}
Value * env_use_list() const
Definition il.h:2560
Definition(intptr_t deopt_id=DeoptId::kNone)
Definition il.h:2470
Definition * GetReplacementForRedundantPhi() const
Definition il.cc:6647
static bool AllInputsAreRedefinitions(PhiInstr *phi)
Definition il.cc:6691

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Definition at line 2804 of file il.h.

2804{ return false; }

◆ ComputeType()

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

Reimplemented from dart::Definition.

Definition at line 1093 of file type_propagator.cc.

1093 {
1094 // Initially type of phis is unknown until type propagation is run
1095 // for the first time.
1096 return CompileType::None();
1097}
static CompileType None()

◆ GetBlock()

virtual BlockEntryInstr * dart::PhiInstr::GetBlock ( )
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 2798 of file il.h.

2798{ return block(); }

◆ GetReplacementForRedundantPhi()

Definition * dart::PhiInstr::GetReplacementForRedundantPhi ( ) const

Definition at line 6647 of file il.cc.

6647 {
6648 Definition* first = InputAt(0)->definition();
6649 if (InputCount() == 1) {
6650 return first;
6651 }
6652 ASSERT(InputCount() > 1);
6653 Definition* first_origin = first->OriginalDefinition();
6654 bool look_for_redefinition = false;
6655 for (intptr_t i = 1; i < InputCount(); ++i) {
6656 Definition* def = InputAt(i)->definition();
6657 if ((def != first) && (def != this)) {
6658 Definition* origin = def->OriginalDefinition();
6659 if ((origin != first_origin) && (origin != this)) return nullptr;
6660 look_for_redefinition = true;
6661 }
6662 }
6663 if (look_for_redefinition) {
6664 // Find the most specific redefinition which is common for all inputs
6665 // (the longest common chain).
6666 Definition* redef = first;
6667 for (intptr_t i = 1, n = InputCount(); redef != first_origin && i < n;) {
6668 Value* value = InputAt(i);
6669 bool found = false;
6670 do {
6671 Definition* def = value->definition();
6672 if ((def == redef) || (def == this)) {
6673 found = true;
6674 break;
6675 }
6676 value = def->RedefinedValue();
6677 } while (value != nullptr);
6678 if (found) {
6679 ++i;
6680 } else {
6681 ASSERT(redef != first_origin);
6682 redef = redef->RedefinedValue()->definition();
6683 }
6684 }
6685 return redef;
6686 } else {
6687 return first;
6688 }
6689}
Definition * definition() const
Definition il.h:103
intptr_t InputCount() const
Definition il.h:2776
Value * InputAt(intptr_t i) const
Definition il.h:2777
#define ASSERT(E)
uint8_t value

◆ Hash()

virtual uword dart::PhiInstr::Hash ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 2836 of file il.h.

2836 {
2837 UNREACHABLE();
2838 return 0;
2839 }
#define UNREACHABLE()
Definition assert.h:248

◆ HasUnknownSideEffects()

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

Implements dart::Instruction.

Definition at line 2806 of file il.h.

2806{ return false; }

◆ InferRange()

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

Reimplemented from dart::Definition.

Definition at line 2778 of file range_analysis.cc.

2778 {
2780 for (intptr_t i = 0; i < InputCount(); i++) {
2781 Value* input = InputAt(i);
2782 Join(range, input->definition(), GetInputRange(analysis, size, input),
2783 size);
2784 }
2785
2786 BlockEntryInstr* phi_block = GetBlock();
2787 range->set_min(
2789 range->set_max(
2791}
Range * range() const
Definition il.h:2618
virtual BlockEntryInstr * GetBlock()
Definition il.h:2798
static RangeBoundary MaxSmi()
static RangeBoundary MinSmi()
void set_max(const RangeBoundary &value)
const RangeBoundary & min() const
const RangeBoundary & max() const
void set_min(const RangeBoundary &value)
static void Join(Range *range, Definition *defn, const Range *defn_range, RangeBoundary::RangeSize size)
static const Range * GetInputRange(RangeAnalysis *analysis, RangeBoundary::RangeSize size, Value *input)
static RangeBoundary EnsureAcyclicSymbol(BlockEntryInstr *phi_block, const RangeBoundary &a, const RangeBoundary &limit)
static RangeBoundary::RangeSize RangeSizeForPhi(Definition *phi)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

◆ is_alive()

bool dart::PhiInstr::is_alive ( ) const
inline

Definition at line 2809 of file il.h.

2809{ return is_alive_; }

◆ is_receiver()

ReceiverType dart::PhiInstr::is_receiver ( ) const
inline

Definition at line 2868 of file il.h.

2868 {
2869 return static_cast<ReceiverType>(is_receiver_);
2870 }

◆ IsRedundant()

bool dart::PhiInstr::IsRedundant ( ) const

Definition at line 6637 of file il.cc.

6637 {
6638 ASSERT(InputCount() > 1);
6639 Definition* first = InputAt(0)->definition();
6640 for (intptr_t i = 1; i < InputCount(); ++i) {
6641 Definition* def = InputAt(i)->definition();
6642 if (def != first) return false;
6643 }
6644 return true;
6645}

◆ mark_alive()

void dart::PhiInstr::mark_alive ( )
inline

Definition at line 2810 of file il.h.

2810{ is_alive_ = true; }

◆ mark_dead()

void dart::PhiInstr::mark_dead ( )
inline

Definition at line 2811 of file il.h.

2811{ is_alive_ = false; }

◆ MayCreateUnsafeUntaggedPointer()

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

Reimplemented from dart::Definition.

Definition at line 2819 of file il.h.

2819 {
2820 // Unsafe untagged pointers should never escape the basic block in which
2821 // they are defined, so they should never be the input to a Phi node.
2822 // (This is checked in the FlowGraphChecker.)
2823 return false;
2824 }

◆ MayThrow()

virtual bool dart::PhiInstr::MayThrow ( ) const
inlinevirtual

Implements dart::Instruction.

Definition at line 2851 of file il.h.

2851{ return false; }

◆ reaching_defs()

BitVector * dart::PhiInstr::reaching_defs ( ) const
inline

Definition at line 2845 of file il.h.

2845{ return reaching_defs_; }

◆ RecomputeType()

bool dart::PhiInstr::RecomputeType ( )
virtual

Reimplemented from dart::Definition.

Definition at line 1099 of file type_propagator.cc.

1099 {
1100 CompileType result = CompileType::None();
1101 for (intptr_t i = 0; i < InputCount(); i++) {
1102 if (FLAG_support_il_printer && FLAG_trace_type_propagation) {
1103 THR_Print(" phi %" Pd " input %" Pd ": v%" Pd " has reaching type %s\n",
1104 ssa_temp_index(), i, InputAt(i)->definition()->ssa_temp_index(),
1105 InputAt(i)->Type()->ToCString());
1106 }
1107 result.Union(InputAt(i)->Type());
1108 }
1109
1110 if (result.IsNone()) {
1111 ASSERT(Type()->IsNone());
1112 return false;
1113 }
1114
1115 return UpdateType(result);
1116}
PRINT_OPERANDS_TO_SUPPORT PRINT_TO_SUPPORT bool UpdateType(CompileType new_type)
Definition il.h:2535
intptr_t ssa_temp_index() const
Definition il.h:2485
const char * ToCString() const
#define THR_Print(format,...)
Definition log.h:20
GAsyncResult * result
constexpr bool FLAG_support_il_printer
Definition flag_list.h:48
#define Pd
Definition globals.h:408

◆ representation()

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

Reimplemented from dart::Instruction.

Definition at line 2817 of file il.h.

2817{ return representation_; }

◆ RequiredInputRepresentation()

virtual Representation dart::PhiInstr::RequiredInputRepresentation ( intptr_t  i) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 2813 of file il.h.

2813 {
2814 return representation_;
2815 }

◆ set_is_receiver()

void dart::PhiInstr::set_is_receiver ( ReceiverType  is_receiver)
inline

Definition at line 2872 of file il.h.

2872{ is_receiver_ = is_receiver; }
ReceiverType is_receiver() const
Definition il.h:2868

◆ set_reaching_defs()

void dart::PhiInstr::set_reaching_defs ( BitVector reaching_defs)
inline

Definition at line 2847 of file il.h.

2847 {
2848 reaching_defs_ = reaching_defs;
2849 }
BitVector * reaching_defs() const
Definition il.h:2845

◆ set_representation()

virtual void dart::PhiInstr::set_representation ( Representation  r)
inlinevirtual

Definition at line 2826 of file il.h.

2826{ representation_ = r; }

◆ SpeculativeModeOfInput()

virtual SpeculativeMode dart::PhiInstr::SpeculativeModeOfInput ( intptr_t  index) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 2829 of file il.h.

2829 {
2830 return (CompilerState::Current().is_aot() ||
2831 (representation_ != kUnboxedInt32))
2833 : kGuardInputs;
2834 }
static CompilerState & Current()
@ kNotSpeculative
Definition il.h:969

Friends And Related Symbol Documentation

◆ ConstantPropagator

friend class ConstantPropagator
friend

Definition at line 2877 of file il.h.


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