LLVM API Documentation
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
Go to the source code of this file.
Namespaces | |
namespace | llvm |
List of target independent CodeGen pass IDs. | |
Functions | |
static bool | FactorOutConstant (const SCEV *&S, const SCEV *&Remainder, const SCEV *Factor, ScalarEvolution &SE, const DataLayout *DL) |
static void | SimplifyAddOperands (SmallVectorImpl< const SCEV * > &Ops, Type *Ty, ScalarEvolution &SE) |
static void | SplitAddRecs (SmallVectorImpl< const SCEV * > &Ops, Type *Ty, ScalarEvolution &SE) |
static const Loop * | PickMostRelevantLoop (const Loop *A, const Loop *B, DominatorTree &DT) |
static void | ExposePointerBase (const SCEV *&Base, const SCEV *&Rest, ScalarEvolution &SE) |
static void | hoistBeforePos (DominatorTree *DT, Instruction *InstToHoist, Instruction *Pos, PHINode *LoopPhi) |
Hoist the addrec instruction chain rooted in the loop phi above the position. This routine assumes that this is possible (has been checked). | |
static bool | canBeCheaplyTransformed (ScalarEvolution &SE, const SCEVAddRecExpr *Phi, const SCEVAddRecExpr *Requested, bool &InvertStep) |
Check whether we can cheaply express the requested SCEV in terms of the available PHI SCEV by truncation and/or invertion of the step. | |
bool | llvm::isSafeToExpand (const SCEV *S, ScalarEvolution &SE) |
static bool canBeCheaplyTransformed | ( | ScalarEvolution & | SE, |
const SCEVAddRecExpr * | Phi, | ||
const SCEVAddRecExpr * | Requested, | ||
bool & | InvertStep | ||
) | [static] |
Check whether we can cheaply express the requested SCEV in terms of the available PHI SCEV by truncation and/or invertion of the step.
Definition at line 1035 of file ScalarEvolutionExpander.cpp.
References llvm::dyn_cast(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getEffectiveSCEVType(), llvm::Type::getIntegerBitWidth(), llvm::ScalarEvolution::getNegativeSCEV(), llvm::SCEVAddRecExpr::getStart(), llvm::ScalarEvolution::getTruncateOrNoop(), and llvm::SCEVNAryExpr::getType().
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 833 of file ScalarEvolutionExpander.cpp.
References llvm::ARM_PROC::A, llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SCEV::FlagNW, llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), and llvm::ScalarEvolution::getConstant().
static bool FactorOutConstant | ( | const SCEV *& | S, |
const SCEV *& | Remainder, | ||
const SCEV * | Factor, | ||
ScalarEvolution & | SE, | ||
const DataLayout * | DL | ||
) | [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 divisible 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 207 of file ScalarEvolutionExpander.cpp.
References llvm::ARM_PROC::A, llvm::CallingConv::C, R600_InstFlag::FC, llvm::SCEV::FlagNW, llvm::ConstantInt::get(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getConstant(), llvm::ScalarEvolution::getContext(), llvm::ScalarEvolution::getMulExpr(), llvm::SCEV::getType(), llvm::SCEVConstant::getValue(), llvm::ConstantInt::getValue(), llvm::SCEV::isOne(), llvm::SCEV::isZero(), and llvm::ConstantInt::isZero().
static void hoistBeforePos | ( | DominatorTree * | DT, |
Instruction * | InstToHoist, | ||
Instruction * | Pos, | ||
PHINode * | LoopPhi | ||
) | [static] |
Hoist the addrec instruction chain rooted in the loop phi above the position. This routine assumes that this is possible (has been checked).
Definition at line 1020 of file ScalarEvolutionExpander.cpp.
References llvm::DominatorTree::dominates(), llvm::User::getOperand(), and llvm::Instruction::moveBefore().
static const Loop* PickMostRelevantLoop | ( | const Loop * | A, |
const Loop * | B, | ||
DominatorTree & | DT | ||
) | [static] |
PickMostRelevantLoop - Given two loops pick the one that's most relevant for SCEV expansion. If they are nested, this is the most nested. If they are neighboring, pick the later.
Definition at line 615 of file ScalarEvolutionExpander.cpp.
References llvm::ARM_PROC::A, llvm::LoopBase< BlockT, LoopT >::contains(), llvm::DominatorTree::dominates(), and llvm::LoopBase< BlockT, LoopT >::getHeader().
static void SimplifyAddOperands | ( | SmallVectorImpl< const SCEV * > & | Ops, |
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 305 of file ScalarEvolutionExpander.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getConstant(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by SplitAddRecs().
static void SplitAddRecs | ( | SmallVectorImpl< const SCEV * > & | Ops, |
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 334 of file ScalarEvolutionExpander.cpp.
References llvm::ARM_PROC::A, llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SCEV::FlagNW, llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getConstant(), llvm::SCEV::isZero(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), SimplifyAddOperands(), and llvm::SmallVectorTemplateCommon< T, typename >::size().