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

#include <il.h>

Inheritance diagram for dart::UnboxInstr:
dart::TemplateDefinition< 1, NoThrow, Pure > dart::PureDefinition dart::Definition dart::Instruction dart::ZoneAllocated dart::UnboxIntegerInstr dart::UnboxInt64Instr dart::UnboxInteger32Instr dart::UnboxInt32Instr dart::UnboxUint32Instr

Public Member Functions

Valuevalue () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual Representation representation () const
 
virtual bool AttributesEqual (const Instruction &other) const
 
DefinitionCanonicalize (FlowGraph *flow_graph)
 
virtual intptr_t DeoptimizationTarget () const
 
virtual TokenPosition token_pos () const
 
 DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS (UnboxInstr, TemplateDefinition, FIELD_LIST) protected
 
void set_speculative_mode (SpeculativeMode value)
 
- Public Member Functions inherited from dart::TemplateDefinition< 1, NoThrow, Pure >
 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
 
- 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)
 

Static Public Member Functions

static UnboxInstrCreate (Representation to, Value *value, intptr_t deopt_id, SpeculativeMode speculative_mode=kGuardInputs)
 
- 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)
 

Additional Inherited Members

- Public Types inherited from dart::TemplateDefinition< 1, NoThrow, Pure >
using BaseClass = typename Pure< Definition, PureDefinition >::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 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::TemplateDefinition< 1, NoThrow, Pure >
EmbeddedArray< Value *, Ninputs_
 
- Protected Attributes inherited from dart::Definition
Rangerange_ = nullptr
 

Detailed Description

Definition at line 8671 of file il.h.

Member Function Documentation

◆ AttributesEqual()

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

Reimplemented from dart::Instruction.

Reimplemented in dart::UnboxIntegerInstr.

Definition at line 8707 of file il.h.

8707 {
8708 auto const other_unbox = other.AsUnbox();
8709 return (representation() == other_unbox->representation()) &&
8710 (speculative_mode_ == other_unbox->speculative_mode_);
8711 }
virtual Representation representation() const
Definition: il.h:8703

◆ Canonicalize()

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

Reimplemented from dart::Definition.

Reimplemented in dart::UnboxIntegerInstr.

Definition at line 3312 of file il.cc.

3312 {
3313 if (!HasUses() && !CanDeoptimize()) return nullptr;
3314
3315 // Fold away Unbox<rep>(v) if v has a target representation already.
3316 Definition* value_defn = value()->definition();
3317 if (value_defn->representation() == representation()) {
3318 return value_defn;
3319 }
3320
3321 BoxInstr* box_defn = value()->definition()->AsBox();
3322 if (box_defn != nullptr) {
3323 // Fold away Unbox<rep>(Box<rep>(v)).
3324 if (box_defn->from_representation() == representation()) {
3325 return box_defn->value()->definition();
3326 }
3327
3328 if ((box_defn->from_representation() == kUnboxedDouble) &&
3329 (representation() == kUnboxedFloat)) {
3330 Definition* replacement = new DoubleToFloatInstr(
3331 box_defn->value()->CopyWithType(), DeoptId::kNone);
3332 flow_graph->InsertBefore(this, replacement, NULL, FlowGraph::kValue);
3333 return replacement;
3334 }
3335
3336 if ((box_defn->from_representation() == kUnboxedFloat) &&
3337 (representation() == kUnboxedDouble)) {
3338 Definition* replacement = new FloatToDoubleInstr(
3339 box_defn->value()->CopyWithType(), DeoptId::kNone);
3340 flow_graph->InsertBefore(this, replacement, NULL, FlowGraph::kValue);
3341 return replacement;
3342 }
3343 }
3344
3345 if (representation() == kUnboxedDouble && value()->BindsToConstant()) {
3346 const Object& val = value()->BoundConstant();
3347 if (val.IsInteger()) {
3348 const Double& double_val = Double::ZoneHandle(
3349 flow_graph->zone(),
3350 Double::NewCanonical(Integer::Cast(val).AsDoubleValue()));
3351 return flow_graph->GetConstant(double_val, kUnboxedDouble);
3352 } else if (val.IsDouble()) {
3353 return flow_graph->GetConstant(val, kUnboxedDouble);
3354 }
3355 }
3356
3357 if (representation() == kUnboxedFloat && value()->BindsToConstant()) {
3358 const Object& val = value()->BoundConstant();
3359 if (val.IsInteger()) {
3360 double narrowed_val =
3361 static_cast<float>(Integer::Cast(val).AsDoubleValue());
3362 return flow_graph->GetConstant(
3364 kUnboxedFloat);
3365 } else if (val.IsDouble()) {
3366 double narrowed_val = static_cast<float>(Double::Cast(val).value());
3367 return flow_graph->GetConstant(
3369 kUnboxedFloat);
3370 }
3371 }
3372
3373 return this;
3374}
bool HasUses() const
Definition: il.h:2569
Definition(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:2488
static constexpr intptr_t kNone
Definition: deopt_id.h:27
static DoublePtr NewCanonical(double d)
Definition: object.cc:23418
bool CanDeoptimize() const
Definition: il.h:1079
static Object & ZoneHandle()
Definition: object.h:419
Value * value() const
Definition: il.h:8678
const Object & BoundConstant() const
Definition: il.cc:1201
Definition * definition() const
Definition: il.h:103

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Reimplemented in dart::UnboxIntegerInstr.

Definition at line 8680 of file il.h.

8680 {
8682 return false;
8683 }
8684
8685 const intptr_t value_cid = value()->Type()->ToCid();
8686 const intptr_t box_cid = BoxCid();
8687
8688 if (value_cid == box_cid) {
8689 return false;
8690 }
8691
8692 if (CanConvertSmi() && (value_cid == kSmiCid)) {
8693 return false;
8694 }
8695
8696 return true;
8697 }
@ kNotSpeculative
Definition: il.h:975
SpeculativeMode SpeculativeModeOfInputs() const
Definition: il.h:1245
CompileType * Type()

◆ Create()

UnboxInstr * dart::UnboxInstr::Create ( Representation  to,
Value value,
intptr_t  deopt_id,
SpeculativeMode  speculative_mode = kGuardInputs 
)
static

Definition at line 4043 of file il.cc.

4046 {
4047 switch (to) {
4048 case kUnboxedInt32:
4049 // We must truncate if we can't deoptimize.
4050 return new UnboxInt32Instr(
4051 speculative_mode == SpeculativeMode::kNotSpeculative
4054 value, deopt_id, speculative_mode);
4055
4056 case kUnboxedUint32:
4057 return new UnboxUint32Instr(value, deopt_id, speculative_mode);
4058
4059 case kUnboxedInt64:
4060 return new UnboxInt64Instr(value, deopt_id, speculative_mode);
4061
4062 case kUnboxedDouble:
4063 case kUnboxedFloat:
4064 case kUnboxedFloat32x4:
4065 case kUnboxedFloat64x2:
4066 case kUnboxedInt32x4:
4067 return new UnboxInstr(to, value, deopt_id, speculative_mode);
4068
4069 default:
4070 UNREACHABLE();
4071 return nullptr;
4072 }
4073}
#define UNREACHABLE()
Definition: assert.h:248
intptr_t deopt_id() const
Definition: il.h:993

◆ DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS()

dart::UnboxInstr::DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS ( UnboxInstr  ,
TemplateDefinition  ,
FIELD_LIST   
)
inline

Definition at line 8723 of file il.h.

8728 :
8729 UnboxInstr(Representation representation,
8730 Value* value,
8731 intptr_t deopt_id,
8732 SpeculativeMode speculative_mode)
8734 representation_(representation),
8735 speculative_mode_(speculative_mode) {
8736 // Unboxing doesn't currently handle non-native representations.
8738 SetInputAt(0, value);
8739 }
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309
void SetInputAt(intptr_t i, Value *value)
Definition: il.h:1014
TemplateDefinition(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:2749
Representation
Definition: locations.h:66
static constexpr Representation NativeRepresentation(Representation rep)
Definition: il.h:8504

◆ DeoptimizationTarget()

virtual intptr_t dart::UnboxInstr::DeoptimizationTarget ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 8715 of file il.h.

8715{ return GetDeoptId(); }
intptr_t GetDeoptId() const
Definition: il.h:1409

◆ representation()

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

Reimplemented from dart::Instruction.

Definition at line 8703 of file il.h.

8703{ return representation_; }

◆ set_speculative_mode()

void dart::UnboxInstr::set_speculative_mode ( SpeculativeMode  value)
inline

Definition at line 8741 of file il.h.

8741 {
8742 speculative_mode_ = value;
8743 }

◆ SpeculativeModeOfInput()

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

Reimplemented from dart::Instruction.

Definition at line 8699 of file il.h.

8699 {
8700 return speculative_mode_;
8701 }

◆ token_pos()

virtual TokenPosition dart::UnboxInstr::token_pos ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 8717 of file il.h.

8717{ return TokenPosition::kBox; }

◆ value()

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

Definition at line 8678 of file il.h.

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

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