LLVM API Documentation

llvm::SCEVExpander Struct Reference

#include <ScalarEvolutionExpander.h>

Inheritance diagram for llvm::SCEVExpander:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SCEVExpander (ScalarEvolution &se, LoopInfo &li)
LoopInfogetLoopInfo () const
void clear ()
bool isInsertedInstruction (Instruction *I) const
ValuegetOrInsertCanonicalInductionVariable (const Loop *L, const Type *Ty)
void addInsertedValue (Instruction *I, SCEV *S)
ValueexpandCodeFor (SCEVHandle SH, Instruction *IP, const Type *Ty=0)

Static Public Member Functions

static ValueInsertCastOfTo (Value *V, const Type *Ty)

Public Attributes

ScalarEvolutionSE
LoopInfoLI
std::map< SCEVHandle, Value * > InsertedExpressions
std::set< Instruction * > InsertedInstructions
InstructionInsertPt

Protected Member Functions

Valueexpand (SCEV *S)
ValueexpandInTy (SCEV *S, const Type *Ty)
ValuevisitConstant (SCEVConstant *S)
ValuevisitTruncateExpr (SCEVTruncateExpr *S)
ValuevisitZeroExtendExpr (SCEVZeroExtendExpr *S)
ValuevisitAddExpr (SCEVAddExpr *S)
ValuevisitMulExpr (SCEVMulExpr *S)
ValuevisitSDivExpr (SCEVSDivExpr *S)
ValuevisitAddRecExpr (SCEVAddRecExpr *S)
ValuevisitUnknown (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 destroying it when finished to allow the release of the associated memory.

Definition at line 32 of file ScalarEvolutionExpander.h.


Constructor & Destructor Documentation

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

Definition at line 42 of file ScalarEvolutionExpander.h.


Member Function Documentation

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

Definition at line 44 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 49 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 54 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 62 of file ScalarEvolutionExpander.h.

References expand(), llvm::SCEVAddRecExpr::get(), llvm::SCEVUnknown::getIntegerSCEV(), H, llvm::Type::isFloatingPoint(), llvm::Type::isInteger(), and Ty.

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

References InsertedExpressions, and InsertedInstructions.

Value* llvm::SCEVExpander::expandCodeFor ( SCEVHandle  SH,
Instruction IP,
const Type Ty = 0 
) [inline]

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

If a particular value sign is required, a type may be specified for the result.

Definition at line 83 of file ScalarEvolutionExpander.h.

References expandInTy(), InsertPt, and Ty.

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

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, C, E, llvm::ConstantExpr::getCast(), II, Ty, and V.

Referenced by expandInTy().

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

Definition at line 94 of file ScalarEvolutionExpander.h.

References InsertedExpressions, V, and llvm::SCEVVisitor< SC, RetVal >::visit().

Referenced by expandInTy(), getOrInsertCanonicalInductionVariable(), and visitTruncateExpr().

Value* llvm::SCEVExpander::expandInTy ( SCEV S,
const Type Ty 
) [inline, protected]

Definition at line 105 of file ScalarEvolutionExpander.h.

References expand(), InsertCastOfTo(), Ty, and V.

Referenced by expandCodeFor(), visitAddExpr(), visitAddRecExpr(), visitMulExpr(), visitSDivExpr(), and visitZeroExtendExpr().

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

Definition at line 112 of file ScalarEvolutionExpander.h.

References llvm::SCEVConstant::getValue().

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

Definition at line 116 of file ScalarEvolutionExpander.h.

References expand(), llvm::SCEVTruncateExpr::getOperand(), llvm::SCEVTruncateExpr::getType(), InsertPt, and V.

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

Definition at line 121 of file ScalarEvolutionExpander.h.

References expandInTy(), llvm::SCEVZeroExtendExpr::getOperand(), llvm::SCEVZeroExtendExpr::getType(), llvm::Type::getUnsignedVersion(), InsertPt, and V.

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

Definition at line 126 of file ScalarEvolutionExpander.h.

References expandInTy(), llvm::SCEVCommutativeExpr::getNumOperands(), llvm::SCEVCommutativeExpr::getOperand(), llvm::SCEVCommutativeExpr::getType(), InsertPt, Ty, and V.

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

Definition at line 71 of file ScalarEvolutionExpander.cpp.

References llvm::BinaryOperator::createNeg(), expandInTy(), llvm::SCEVCommutativeExpr::getNumOperands(), llvm::SCEVCommutativeExpr::getOperand(), llvm::SCEVCommutativeExpr::getType(), InsertPt, Ty, and V.

Value* llvm::SCEVExpander::visitSDivExpr ( SCEVSDivExpr S  )  [inline, protected]

Definition at line 139 of file ScalarEvolutionExpander.h.

References expandInTy(), llvm::SCEVSDivExpr::getLHS(), llvm::SCEVSDivExpr::getRHS(), llvm::SCEVSDivExpr::getType(), InsertPt, and Ty.

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

Definition at line 91 of file ScalarEvolutionExpander.cpp.

References llvm::PHINode::addIncoming(), llvm::Loop::contains(), llvm::SCEVAddRecExpr::evaluateAtIteration(), expandInTy(), F, llvm::SCEVUnknown::get(), llvm::ConstantInt::get(), llvm::ConstantFP::get(), llvm::SCEVAddRecExpr::get(), llvm::Loop::getHeader(), llvm::SCEVUnknown::getIntegerSCEV(), llvm::SCEVAddRecExpr::getLoop(), llvm::LoopInfo::getLoopFor(), llvm::Loop::getLoopPreheader(), llvm::Constant::getNullValue(), llvm::SCEVAddRecExpr::getNumOperands(), llvm::SCEVAddRecExpr::getOperand(), getOrInsertCanonicalInductionVariable(), llvm::Instruction::getParent(), llvm::Loop::getParentLoop(), llvm::SCEVAddRecExpr::getStart(), llvm::BasicBlock::getTerminator(), llvm::SCEVAddRecExpr::getType(), InsertPt, llvm::Type::isIntegral(), llvm::Loop::isLoopInvariant(), LI, llvm::SCEVAddRecExpr::op_begin(), llvm::SCEVAddRecExpr::op_end(), PI, llvm::pred_begin(), llvm::pred_end(), Ty, and V.

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

Definition at line 148 of file ScalarEvolutionExpander.h.

References llvm::SCEVUnknown::getValue().


Friends And Related Function Documentation

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

Definition at line 40 of file ScalarEvolutionExpander.h.


Member Data Documentation

ScalarEvolution& llvm::SCEVExpander::SE

Definition at line 33 of file ScalarEvolutionExpander.h.

LoopInfo& llvm::SCEVExpander::LI

Definition at line 34 of file ScalarEvolutionExpander.h.

Referenced by getLoopInfo(), and visitAddRecExpr().

std::map<SCEVHandle, Value*> llvm::SCEVExpander::InsertedExpressions

Definition at line 35 of file ScalarEvolutionExpander.h.

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

std::set<Instruction*> llvm::SCEVExpander::InsertedInstructions

Definition at line 36 of file ScalarEvolutionExpander.h.

Referenced by addInsertedValue(), and isInsertedInstruction().

Instruction* llvm::SCEVExpander::InsertPt

Definition at line 38 of file ScalarEvolutionExpander.h.

Referenced by expandCodeFor(), visitAddExpr(), visitAddRecExpr(), visitMulExpr(), visitSDivExpr(), visitTruncateExpr(), and visitZeroExtendExpr().


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