17 #define DL_NAME "delinearize"
18 #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<ScalarEvolution>();
68 LI = &getAnalysis<LoopInfo>();
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))
95 for (
Loop *L =
LI->getLoopFor(BB); L != NULL; L = L->getParentLoop()) {
103 O <<
"AddRec: " << *AR <<
"\n";
106 const SCEV *Res = AR->delinearize(*SE, Subscripts, Sizes);
107 int Size = Subscripts.
size();
108 if (Res == AR || Size == 0) {
109 O <<
"failed to delinearize\n";
112 O <<
"Base offset: " << *Res <<
"\n";
113 O <<
"ArrayDecl[UnknownSize]";
114 for (
int i = 0; i < Size - 1; i++)
115 O <<
"[" << *Sizes[i] <<
"]";
116 O <<
" with elements of " << *Sizes[Size - 1] <<
" bytes.\n";
119 for (
int i = 0; i < Size; i++)
120 O <<
"[" << *Subscripts[i] <<
"]";
static PassRegistry * getPassRegistry()
The main container class for the LLVM Intermediate Representation.
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
LoopInfoBase< BlockT, LoopT > * LI
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)
ID
LLVM Calling Convention Representation.
void initializeDelinearizationPass(PassRegistry &)
LLVM Basic Block Representation.
FunctionPass * createDelinearizationPass()
static const char delinearization_name[]
INITIALIZE_PASS_BEGIN(Delinearization, DL_NAME, delinearization_name, true, true) FunctionPass *llvm
LLVM Value Representation.
inst_iterator inst_end(Function *F)
const BasicBlock * getParent() const