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

#include <range_analysis.h>

Inheritance diagram for dart::RangeAnalysis:
dart::ValueObject

Public Member Functions

 RangeAnalysis (FlowGraph *flow_graph)
 
void Analyze ()
 
const RangeGetSmiRange (Value *value) const
 
const RangeGetIntRange (Value *value) const
 
void AssignRangesRecursively (Definition *defn)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Static Public Member Functions

static bool IsIntegerDefinition (Definition *defn)
 

Detailed Description

Definition at line 530 of file range_analysis.h.

Constructor & Destructor Documentation

◆ RangeAnalysis()

dart::RangeAnalysis::RangeAnalysis ( FlowGraph flow_graph)
inlineexplicit

Definition at line 532 of file range_analysis.h.

533 : flow_graph_(flow_graph),
static Range Full(RangeBoundary::RangeSize size)

Member Function Documentation

◆ Analyze()

void dart::RangeAnalysis::Analyze ( )

Definition at line 56 of file range_analysis.cc.

56 {
57 CollectValues();
58 InsertConstraints();
59 flow_graph_->GetLoopHierarchy().ComputeInduction();
60 InferRanges();
61 EliminateRedundantBoundsChecks();
62 MarkUnreachableBlocks();
63
64 NarrowMintToInt32();
65
66 IntegerInstructionSelector iis(flow_graph_);
67 iis.Select();
68
69 RemoveConstraints();
70}
const LoopHierarchy & GetLoopHierarchy()
Definition: flow_graph.h:430
void ComputeInduction() const
Definition: loops.cc:1207

◆ AssignRangesRecursively()

void dart::RangeAnalysis::AssignRangesRecursively ( Definition defn)

Definition at line 585 of file range_analysis.cc.

585 {
586 if (!Range::IsUnknown(defn->range())) {
587 return;
588 }
589
590 if (!IsIntegerDefinition(defn)) {
591 return;
592 }
593
594 for (intptr_t i = 0; i < defn->InputCount(); i++) {
595 Definition* input_defn = defn->InputAt(i)->definition();
596 if (!input_defn->HasSSATemp() || input_defn->IsConstant()) {
597 AssignRangesRecursively(input_defn);
598 }
599 }
600
601 Range new_range;
602 defn->InferRange(this, &new_range);
603 if (!Range::IsUnknown(&new_range)) {
604 defn->set_range(new_range);
605 }
606}
void AssignRangesRecursively(Definition *defn)
static bool IsIntegerDefinition(Definition *defn)
static bool IsUnknown(const Range *other)

◆ GetIntRange()

const Range * dart::RangeAnalysis::GetIntRange ( Value value) const

Definition at line 303 of file range_analysis.cc.

303 {
304 Definition* defn = value->definition();
305 const Range* range = defn->range();
306
307 if ((range == nullptr) && !defn->Type()->IsInt()) {
308 // Type propagator determined that reaching type for this use is int.
309 // However the definition itself is not a int-definition and
310 // thus it will never have range assigned to it. Just return the widest
311 // range possible for this value.
312 // Note: that we can't return nullptr here because it is used as lattice's
313 // bottom element to indicate that the range was not computed *yet*.
314 return &int64_range_;
315 }
316
317 return range;
318}
uint8_t value

◆ GetSmiRange()

const Range * dart::RangeAnalysis::GetSmiRange ( Value value) const

Definition at line 282 of file range_analysis.cc.

282 {
283 Definition* defn = value->definition();
284 const Range* range = defn->range();
285
286 if ((range == nullptr) && (defn->Type()->ToCid() != kSmiCid)) {
287 // Type propagator determined that reaching type for this use is Smi.
288 // However the definition itself is not a smi-definition and
289 // thus it will never have range assigned to it. Just return the widest
290 // range possible for this value.
291 // We don't need to handle kMintCid here because all external mints
292 // (e.g. results of loads or function call) can be used only after they
293 // pass through UnboxInt64Instr which is considered as mint-definition
294 // and will have a range assigned to it.
295 // Note: that we can't return nullptr here because it is used as lattice's
296 // bottom element to indicate that the range was not computed *yet*.
297 return &smi_range_;
298 }
299
300 return range;
301}

◆ IsIntegerDefinition()

static bool dart::RangeAnalysis::IsIntegerDefinition ( Definition defn)
inlinestatic

Definition at line 548 of file range_analysis.h.

548 {
549 return defn->Type()->IsInt();
550 }

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