35 #define DL_NAME "delinearize"
36 #define DEBUG_TYPE DL_NAME
41 Delinearization(
const Delinearization &);
60 void Delinearization::getAnalysisUsage(
AnalysisUsage &AU)
const {
66 bool Delinearization::runOnFunction(
Function &
F) {
68 SE = &getAnalysis<ScalarEvolution>();
69 LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
75 return Load->getPointerOperand();
77 return Store->getPointerOperand();
79 return Gep->getPointerOperand();
84 O <<
"Delinearization on function " <<
F->getName() <<
":\n";
89 if (!isa<StoreInst>(Inst) && !isa<LoadInst>(Inst) &&
90 !isa<GetElementPtrInst>(Inst))
104 AccessFn = SE->getMinusSCEV(AccessFn, BasePointer);
113 O <<
"Inst:" << *Inst <<
"\n";
114 O <<
"In Loop with Header: " << L->getHeader()->getName() <<
"\n";
115 O <<
"AddRec: " << *AR <<
"\n";
118 SE->delinearize(AR, Subscripts, Sizes, SE->getElementSize(Inst));
119 if (Subscripts.
size() == 0 || Sizes.
size() == 0 ||
120 Subscripts.
size() != Sizes.
size()) {
121 O <<
"failed to delinearize\n";
125 O <<
"Base offset: " << *BasePointer <<
"\n";
126 O <<
"ArrayDecl[UnknownSize]";
127 int Size = Subscripts.
size();
128 for (
int i = 0; i < Size - 1; i++)
129 O <<
"[" << *Sizes[i] <<
"]";
130 O <<
" with elements of " << *Sizes[Size - 1] <<
" bytes.\n";
133 for (
int i = 0; i < Size; i++)
134 O <<
"[" << *Subscripts[i] <<
"]";
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A Module instance is used to store all the information related to an LLVM module. ...
ScalarEvolution - This class is the main scalar evolution driver.
LoopT * getParentLoop() const
LoadInst - an instruction for reading from memory.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
static Value * getPointerOperand(Instruction &Inst)
inst_iterator inst_begin(Function *F)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
SCEVAddRecExpr - This node represents a polynomial recurrence on the trip count of the specified loop...
StoreInst - an instruction for storing to memory.
void initializeDelinearizationPass(PassRegistry &)
GetElementPtrInst - an instruction for type-safe pointer arithmetic to access elements of arrays and ...
SCEVUnknown - This means that we are dealing with an entirely unknown SCEV value, and only represent ...
LLVM Basic Block Representation.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
FunctionPass * createDelinearizationPass()
void setPreservesAll()
Set by analyses that do not transform their input at all.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static const char delinearization_name[]
SCEV - This class represents an analyzed expression in the program.
INITIALIZE_PASS_BEGIN(Delinearization, DL_NAME, delinearization_name, true, true) FunctionPass *llvm
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
The legacy pass manager's analysis pass to compute loop information.
inst_iterator inst_end(Function *F)
const BasicBlock * getParent() const