LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Friends | List of all members
llvm::SCEVExpander Class Reference

#include <ScalarEvolutionExpander.h>

Inheritance diagram for llvm::SCEVExpander:
Inheritance graph
[legend]
Collaboration diagram for llvm::SCEVExpander:
Collaboration graph
[legend]

Public Member Functions

 SCEVExpander (ScalarEvolution &se, const char *name)
 SCEVExpander - Construct a SCEVExpander in "canonical" mode. More...
 
void setDebugType (const char *s)
 
void clear ()
 
PHINodegetOrInsertCanonicalInductionVariable (const Loop *L, Type *Ty)
 
InstructiongetIVIncOperand (Instruction *IncV, Instruction *InsertPos, bool allowScale)
 getIVIncOperand - Return the induction variable increment's IV operand. More...
 
bool hoistIVInc (Instruction *IncV, Instruction *InsertPos)
 hoistIVInc - Utility for hoisting an IV increment. More...
 
unsigned replaceCongruentIVs (Loop *L, const DominatorTree *DT, SmallVectorImpl< WeakVH > &DeadInsts, const TargetTransformInfo *TTI=NULL)
 
ValueexpandCodeFor (const SCEV *SH, Type *Ty, Instruction *I)
 
void setIVIncInsertPos (const Loop *L, Instruction *Pos)
 setIVIncInsertPos - Set the current IV increment loop and position. More...
 
void setPostInc (const PostIncLoopSet &L)
 
void clearPostInc ()
 clearPostInc - Disable all post-inc expansion. More...
 
void disableCanonicalMode ()
 
void enableLSRMode ()
 
void clearInsertPoint ()
 
bool isInsertedInstruction (Instruction *I) const
 
void setChainedPhi (PHINode *PN)
 
- Public Member Functions inherited from llvm::SCEVVisitor< SCEVExpander, Value * >
Valuevisit (const SCEV *S)
 
ValuevisitCouldNotCompute (const SCEVCouldNotCompute *S)
 

Friends

struct SCEVVisitor< SCEVExpander, Value * >
 

Detailed Description

SCEVExpander - This class uses information about analyze scalars to rewrite expressions in canonical form.

Clients should create an instance of this class when rewriting is needed, and destroy it when finished to allow the release of the associated memory.

Definition at line 37 of file ScalarEvolutionExpander.h.

Constructor & Destructor Documentation

llvm::SCEVExpander::SCEVExpander ( ScalarEvolution se,
const char *  name 
)
inlineexplicit

SCEVExpander - Construct a SCEVExpander in "canonical" mode.

Definition at line 94 of file ScalarEvolutionExpander.h.

Member Function Documentation

void llvm::SCEVExpander::clear ( )
inline

clear - Erase the contents of the InsertedExpressions map so that users trying to expand the same expression into multiple BasicBlocks or different places within the same BasicBlock can do so.

Definition at line 110 of file ScalarEvolutionExpander.h.

void llvm::SCEVExpander::clearInsertPoint ( )
inline

clearInsertPoint - Clear the current insertion point. This is useful if the instruction that had been serving as the insertion point may have been deleted.

Definition at line 177 of file ScalarEvolutionExpander.h.

References llvm::IRBuilderBase::ClearInsertionPoint().

void llvm::SCEVExpander::clearPostInc ( )
inline

clearPostInc - Disable all post-inc expansion.

Definition at line 159 of file ScalarEvolutionExpander.h.

References llvm::SmallPtrSetImpl::clear().

void llvm::SCEVExpander::disableCanonicalMode ( )
inline

disableCanonicalMode - Disable the behavior of expanding expressions in canonical form rather than in a more literal form. Non-canonical mode is useful for late optimization passes.

Definition at line 170 of file ScalarEvolutionExpander.h.

void llvm::SCEVExpander::enableLSRMode ( )
inline

Definition at line 172 of file ScalarEvolutionExpander.h.

Value * SCEVExpander::expandCodeFor ( const SCEV SH,
Type Ty,
Instruction I 
)

expandCodeFor - Insert code to directly compute the specified SCEV expression into the program. The inserted code is inserted into the specified block.

Definition at line 1468 of file ScalarEvolutionExpander.cpp.

References llvm::Instruction::getParent(), and llvm::IRBuilderBase::SetInsertPoint().

Referenced by genLoopLimit(), and getOrInsertCanonicalInductionVariable().

Instruction * SCEVExpander::getIVIncOperand ( Instruction IncV,
Instruction InsertPos,
bool  allowScale 
)

getIVIncOperand - Return the induction variable increment's IV operand.

getIVIncOperand returns an induction variable increment's induction variable operand.

If allowScale is set, any type of GEP is allowed as long as the nonIV operands dominate InsertPos.

If allowScale is not set, ensure that a GEP increment conforms to one of the simple patterns generated by getAddRecExprPHILiterally and expandAddtoGEP. If the pattern isn't recognized, return NULL.

Definition at line 893 of file ScalarEvolutionExpander.cpp.

References llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::ScalarEvolution::getContext(), llvm::Type::getInt1PtrTy(), llvm::Type::getInt8PtrTy(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), I, llvm::User::op_begin(), and llvm::User::op_end().

Referenced by hoistIVInc().

PHINode * SCEVExpander::getOrInsertCanonicalInductionVariable ( const Loop L,
Type Ty 
)

getOrInsertCanonicalInductionVariable - This method returns the canonical induction variable of the specified type for the specified loop (inserting one if there is none). A canonical induction variable starts at zero and steps by one on each iteration.

Definition at line 1549 of file ScalarEvolutionExpander.cpp.

References expandCodeFor(), llvm::SCEV::FlagAnyWrap, llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getConstant(), llvm::LoopBase< N, M >::getHeader(), H, and llvm::Type::isIntegerTy().

bool SCEVExpander::hoistIVInc ( Instruction IncV,
Instruction InsertPos 
)

hoistIVInc - Utility for hoisting an IV increment.

hoistStep - Attempt to hoist a simple IV increment above InsertPos to make it available to other uses in this loop. Recursively hoist any operands, until we reach a value that dominates InsertPos.

Definition at line 944 of file ScalarEvolutionExpander.cpp.

References llvm::DominatorTree::dominates(), getIVIncOperand(), llvm::Instruction::getParent(), I, llvm::Instruction::moveBefore(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::rbegin(), and llvm::SmallVectorTemplateCommon< T >::rend().

Referenced by replaceCongruentIVs().

bool llvm::SCEVExpander::isInsertedInstruction ( Instruction I) const
inline

isInsertedInstruction - Return true if the specified instruction was inserted by the code rewriter. If so, the client should not modify the instruction.

Definition at line 184 of file ScalarEvolutionExpander.h.

unsigned SCEVExpander::replaceCongruentIVs ( Loop L,
const DominatorTree DT,
SmallVectorImpl< WeakVH > &  DeadInsts,
const TargetTransformInfo TTI = NULL 
)
void llvm::SCEVExpander::setChainedPhi ( PHINode PN)
inline

Definition at line 188 of file ScalarEvolutionExpander.h.

void llvm::SCEVExpander::setDebugType ( const char *  s)
inline

Definition at line 104 of file ScalarEvolutionExpander.h.

void llvm::SCEVExpander::setIVIncInsertPos ( const Loop L,
Instruction Pos 
)
inline

setIVIncInsertPos - Set the current IV increment loop and position.

Definition at line 142 of file ScalarEvolutionExpander.h.

void llvm::SCEVExpander::setPostInc ( const PostIncLoopSet L)
inline

setPostInc - Enable post-inc expansion for addrecs referring to the given loops. Post-inc expansion is only supported in non-canonical mode.

Definition at line 152 of file ScalarEvolutionExpander.h.

Friends And Related Function Documentation

friend struct SCEVVisitor< SCEVExpander, Value * >
friend

Definition at line 90 of file ScalarEvolutionExpander.h.


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