LLVM API Documentation

llvm::SCEVExpander Struct Reference

#include <ScalarEvolutionExpander.h>

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

List of all members.

Public Member Functions

 SCEVExpander (ScalarEvolution &se, LoopInfo &li)
LoopInfo & getLoopInfo () const
void clear ()
bool isInsertedInstruction (Instruction *I) const
Value * getOrInsertCanonicalInductionVariable (const Loop *L, const Type *Ty)
void addInsertedValue (Instruction *I, SCEV *S)
Instruction * getInsertionPoint () const
Value * expandCodeFor (SCEVHandle SH, Instruction *IP)

Static Public Member Functions

static Value * InsertCastOfTo (Instruction::CastOps opcode, Value *V, const Type *Ty)
static Value * InsertBinop (Instruction::BinaryOps Opcode, Value *LHS, Value *RHS, Instruction *InsertPt)

Public Attributes

ScalarEvolution & SE
LoopInfo & LI
std::map< SCEVHandle, Value * > InsertedExpressions
std::set< Instruction * > InsertedInstructions
Instruction * InsertPt

Protected Member Functions

Value * expand (SCEV *S)
Value * visitConstant (SCEVConstant *S)
Value * visitTruncateExpr (SCEVTruncateExpr *S)
Value * visitZeroExtendExpr (SCEVZeroExtendExpr *S)
Value * visitSignExtendExpr (SCEVSignExtendExpr *S)
Value * visitAddExpr (SCEVAddExpr *S)
Value * visitMulExpr (SCEVMulExpr *S)
Value * visitUDivExpr (SCEVUDivExpr *S)
Value * visitAddRecExpr (SCEVAddRecExpr *S)
Value * visitSMaxExpr (SCEVSMaxExpr *S)
Value * visitUMaxExpr (SCEVUMaxExpr *S)
Value * visitUnknown (SCEVUnknown *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 29 of file ScalarEvolutionExpander.h.


Constructor & Destructor Documentation

llvm::SCEVExpander::SCEVExpander ( ScalarEvolution &  se,
LoopInfo &  li 
) [inline]

Definition at line 39 of file ScalarEvolutionExpander.h.


Member Function Documentation

LoopInfo& llvm::SCEVExpander::getLoopInfo (  )  const [inline]

Definition at line 41 of file ScalarEvolutionExpander.h.

References LI.

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 46 of file ScalarEvolutionExpander.h.

References InsertedExpressions.

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 51 of file ScalarEvolutionExpander.h.

References InsertedInstructions.

Value* llvm::SCEVExpander::getOrInsertCanonicalInductionVariable ( const Loop *  L,
const Type *  Ty 
) [inline]

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 59 of file ScalarEvolutionExpander.h.

References expand(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getIntegerSCEV(), H, llvm::Type::isInteger(), and SE.

Referenced by visitAddRecExpr().

void llvm::SCEVExpander::addInsertedValue ( Instruction *  I,
SCEV *  S 
) [inline]

addInsertedValue - Remember the specified instruction as being the canonical form for the specified SCEV.

Definition at line 68 of file ScalarEvolutionExpander.h.

References InsertedExpressions, and InsertedInstructions.

Instruction* llvm::SCEVExpander::getInsertionPoint (  )  const [inline]

Definition at line 73 of file ScalarEvolutionExpander.h.

References InsertPt.

Value * SCEVExpander::expandCodeFor ( SCEVHandle  SH,
Instruction *  IP 
)

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 278 of file ScalarEvolutionExpander.cpp.

References expand(), and InsertPt.

Value * SCEVExpander::InsertCastOfTo ( Instruction::CastOps  opcode,
Value *  V,
const Type *  Ty 
) [static]

InsertCastOfTo - Insert a cast of V to the specified type, doing what we can to share the casts.

InsertCastOfTo - Insert a cast of V to the specified type, doing what we can to share the casts.

Definition at line 22 of file ScalarEvolutionExpander.cpp.

References A, llvm::CallingConv::C, llvm::CastInst::Create(), E, llvm::ConstantExpr::getCast(), llvm::Value::getName(), II, llvm::Value::use_begin(), and llvm::Value::use_end().

Value * SCEVExpander::InsertBinop ( Instruction::BinaryOps  Opcode,
Value *  LHS,
Value *  RHS,
Instruction *  InsertPt 
) [static]

InsertBinop - Insert the specified binary operator, doing a small amount of work to avoid inserting an obviously redundant operation.

InsertBinop - Insert the specified binary operator, doing a small amount of work to avoid inserting an obviously redundant operation.

Definition at line 75 of file ScalarEvolutionExpander.cpp.

References llvm::BasicBlock::begin(), llvm::BinaryOperator::Create(), llvm::ConstantExpr::get(), and llvm::Instruction::getParent().

Referenced by visitAddExpr(), visitAddRecExpr(), visitMulExpr(), and visitUDivExpr().

Value * SCEVExpander::expand ( SCEV *  S  )  [protected]

Value* llvm::SCEVExpander::visitConstant ( SCEVConstant *  S  )  [inline, protected]

Definition at line 91 of file ScalarEvolutionExpander.h.

References llvm::SCEVConstant::getValue().

Value * SCEVExpander::visitTruncateExpr ( SCEVTruncateExpr *  S  )  [protected]

Value * SCEVExpander::visitZeroExtendExpr ( SCEVZeroExtendExpr *  S  )  [protected]

Value * SCEVExpander::visitSignExtendExpr ( SCEVSignExtendExpr *  S  )  [protected]

Value * SCEVExpander::visitAddExpr ( SCEVAddExpr *  S  )  [protected]

Value * SCEVExpander::visitMulExpr ( SCEVMulExpr *  S  )  [protected]

Value * SCEVExpander::visitUDivExpr ( SCEVUDivExpr *  S  )  [protected]

Value * SCEVExpander::visitAddRecExpr ( SCEVAddRecExpr *  S  )  [protected]

Value * SCEVExpander::visitSMaxExpr ( SCEVSMaxExpr *  S  )  [protected]

Value * SCEVExpander::visitUMaxExpr ( SCEVUMaxExpr *  S  )  [protected]

Value* llvm::SCEVExpander::visitUnknown ( SCEVUnknown *  S  )  [inline, protected]

Definition at line 113 of file ScalarEvolutionExpander.h.

References llvm::SCEVUnknown::getValue().


Friends And Related Function Documentation

friend struct SCEVVisitor< SCEVExpander, Value * > [friend]

Definition at line 37 of file ScalarEvolutionExpander.h.


Member Data Documentation

Definition at line 31 of file ScalarEvolutionExpander.h.

Referenced by getLoopInfo(), and visitAddRecExpr().

Definition at line 32 of file ScalarEvolutionExpander.h.

Referenced by addInsertedValue(), clear(), and expand().

Definition at line 33 of file ScalarEvolutionExpander.h.

Referenced by addInsertedValue(), and isInsertedInstruction().


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