LLVM API Documentation

ScalarEvolutionExpander.cpp File Reference

#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/LLVMContext.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/STLExtras.h"

Include dependency graph for ScalarEvolutionExpander.cpp:

Go to the source code of this file.

Functions

static bool FactorOutConstant (const SCEV *&S, const SCEV *&Remainder, const SCEV *Factor, ScalarEvolution &SE, const TargetData *TD)
static void SimplifyAddOperands (SmallVectorImpl< const SCEV * > &Ops, const Type *Ty, ScalarEvolution &SE)
static void SplitAddRecs (SmallVectorImpl< const SCEV * > &Ops, const Type *Ty, ScalarEvolution &SE)
static void ExposePointerBase (const SCEV *&Base, const SCEV *&Rest, ScalarEvolution &SE)


Function Documentation

static void ExposePointerBase ( const SCEV *&  Base,
const SCEV *&  Rest,
ScalarEvolution &  SE 
) [static]

Move parts of Base into Rest to leave Base with the minimal expression that provides a pointer operand suitable for a GEP expansion.

Definition at line 571 of file ScalarEvolutionExpander.cpp.

References A, llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), and llvm::ScalarEvolution::getIntegerSCEV().

static bool FactorOutConstant ( const SCEV *&  S,
const SCEV *&  Remainder,
const SCEV *  Factor,
ScalarEvolution &  SE,
const TargetData *  TD 
) [static]

FactorOutConstant - Test if S is divisible by Factor, using signed division. If so, update S with Factor divided out and return true. S need not be evenly divisble if a reasonable remainder can be computed. TODO: When ScalarEvolution gets a SCEVSDivExpr, this can be made unnecessary; in its place, just signed-divide Ops[i] by the scale and check to see if the divide was folded.

Definition at line 158 of file ScalarEvolutionExpander.cpp.

References A, llvm::SmallVectorImpl< T >::begin(), llvm::CallingConv::C, llvm::SmallVectorImpl< T >::end(), llvm::ConstantInt::get(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getConstant(), llvm::ScalarEvolution::getContext(), llvm::ScalarEvolution::getIntegerSCEV(), llvm::ScalarEvolution::getMulExpr(), llvm::SCEV::getType(), llvm::ConstantInt::getValue(), llvm::SCEVConstant::getValue(), llvm::SCEV::isOne(), llvm::SCEV::isZero(), llvm::ConstantInt::isZero(), M, and Start.

static void SimplifyAddOperands ( SmallVectorImpl< const SCEV * > &  Ops,
const Type *  Ty,
ScalarEvolution &  SE 
) [static]

SimplifyAddOperands - Sort and simplify a list of add operands. NumAddRecs is the number of SCEVAddRecExprs present, which are kept at the end of the list.

Definition at line 259 of file ScalarEvolutionExpander.cpp.

References llvm::SmallVectorImpl< T >::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorImpl< T >::end(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getIntegerSCEV(), llvm::SmallVectorImpl< T >::insert(), llvm::SmallVectorImpl< T >::push_back(), and llvm::SmallVectorImpl< T >::size().

Referenced by SplitAddRecs().

static void SplitAddRecs ( SmallVectorImpl< const SCEV * > &  Ops,
const Type *  Ty,
ScalarEvolution &  SE 
) [static]

SplitAddRecs - Flatten a list of add operands, moving addrec start values out to the top level. For example, convert {a + b,+,c} to a, b, {0,+,d}. This helps expose more opportunities for folding parts of the expressions into GEP indices.

Definition at line 290 of file ScalarEvolutionExpander.cpp.

References A, llvm::SmallVectorImpl< T >::begin(), llvm::SmallVectorImpl< T >::empty(), llvm::SmallVectorImpl< T >::end(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getIntegerSCEV(), llvm::SmallVectorImpl< T >::insert(), llvm::SCEV::isZero(), llvm::SmallVectorImpl< T >::push_back(), SimplifyAddOperands(), llvm::SmallVectorImpl< T >::size(), and Start.