Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::EqualityCompareInstr Class Reference

#include <il.h>

Inheritance diagram for dart::EqualityCompareInstr:
dart::TemplateComparison< 2, NoThrow, Pure > dart::PureDefinition dart::Definition dart::Instruction dart::ZoneAllocated

Public Member Functions

 EqualityCompareInstr (const InstructionSource &source, Token::Kind kind, Value *left, Value *right, intptr_t cid, intptr_t deopt_id, bool null_aware=false, SpeculativeMode speculative_mode=kGuardInputs)
 
virtual ComparisonInstrCopyWithNewOperands (Value *left, Value *right)
 
virtual CompileType ComputeType () const
 
virtual bool ComputeCanDeoptimize () const
 
bool is_null_aware () const
 
void set_null_aware (bool value)
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
- Public Member Functions inherited from dart::TemplateComparison< 2, NoThrow, Pure >
 TemplateComparison (const InstructionSource &source, Token::Kind kind, intptr_t deopt_id=DeoptId::kNone)
 
virtual intptr_t InputCount () const
 
virtual ValueInputAt (intptr_t i) const
 
virtual bool MayThrow () const
 
- Public Member Functions inherited from dart::PureDefinition
 PureDefinition (intptr_t deopt_id)
 
 PureDefinition (const InstructionSource &source, intptr_t deopt_id)
 
virtual bool AllowsCSE () const
 
virtual bool HasUnknownSideEffects () 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 ()
 
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)
 

Additional Inherited Members

- Public Types inherited from dart::TemplateComparison< 2, NoThrow, Pure >
using BaseClass = typename Pure< ComparisonInstr, PureComparison >::Base
 
- 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 >
 
- 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::TemplateComparison< 2, NoThrow, Pure >
EmbeddedArray< Value *, Ninputs_
 
- Protected Attributes inherited from dart::Definition
Rangerange_ = nullptr
 

Detailed Description

Definition at line 5314 of file il.h.

Constructor & Destructor Documentation

◆ EqualityCompareInstr()

dart::EqualityCompareInstr::EqualityCompareInstr ( const InstructionSource source,
Token::Kind  kind,
Value left,
Value right,
intptr_t  cid,
intptr_t  deopt_id,
bool  null_aware = false,
SpeculativeMode  speculative_mode = kGuardInputs 
)
inline

Definition at line 5316 of file il.h.

5325 null_aware_(null_aware),
5326 speculative_mode_(speculative_mode) {
5328 SetInputAt(0, left);
5329 SetInputAt(1, right);
5330 set_operation_cid(cid);
5331 }
void SetInputAt(intptr_t i, Value *value)
Definition: il.h:1014
InstructionSource source() const
Definition: il.h:1008
intptr_t deopt_id() const
Definition: il.h:993
TemplateComparison(const InstructionSource &source, Token::Kind kind, intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:3953
static bool IsEqualityOperator(Kind tok)
Definition: token.h:236
#define ASSERT(E)
const intptr_t cid

Member Function Documentation

◆ AttributesEqual()

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

Reimplemented from dart::Instruction.

Definition at line 5357 of file il.h.

5357 {
5358 return ComparisonInstr::AttributesEqual(other) &&
5359 (null_aware_ == other.AsEqualityCompare()->null_aware_) &&
5360 (speculative_mode_ == other.AsEqualityCompare()->speculative_mode_);
5361 }
virtual bool AttributesEqual(const Instruction &other) const
Definition: il.h:3885

◆ Canonicalize()

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

Reimplemented from dart::Definition.

Definition at line 3752 of file il.cc.

3752 {
3753 if (is_null_aware()) {
3754 ASSERT(operation_cid() == kMintCid);
3755 // Select more efficient instructions based on operand types.
3756 CompileType* left_type = left()->Type();
3757 CompileType* right_type = right()->Type();
3758 if (left_type->IsNull() || left_type->IsNullableSmi() ||
3759 right_type->IsNull() || right_type->IsNullableSmi()) {
3760 auto replacement = new StrictCompareInstr(
3761 source(),
3762 (kind() == Token::kEQ) ? Token::kEQ_STRICT : Token::kNE_STRICT,
3763 left()->CopyWithType(), right()->CopyWithType(),
3764 /*needs_number_check=*/false, DeoptId::kNone);
3765 flow_graph->InsertBefore(this, replacement, env(), FlowGraph::kValue);
3766 return replacement;
3767 } else {
3768 // Null-aware EqualityCompare takes boxed inputs, so make sure
3769 // unmatched representations are still allowed when converting
3770 // EqualityCompare to the unboxed instruction.
3771 if (!left_type->is_nullable() && !right_type->is_nullable() &&
3772 flow_graph->unmatched_representations_allowed()) {
3773 set_null_aware(false);
3774 }
3775 }
3776 } else {
3777 if ((operation_cid() == kMintCid) && IsSingleUseUnboxOrConstant(left()) &&
3779 (left()->Type()->IsNullableSmi() || right()->Type()->IsNullableSmi()) &&
3780 flow_graph->unmatched_representations_allowed()) {
3781 auto replacement = new StrictCompareInstr(
3782 source(),
3783 (kind() == Token::kEQ) ? Token::kEQ_STRICT : Token::kNE_STRICT,
3784 left()->CopyWithType(), right()->CopyWithType(),
3785 /*needs_number_check=*/false, DeoptId::kNone);
3786 flow_graph->InsertBefore(this, replacement, env(), FlowGraph::kValue);
3787 return replacement;
3788 }
3789 }
3790 return this;
3791}
CompileType * Type()
Definition: il.h:2521
static constexpr intptr_t kNone
Definition: deopt_id.h:27
bool is_null_aware() const
Definition: il.h:5341
void set_null_aware(bool value)
Definition: il.h:5342
Environment * env() const
Definition: il.h:1215
friend class StrictCompareInstr
Definition: il.h:1406
static bool IsSingleUseUnboxOrConstant(Value *use)
Definition: il.cc:3747

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Definition at line 5339 of file il.h.

5339{ return false; }

◆ ComputeType()

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

Reimplemented from dart::Definition.

Definition at line 1424 of file type_propagator.cc.

1424 {
1425 // Used for numeric comparisons only.
1426 return CompileType::Bool();
1427}
static CompileType Bool()

◆ CopyWithNewOperands()

ComparisonInstr * dart::EqualityCompareInstr::CopyWithNewOperands ( Value left,
Value right 
)
virtual

Definition at line 6550 of file il.cc.

6551 {
6552 return new EqualityCompareInstr(source(), kind(), new_left, new_right,
6553 operation_cid(), deopt_id(), is_null_aware(),
6554 speculative_mode_);
6555}
EqualityCompareInstr(const InstructionSource &source, Token::Kind kind, Value *left, Value *right, intptr_t cid, intptr_t deopt_id, bool null_aware=false, SpeculativeMode speculative_mode=kGuardInputs)
Definition: il.h:5316

◆ is_null_aware()

bool dart::EqualityCompareInstr::is_null_aware ( ) const
inline

Definition at line 5341 of file il.h.

5341{ return null_aware_; }

◆ RequiredInputRepresentation()

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

Reimplemented from dart::Instruction.

Definition at line 5344 of file il.h.

5344 {
5345 ASSERT((idx == 0) || (idx == 1));
5346 if (is_null_aware()) return kTagged;
5347 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
5348 if (operation_cid() == kMintCid) return kUnboxedInt64;
5349 if (operation_cid() == kIntegerCid) return kUnboxedUword;
5350 return kTagged;
5351 }
static constexpr Representation kUnboxedUword
Definition: locations.h:171

◆ set_null_aware()

void dart::EqualityCompareInstr::set_null_aware ( bool  value)
inline

Definition at line 5342 of file il.h.

5342{ null_aware_ = value; }
uint8_t value

◆ SpeculativeModeOfInput()

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

Reimplemented from dart::Instruction.

Definition at line 5353 of file il.h.

5353 {
5354 return speculative_mode_;
5355 }

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