Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
dart::BlockEntryInstr Class Referenceabstract

#include <il.h>

Inheritance diagram for dart::BlockEntryInstr:
dart::TemplateInstruction< 0, NoThrow > dart::Instruction dart::ZoneAllocated dart::BlockEntryWithInitialDefs dart::JoinEntryInstr dart::TargetEntryInstr dart::CatchBlockEntryInstr dart::FunctionEntryInstr dart::GraphEntryInstr dart::OsrEntryInstr dart::IndirectEntryInstr dart::NativeEntryInstr

Classes

class  InstructionsIterable
 

Public Member Functions

virtual intptr_t PredecessorCount () const =0
 
virtual BlockEntryInstrPredecessorAt (intptr_t index) const =0
 
intptr_t preorder_number () const
 
void set_preorder_number (intptr_t number)
 
intptr_t postorder_number () const
 
void set_postorder_number (intptr_t number)
 
intptr_t block_id () const
 
void set_start_pos (intptr_t pos)
 
intptr_t start_pos () const
 
void set_end_pos (intptr_t pos)
 
intptr_t end_pos () const
 
BlockEntryInstrdominator () const
 
BlockEntryInstrImmediateDominator () const
 
const GrowableArray< BlockEntryInstr * > & dominated_blocks ()
 
void AddDominatedBlock (BlockEntryInstr *block)
 
void ClearDominatedBlocks ()
 
bool Dominates (BlockEntryInstr *other) const
 
Instructionlast_instruction () const
 
void set_last_instruction (Instruction *instr)
 
ParallelMoveInstrparallel_move () const
 
bool HasParallelMove () const
 
bool HasNonRedundantParallelMove () const
 
ParallelMoveInstrGetParallelMove ()
 
bool DiscoverBlock (BlockEntryInstr *predecessor, GrowableArray< BlockEntryInstr * > *preorder, GrowableArray< intptr_t > *parent)
 
virtual bool CanBecomeDeoptimizationTarget () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool HasUnknownSideEffects () const
 
intptr_t try_index () const
 
void set_try_index (intptr_t index)
 
bool InsideTryBlock () const
 
LoopInfoloop_info () const
 
void set_loop_info (LoopInfo *loop_info)
 
bool IsLoopHeader () const
 
intptr_t NestingDepth () const
 
virtual BlockEntryInstrGetBlock ()
 
virtual TokenPosition token_pos () const
 
void ReplaceAsPredecessorWith (BlockEntryInstr *new_block)
 
void set_block_id (intptr_t block_id)
 
intptr_t stack_depth () const
 
void set_stack_depth (intptr_t s)
 
void ClearAllInstructions ()
 
InstructionsIterable instructions ()
 
- Public Member Functions inherited from dart::TemplateInstruction< 0, NoThrow >
 TemplateInstruction (intptr_t deopt_id=DeoptId::kNone)
 
 TemplateInstruction (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::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)
 

Protected Member Functions

 BlockEntryInstr (intptr_t block_id, intptr_t try_index, intptr_t deopt_id, intptr_t stack_depth)
 
bool FindOsrEntryAndRelink (GraphEntryInstr *graph_entry, Instruction *parent, BitVector *block_marks)
 
- 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)
 

Private Member Functions

virtual void ClearPredecessors ()=0
 
virtual void AddPredecessor (BlockEntryInstr *predecessor)=0
 

Additional Inherited Members

- Public Types inherited from dart::TemplateInstruction< 0, NoThrow >
using BaseClass = typename NoCSE< Instruction, PureInstruction >::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::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::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 
- Protected Attributes inherited from dart::TemplateInstruction< 0, NoThrow >
EmbeddedArray< Value *, Ninputs_
 

Detailed Description

Definition at line 1650 of file il.h.

Constructor & Destructor Documentation

◆ BlockEntryInstr()

dart::BlockEntryInstr::BlockEntryInstr ( intptr_t  block_id,
intptr_t  try_index,
intptr_t  deopt_id,
intptr_t  stack_depth 
)
inlineprotected

Definition at line 1782 of file il.h.

1787 block_id_(block_id),
1788 try_index_(try_index),
1789 stack_depth_(stack_depth),
1790 dominated_blocks_(1) {}
intptr_t try_index() const
Definition: il.h:1730
intptr_t block_id() const
Definition: il.h:1661
intptr_t stack_depth() const
Definition: il.h:1756
intptr_t deopt_id() const
Definition: il.h:993
TemplateInstruction(intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:1507

Member Function Documentation

◆ AddDominatedBlock()

void dart::BlockEntryInstr::AddDominatedBlock ( BlockEntryInstr block)
inline

Definition at line 1677 of file il.h.

1677 {
1678 ASSERT(!block->IsFunctionEntry() || this->IsGraphEntry());
1679 block->set_dominator(this);
1680 dominated_blocks_.Add(block);
1681 }
#define ASSERT(E)

◆ AddPredecessor()

virtual void dart::BlockEntryInstr::AddPredecessor ( BlockEntryInstr predecessor)
privatepure virtual

◆ block_id()

intptr_t dart::BlockEntryInstr::block_id ( ) const
inline

Definition at line 1661 of file il.h.

1661{ return block_id_; }

◆ CanBecomeDeoptimizationTarget()

virtual bool dart::BlockEntryInstr::CanBecomeDeoptimizationTarget ( ) const
inlinevirtual

Reimplemented from dart::Instruction.

Definition at line 1720 of file il.h.

1720 {
1721 // BlockEntry environment is copied to Goto and Branch instructions
1722 // when we insert new blocks targeting this block.
1723 return true;
1724 }

◆ ClearAllInstructions()

void dart::BlockEntryInstr::ClearAllInstructions ( )

Definition at line 1905 of file il.cc.

1905 {
1906 JoinEntryInstr* join = this->AsJoinEntry();
1907 if (join != nullptr) {
1908 for (PhiIterator it(join); !it.Done(); it.Advance()) {
1909 it.Current()->UnuseAllInputs();
1910 }
1911 }
1913 for (ForwardInstructionIterator it(this); !it.Done(); it.Advance()) {
1914 it.Current()->UnuseAllInputs();
1915 }
1916}
void UnuseAllInputs()
Definition: il.cc:1534
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ ClearDominatedBlocks()

void dart::BlockEntryInstr::ClearDominatedBlocks ( )
inline

Definition at line 1682 of file il.h.

1682{ dominated_blocks_.Clear(); }

◆ ClearPredecessors()

virtual void dart::BlockEntryInstr::ClearPredecessors ( )
privatepure virtual

◆ ComputeCanDeoptimize()

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

Implements dart::Instruction.

Definition at line 1726 of file il.h.

1726{ return false; }

◆ DiscoverBlock()

bool dart::BlockEntryInstr::DiscoverBlock ( BlockEntryInstr predecessor,
GrowableArray< BlockEntryInstr * > *  preorder,
GrowableArray< intptr_t > *  parent 
)

Definition at line 1699 of file il.cc.

1701 {
1702 // If this block has a predecessor (i.e., is not the graph entry) we can
1703 // assume the preorder array is non-empty.
1704 ASSERT((predecessor == nullptr) || !preorder->is_empty());
1705 // Blocks with a single predecessor cannot have been reached before.
1706 ASSERT(IsJoinEntry() || !IsMarked(this, preorder));
1707
1708 // 1. If the block has already been reached, add current_block as a
1709 // basic-block predecessor and we are done.
1710 if (IsMarked(this, preorder)) {
1711 ASSERT(predecessor != nullptr);
1712 AddPredecessor(predecessor);
1713 return false;
1714 }
1715
1716 // 2. Otherwise, clear the predecessors which might have been computed on
1717 // some earlier call to DiscoverBlocks and record this predecessor.
1719 if (predecessor != nullptr) AddPredecessor(predecessor);
1720
1721 // 3. The predecessor is the spanning-tree parent. The graph entry has no
1722 // parent, indicated by -1.
1723 intptr_t parent_number =
1724 (predecessor == nullptr) ? -1 : predecessor->preorder_number();
1725 parent->Add(parent_number);
1726
1727 // 4. Assign the preorder number and add the block entry to the list.
1728 set_preorder_number(preorder->length());
1729 preorder->Add(this);
1730
1731 // The preorder and parent arrays are indexed by
1732 // preorder block number, so they should stay in lockstep.
1733 ASSERT(preorder->length() == parent->length());
1734
1735 // 5. Iterate straight-line successors to record assigned variables and
1736 // find the last instruction in the block. The graph entry block consists
1737 // of only the entry instruction, so that is the last instruction in the
1738 // block.
1739 Instruction* last = this;
1740 for (ForwardInstructionIterator it(this); !it.Done(); it.Advance()) {
1741 last = it.Current();
1742 }
1744 if (last->IsGoto()) last->AsGoto()->set_block(this);
1745
1746 return true;
1747}
void Add(const T &value)
intptr_t length() const
void set_preorder_number(intptr_t number)
Definition: il.h:1656
virtual void ClearPredecessors()=0
virtual void AddPredecessor(BlockEntryInstr *predecessor)=0
void set_last_instruction(Instruction *instr)
Definition: il.h:1687
Instruction(const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
Definition: il.h:980
static bool IsMarked(BlockEntryInstr *block, GrowableArray< BlockEntryInstr * > *preorder)
Definition: il.cc:1688

◆ dominated_blocks()

const GrowableArray< BlockEntryInstr * > & dart::BlockEntryInstr::dominated_blocks ( )
inline

Definition at line 1673 of file il.h.

1673 {
1674 return dominated_blocks_;
1675 }

◆ Dominates()

bool dart::BlockEntryInstr::Dominates ( BlockEntryInstr other) const

Definition at line 1815 of file il.cc.

1815 {
1816 // TODO(fschneider): Make this faster by e.g. storing dominators for each
1817 // block while computing the dominator tree.
1818 ASSERT(other != nullptr);
1819 BlockEntryInstr* current = other;
1820 while (current != nullptr && current != this) {
1821 current = current->dominator();
1822 }
1823 return current == this;
1824}
friend class BlockEntryInstr
Definition: il.h:1403

◆ dominator()

BlockEntryInstr * dart::BlockEntryInstr::dominator ( ) const
inline

Definition at line 1670 of file il.h.

1670{ return dominator_; }

◆ end_pos()

intptr_t dart::BlockEntryInstr::end_pos ( ) const
inline

Definition at line 1668 of file il.h.

1668{ return end_pos_; }

◆ FindOsrEntryAndRelink()

bool dart::BlockEntryInstr::FindOsrEntryAndRelink ( GraphEntryInstr graph_entry,
Instruction parent,
BitVector block_marks 
)
protected

Definition at line 1756 of file il.cc.

1758 {
1759 const intptr_t osr_id = graph_entry->osr_id();
1760
1761 // Search for the instruction with the OSR id. Use a depth first search
1762 // because basic blocks have not been discovered yet. Prune unreachable
1763 // blocks by replacing the normal entry with a jump to the block
1764 // containing the OSR entry point.
1765
1766 // Do not visit blocks more than once.
1767 if (block_marks->Contains(block_id())) return false;
1768 block_marks->Add(block_id());
1769
1770 // Search this block for the OSR id.
1771 Instruction* instr = this;
1772 for (ForwardInstructionIterator it(this); !it.Done(); it.Advance()) {
1773 instr = it.Current();
1774 if (instr->GetDeoptId() == osr_id) {
1775 // Sanity check that we found a stack check instruction.
1776 ASSERT(instr->IsCheckStackOverflow());
1777 // Loop stack check checks are always in join blocks so that they can
1778 // be the target of a goto.
1779 ASSERT(IsJoinEntry());
1780 // The instruction should be the first instruction in the block so
1781 // we can simply jump to the beginning of the block.
1782 ASSERT(instr->previous() == this);
1783
1784 ASSERT(stack_depth() == instr->AsCheckStackOverflow()->stack_depth());
1785 auto normal_entry = graph_entry->normal_entry();
1786 auto osr_entry = new OsrEntryInstr(
1787 graph_entry, normal_entry->block_id(), normal_entry->try_index(),
1788 normal_entry->deopt_id(), stack_depth());
1789
1790 auto goto_join = new GotoInstr(AsJoinEntry(),
1791 CompilerState::Current().GetNextDeoptId());
1792 ASSERT(parent != nullptr);
1793 goto_join->CopyDeoptIdFrom(*parent);
1794 osr_entry->LinkTo(goto_join);
1795
1796 // Remove normal function entries & add osr entry.
1797 graph_entry->set_normal_entry(nullptr);
1798 graph_entry->set_unchecked_entry(nullptr);
1799 graph_entry->set_osr_entry(osr_entry);
1800
1801 return true;
1802 }
1803 }
1804
1805 // Recursively search the successors.
1806 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) {
1807 if (instr->SuccessorAt(i)->FindOsrEntryAndRelink(graph_entry, instr,
1808 block_marks)) {
1809 return true;
1810 }
1811 }
1812 return false;
1813}
static CompilerState & Current()

◆ GetBlock()

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

Reimplemented from dart::Instruction.

Definition at line 1742 of file il.h.

1742{ return this; }

◆ GetParallelMove()

ParallelMoveInstr * dart::BlockEntryInstr::GetParallelMove ( )
inline

Definition at line 1697 of file il.h.

1697 {
1698 if (parallel_move_ == nullptr) {
1699 parallel_move_ = new ParallelMoveInstr();
1700 }
1701 return parallel_move_;
1702 }

◆ HasNonRedundantParallelMove()

bool dart::BlockEntryInstr::HasNonRedundantParallelMove ( ) const
inline

Definition at line 1693 of file il.h.

1693 {
1694 return HasParallelMove() && !parallel_move()->IsRedundant();
1695 }
ParallelMoveInstr * parallel_move() const
Definition: il.h:1689
bool HasParallelMove() const
Definition: il.h:1691
bool IsRedundant() const
Definition: il.cc:4929

◆ HasParallelMove()

bool dart::BlockEntryInstr::HasParallelMove ( ) const
inline

Definition at line 1691 of file il.h.

1691{ return parallel_move_ != nullptr; }

◆ HasUnknownSideEffects()

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

Implements dart::Instruction.

Reimplemented in dart::JoinEntryInstr.

Definition at line 1728 of file il.h.

1728{ return false; }

◆ ImmediateDominator()

BlockEntryInstr * dart::BlockEntryInstr::ImmediateDominator ( ) const

Definition at line 1826 of file il.cc.

1826 {
1828 if ((last->SuccessorCount() == 1) && (last->SuccessorAt(0) == this)) {
1829 return dominator();
1830 }
1831 return nullptr;
1832}
BlockEntryInstr * dominator() const
Definition: il.h:1670
Instruction * last_instruction() const
Definition: il.h:1686

◆ InsideTryBlock()

bool dart::BlockEntryInstr::InsideTryBlock ( ) const
inline

Definition at line 1734 of file il.h.

1734{ return try_index_ != kInvalidTryIndex; }
static constexpr intptr_t kInvalidTryIndex

◆ instructions()

InstructionsIterable dart::BlockEntryInstr::instructions ( )
inline

Definition at line 1774 of file il.h.

1774{ return InstructionsIterable(this); }

◆ IsLoopHeader()

bool dart::BlockEntryInstr::IsLoopHeader ( ) const

Definition at line 1834 of file il.cc.

1834 {
1835 return loop_info_ != nullptr && loop_info_->header() == this;
1836}
BlockEntryInstr * header() const
Definition: loops.h:252

◆ last_instruction()

Instruction * dart::BlockEntryInstr::last_instruction ( ) const
inline

Definition at line 1686 of file il.h.

1686{ return last_instruction_; }

◆ loop_info()

LoopInfo * dart::BlockEntryInstr::loop_info ( ) const
inline

Definition at line 1737 of file il.h.

1737{ return loop_info_; }

◆ NestingDepth()

intptr_t dart::BlockEntryInstr::NestingDepth ( ) const

Definition at line 1838 of file il.cc.

1838 {
1839 return loop_info_ == nullptr ? 0 : loop_info_->NestingDepth();
1840}
intptr_t NestingDepth() const
Definition: loops.cc:1062

◆ parallel_move()

ParallelMoveInstr * dart::BlockEntryInstr::parallel_move ( ) const
inline

Definition at line 1689 of file il.h.

1689{ return parallel_move_; }

◆ postorder_number()

intptr_t dart::BlockEntryInstr::postorder_number ( ) const
inline

Definition at line 1658 of file il.h.

1658{ return postorder_number_; }

◆ PredecessorAt()

virtual BlockEntryInstr * dart::BlockEntryInstr::PredecessorAt ( intptr_t  index) const
pure virtual

◆ PredecessorCount()

virtual intptr_t dart::BlockEntryInstr::PredecessorCount ( ) const
pure virtual

◆ preorder_number()

intptr_t dart::BlockEntryInstr::preorder_number ( ) const
inline

Definition at line 1655 of file il.h.

1655{ return preorder_number_; }

◆ ReplaceAsPredecessorWith()

void dart::BlockEntryInstr::ReplaceAsPredecessorWith ( BlockEntryInstr new_block)

Definition at line 1847 of file il.cc.

1847 {
1848 // Set the last instruction of the new block to that of the old block.
1849 Instruction* last = last_instruction();
1850 new_block->set_last_instruction(last);
1851 // For each successor, update the predecessors.
1852 for (intptr_t sidx = 0; sidx < last->SuccessorCount(); ++sidx) {
1853 // If the successor is a target, update its predecessor.
1854 TargetEntryInstr* target = last->SuccessorAt(sidx)->AsTargetEntry();
1855 if (target != nullptr) {
1856 target->predecessor_ = new_block;
1857 continue;
1858 }
1859 // If the successor is a join, update each predecessor and the phis.
1860 JoinEntryInstr* join = last->SuccessorAt(sidx)->AsJoinEntry();
1861 ASSERT(join != nullptr);
1862 // Find the old predecessor index.
1863 intptr_t old_index = join->IndexOfPredecessor(this);
1864 intptr_t pred_count = join->PredecessorCount();
1865 ASSERT(old_index >= 0);
1866 ASSERT(old_index < pred_count);
1867 // Find the new predecessor index while reordering the predecessors.
1868 intptr_t new_id = new_block->block_id();
1869 intptr_t new_index = old_index;
1870 if (block_id() < new_id) {
1871 // Search upwards, bubbling down intermediate predecessors.
1872 for (; new_index < pred_count - 1; ++new_index) {
1873 if (join->predecessors_[new_index + 1]->block_id() > new_id) break;
1874 join->predecessors_[new_index] = join->predecessors_[new_index + 1];
1875 }
1876 } else {
1877 // Search downwards, bubbling up intermediate predecessors.
1878 for (; new_index > 0; --new_index) {
1879 if (join->predecessors_[new_index - 1]->block_id() < new_id) break;
1880 join->predecessors_[new_index] = join->predecessors_[new_index - 1];
1881 }
1882 }
1883 join->predecessors_[new_index] = new_block;
1884 // If the new and old predecessor index match there is nothing to update.
1885 if ((join->phis() == nullptr) || (old_index == new_index)) return;
1886 // Otherwise, reorder the predecessor uses in each phi.
1887 for (PhiIterator it(join); !it.Done(); it.Advance()) {
1888 PhiInstr* phi = it.Current();
1889 ASSERT(phi != nullptr);
1890 ASSERT(pred_count == phi->InputCount());
1891 // Save the predecessor use.
1892 Value* pred_use = phi->InputAt(old_index);
1893 // Move uses between old and new.
1894 intptr_t step = (old_index < new_index) ? 1 : -1;
1895 for (intptr_t use_idx = old_index; use_idx != new_index;
1896 use_idx += step) {
1897 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step));
1898 }
1899 // Write the predecessor use.
1900 phi->SetInputAt(new_index, pred_use);
1901 }
1902 }
1903}
static int step(int x, SkScalar min, SkScalar max)
Definition: BlurTest.cpp:215
uint32_t * target

◆ set_block_id()

void dart::BlockEntryInstr::set_block_id ( intptr_t  block_id)
inline

Definition at line 1753 of file il.h.

1753{ block_id_ = block_id; }

◆ set_end_pos()

void dart::BlockEntryInstr::set_end_pos ( intptr_t  pos)
inline

Definition at line 1667 of file il.h.

1667{ end_pos_ = pos; }
SkPoint pos

◆ set_last_instruction()

void dart::BlockEntryInstr::set_last_instruction ( Instruction instr)
inline

Definition at line 1687 of file il.h.

1687{ last_instruction_ = instr; }

◆ set_loop_info()

void dart::BlockEntryInstr::set_loop_info ( LoopInfo loop_info)
inline

Definition at line 1738 of file il.h.

1738{ loop_info_ = loop_info; }
LoopInfo * loop_info() const
Definition: il.h:1737

◆ set_postorder_number()

void dart::BlockEntryInstr::set_postorder_number ( intptr_t  number)
inline

Definition at line 1659 of file il.h.

1659{ postorder_number_ = number; }

◆ set_preorder_number()

void dart::BlockEntryInstr::set_preorder_number ( intptr_t  number)
inline

Definition at line 1656 of file il.h.

1656{ preorder_number_ = number; }

◆ set_stack_depth()

void dart::BlockEntryInstr::set_stack_depth ( intptr_t  s)
inline

Definition at line 1757 of file il.h.

1757{ stack_depth_ = s; }
struct MyStruct s

◆ set_start_pos()

void dart::BlockEntryInstr::set_start_pos ( intptr_t  pos)
inline

Definition at line 1665 of file il.h.

1665{ start_pos_ = pos; }

◆ set_try_index()

void dart::BlockEntryInstr::set_try_index ( intptr_t  index)
inline

Definition at line 1731 of file il.h.

1731{ try_index_ = index; }

◆ stack_depth()

intptr_t dart::BlockEntryInstr::stack_depth ( ) const
inline

Definition at line 1756 of file il.h.

1756{ return stack_depth_; }

◆ start_pos()

intptr_t dart::BlockEntryInstr::start_pos ( ) const
inline

Definition at line 1666 of file il.h.

1666{ return start_pos_; }

◆ token_pos()

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

Reimplemented from dart::Instruction.

Definition at line 1744 of file il.h.

1744 {
1745 return TokenPosition::kControlFlow;
1746 }

◆ try_index()

intptr_t dart::BlockEntryInstr::try_index ( ) const
inline

Definition at line 1730 of file il.h.

1730{ return try_index_; }

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