34 #define DL_NAME "delinearize"
35 #define DEBUG_TYPE DL_NAME
40 Delinearization(
const Delinearization &);
59 void Delinearization::getAnalysisUsage(
AnalysisUsage &AU)
const {
65 bool Delinearization::runOnFunction(
Function &
F) {
67 SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
68 LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
74 return Load->getPointerOperand();
76 return Store->getPointerOperand();
78 return Gep->getPointerOperand();
83 O <<
"Delinearization on function " <<
F->getName() <<
":\n";
88 if (!isa<StoreInst>(Inst) && !isa<LoadInst>(Inst) &&
89 !isa<GetElementPtrInst>(Inst))
103 AccessFn = SE->getMinusSCEV(AccessFn, BasePointer);
106 O <<
"Inst:" << *Inst <<
"\n";
107 O <<
"In Loop with Header: " <<
L->
getHeader()->getName() <<
"\n";
108 O <<
"AccessFunction: " << *AccessFn <<
"\n";
111 SE->delinearize(AccessFn, Subscripts, Sizes, SE->getElementSize(Inst));
112 if (Subscripts.
size() == 0 || Sizes.
size() == 0 ||
113 Subscripts.
size() != Sizes.
size()) {
114 O <<
"failed to delinearize\n";
118 O <<
"Base offset: " << *BasePointer <<
"\n";
119 O <<
"ArrayDecl[UnknownSize]";
120 int Size = Subscripts.
size();
121 for (
int i = 0;
i < Size - 1;
i++)
122 O <<
"[" << *Sizes[
i] <<
"]";
123 O <<
" with elements of " << *Sizes[Size - 1] <<
" bytes.\n";
126 for (
int i = 0;
i < Size;
i++)
127 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. ...
The main scalar evolution driver.
LoopT * getParentLoop() const
An instruction for reading from memory.
BlockT * getHeader() const
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
static Value * getPointerOperand(Instruction &Inst)
inst_iterator inst_begin(Function *F)
An instruction for storing to memory.
void initializeDelinearizationPass(PassRegistry &)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
This means that we are dealing with an entirely unknown SCEV value, and only represent it as its LLVM...
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.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
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.
static const char delinearization_name[]
This class represents an analyzed expression in the program.
Represents a single loop in the control flow graph.
INITIALIZE_PASS_BEGIN(Delinearization, DL_NAME, delinearization_name, true, true) FunctionPass *llvm
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
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