LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
llvm::SplitAnalysis Class Reference

SplitAnalysis - Analyze a LiveInterval, looking for live range splitting opportunities. More...

#include "CodeGen/SplitKit.h"

Classes

struct  BlockInfo
 Additional information about basic blocks where the current variable is live. More...
 

Public Types

using BlockPtrSet = SmallPtrSet< const MachineBasicBlock *, 16 >
 

Public Member Functions

 SplitAnalysis (const VirtRegMap &vrm, const LiveIntervals &lis, const MachineLoopInfo &mli)
 
void analyze (const LiveInterval *li)
 analyze - set CurLI to the specified interval, and analyze how it may be split.
 
void clear ()
 clear - clear all data structures so SplitAnalysis is ready to analyze a new interval.
 
const LiveIntervalgetParent () const
 getParent - Return the last analyzed interval.
 
bool isOriginalEndpoint (SlotIndex Idx) const
 isOriginalEndpoint - Return true if the original live range was killed or (re-)defined at Idx.
 
ArrayRef< SlotIndexgetUseSlots () const
 getUseSlots - Return an array of SlotIndexes of instructions using CurLI.
 
ArrayRef< BlockInfogetUseBlocks () const
 getUseBlocks - Return an array of BlockInfo objects for the basic blocks where CurLI has uses.
 
unsigned getNumThroughBlocks () const
 getNumThroughBlocks - Return the number of through blocks.
 
bool isThroughBlock (unsigned MBB) const
 isThroughBlock - Return true if CurLI is live through MBB without uses.
 
const BitVectorgetThroughBlocks () const
 getThroughBlocks - Return the set of through blocks.
 
unsigned getNumLiveBlocks () const
 getNumLiveBlocks - Return the number of blocks where CurLI is live.
 
bool looksLikeLoopIV () const
 
unsigned countLiveBlocks (const LiveInterval *li) const
 countLiveBlocks - Return the number of blocks where li is live.
 
bool shouldSplitSingleBlock (const BlockInfo &BI, bool SingleInstrs) const
 shouldSplitSingleBlock - Returns true if it would help to create a local live range for the instructions in BI.
 
SlotIndex getLastSplitPoint (unsigned Num)
 
SlotIndex getLastSplitPoint (MachineBasicBlock *BB)
 
MachineBasicBlock::iterator getLastSplitPointIter (MachineBasicBlock *BB)
 
SlotIndex getFirstSplitPoint (unsigned Num)
 

Public Attributes

const MachineFunctionMF
 
const VirtRegMapVRM
 
const LiveIntervalsLIS
 
const MachineLoopInfoLoops
 
const TargetInstrInfoTII
 

Detailed Description

SplitAnalysis - Analyze a LiveInterval, looking for live range splitting opportunities.

Definition at line 96 of file SplitKit.h.

Member Typedef Documentation

◆ BlockPtrSet

Definition at line 223 of file SplitKit.h.

Constructor & Destructor Documentation

◆ SplitAnalysis()

SplitAnalysis::SplitAnalysis ( const VirtRegMap vrm,
const LiveIntervals lis,
const MachineLoopInfo mli 
)

Definition at line 154 of file SplitKit.cpp.

Member Function Documentation

◆ analyze()

void SplitAnalysis::analyze ( const LiveInterval li)

analyze - set CurLI to the specified interval, and analyze how it may be split.

Definition at line 347 of file SplitKit.cpp.

References clear().

◆ clear()

void SplitAnalysis::clear ( )

clear - clear all data structures so SplitAnalysis is ready to analyze a new interval.

Definition at line 159 of file SplitKit.cpp.

References llvm::BitVector::clear(), and llvm::SmallVectorImpl< T >::clear().

Referenced by analyze().

◆ countLiveBlocks()

unsigned SplitAnalysis::countLiveBlocks ( const LiveInterval li) const

countLiveBlocks - Return the number of blocks where li is live.

This is guaranteed to return the same number as getNumLiveBlocks() after calling analyze(li).

Definition at line 309 of file SplitKit.cpp.

References llvm::LiveRange::advanceTo(), llvm::LiveRange::begin(), llvm::LiveRange::empty(), llvm::LiveRange::end(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::LiveIntervals::getMBBEndIdx(), llvm::LiveIntervals::getMBBFromIndex(), and LIS.

◆ getFirstSplitPoint()

SlotIndex llvm::SplitAnalysis::getFirstSplitPoint ( unsigned  Num)
inline

◆ getLastSplitPoint() [1/2]

SlotIndex llvm::SplitAnalysis::getLastSplitPoint ( MachineBasicBlock BB)
inline

Definition at line 239 of file SplitKit.h.

References llvm::InsertPointAnalysis::getLastInsertPoint().

◆ getLastSplitPoint() [2/2]

SlotIndex llvm::SplitAnalysis::getLastSplitPoint ( unsigned  Num)
inline

◆ getLastSplitPointIter()

MachineBasicBlock::iterator llvm::SplitAnalysis::getLastSplitPointIter ( MachineBasicBlock BB)
inline

◆ getNumLiveBlocks()

unsigned llvm::SplitAnalysis::getNumLiveBlocks ( ) const
inline

getNumLiveBlocks - Return the number of blocks where CurLI is live.

Definition at line 212 of file SplitKit.h.

◆ getNumThroughBlocks()

unsigned llvm::SplitAnalysis::getNumThroughBlocks ( ) const
inline

getNumThroughBlocks - Return the number of through blocks.

Definition at line 203 of file SplitKit.h.

◆ getParent()

const LiveInterval & llvm::SplitAnalysis::getParent ( ) const
inline

getParent - Return the last analyzed interval.

Definition at line 185 of file SplitKit.h.

◆ getThroughBlocks()

const BitVector & llvm::SplitAnalysis::getThroughBlocks ( ) const
inline

getThroughBlocks - Return the set of through blocks.

Definition at line 209 of file SplitKit.h.

◆ getUseBlocks()

ArrayRef< BlockInfo > llvm::SplitAnalysis::getUseBlocks ( ) const
inline

getUseBlocks - Return an array of BlockInfo objects for the basic blocks where CurLI has uses.

Definition at line 200 of file SplitKit.h.

◆ getUseSlots()

ArrayRef< SlotIndex > llvm::SplitAnalysis::getUseSlots ( ) const
inline

getUseSlots - Return an array of SlotIndexes of instructions using CurLI.

This include both use and def operands, at most one entry per instruction.

Definition at line 196 of file SplitKit.h.

◆ isOriginalEndpoint()

bool SplitAnalysis::isOriginalEndpoint ( SlotIndex  Idx) const

isOriginalEndpoint - Return true if the original live range was killed or (re-)defined at Idx.

Idx should be the 'def' slot for a normal kill/def, and 'use' for an early-clobber def. This can be used to recognize code inserted by earlier live range splitting.

Definition at line 333 of file SplitKit.cpp.

References assert(), llvm::LiveRange::begin(), llvm::LiveRange::empty(), llvm::LiveRange::end(), llvm::LiveRange::find(), llvm::LiveIntervals::getInterval(), llvm::VirtRegMap::getOriginal(), I, Idx, LIS, llvm::LiveInterval::reg(), and VRM.

Referenced by shouldSplitSingleBlock().

◆ isThroughBlock()

bool llvm::SplitAnalysis::isThroughBlock ( unsigned  MBB) const
inline

isThroughBlock - Return true if CurLI is live through MBB without uses.

Definition at line 206 of file SplitKit.h.

References MBB, and llvm::BitVector::test().

◆ looksLikeLoopIV()

bool llvm::SplitAnalysis::looksLikeLoopIV ( ) const
inline

Definition at line 216 of file SplitKit.h.

◆ shouldSplitSingleBlock()

bool SplitAnalysis::shouldSplitSingleBlock ( const BlockInfo BI,
bool  SingleInstrs 
) const

shouldSplitSingleBlock - Returns true if it would help to create a local live range for the instructions in BI.

There is normally no benefit to creating a live range for a single instruction, but it does enable register class inflation if the instruction has a restricted register class.

Parameters
BIThe block to be isolated.
SingleInstrsTrue when single instructions should be isolated.

Definition at line 1587 of file SplitKit.cpp.

References llvm::SplitAnalysis::BlockInfo::FirstInstr, llvm::LiveIntervals::getInstructionFromIndex(), llvm::TargetInstrInfo::isCopyInstr(), llvm::SplitAnalysis::BlockInfo::isOneInstr(), isOriginalEndpoint(), LIS, llvm::SplitAnalysis::BlockInfo::LiveIn, llvm::SplitAnalysis::BlockInfo::LiveOut, MI, and TII.

Member Data Documentation

◆ LIS

const LiveIntervals& llvm::SplitAnalysis::LIS

Definition at line 100 of file SplitKit.h.

Referenced by countLiveBlocks(), isOriginalEndpoint(), and shouldSplitSingleBlock().

◆ Loops

const MachineLoopInfo& llvm::SplitAnalysis::Loops

Definition at line 101 of file SplitKit.h.

◆ MF

const MachineFunction& llvm::SplitAnalysis::MF

Definition at line 98 of file SplitKit.h.

◆ TII

const TargetInstrInfo& llvm::SplitAnalysis::TII

Definition at line 102 of file SplitKit.h.

Referenced by shouldSplitSingleBlock().

◆ VRM

const VirtRegMap& llvm::SplitAnalysis::VRM

Definition at line 99 of file SplitKit.h.

Referenced by isOriginalEndpoint().


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