forked from OSchip/llvm-project
parent
14f4c3e9fa
commit
1f11b44939
|
@ -60,12 +60,13 @@ inline raw_ostream &operator<<(raw_ostream &OS, const BBCond &Cond) {
|
|||
//===----------------------------------------------------------------------===//
|
||||
// TempScop implementation
|
||||
TempScop::~TempScop() {
|
||||
if (MayASInfo) delete MayASInfo;
|
||||
if (MayASInfo)
|
||||
delete MayASInfo;
|
||||
}
|
||||
|
||||
void TempScop::print(raw_ostream &OS, ScalarEvolution *SE, LoopInfo *LI) const {
|
||||
OS << "Scop: " << R.getNameStr() << ", Max Loop Depth: "<< MaxLoopDepth
|
||||
<< "\n";
|
||||
OS << "Scop: " << R.getNameStr() << ", Max Loop Depth: " << MaxLoopDepth
|
||||
<< "\n";
|
||||
|
||||
printDetail(OS, SE, LI, &R, 0);
|
||||
}
|
||||
|
@ -95,19 +96,17 @@ void TempScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB) {
|
|||
|
||||
const SCEV *AccessFunction = SE->getSCEV(getPointerOperand(Inst));
|
||||
const SCEVUnknown *BasePointer =
|
||||
dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFunction));
|
||||
dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFunction));
|
||||
|
||||
assert(BasePointer && "Could not find base pointer");
|
||||
AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
|
||||
|
||||
bool IsAffine = isAffineExpr(&R, AccessFunction, *SE,
|
||||
BasePointer->getValue());
|
||||
bool IsAffine =
|
||||
isAffineExpr(&R, AccessFunction, *SE, BasePointer->getValue());
|
||||
|
||||
Functions.push_back(std::make_pair(IRAccess(Type,
|
||||
BasePointer->getValue(),
|
||||
AccessFunction, Size,
|
||||
IsAffine),
|
||||
&Inst));
|
||||
Functions.push_back(
|
||||
std::make_pair(IRAccess(Type, BasePointer->getValue(), AccessFunction,
|
||||
Size, IsAffine), &Inst));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,8 +121,8 @@ void TempScopInfo::buildLoopBounds(TempScop &Scop) {
|
|||
Region &R = Scop.getMaxRegion();
|
||||
unsigned MaxLoopDepth = 0;
|
||||
|
||||
for (Region::block_iterator I = R.block_begin(), E = R.block_end();
|
||||
I != E; ++I) {
|
||||
for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
|
||||
++I) {
|
||||
Loop *L = LI->getLoopFor(*I);
|
||||
|
||||
if (!L || !R.contains(L))
|
||||
|
@ -228,8 +227,8 @@ void TempScopInfo::buildCondition(BasicBlock *BB, BasicBlock *RegionEntry) {
|
|||
TempScop *TempScopInfo::buildTempScop(Region &R) {
|
||||
TempScop *TScop = new TempScop(R, LoopBounds, BBConds, AccFuncMap);
|
||||
|
||||
for (Region::block_iterator I = R.block_begin(), E = R.block_end();
|
||||
I != E; ++I) {
|
||||
for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
|
||||
++I) {
|
||||
buildAccessFunctions(R, **I);
|
||||
buildCondition(*I, R.getEntry());
|
||||
}
|
||||
|
@ -246,9 +245,10 @@ TempScop *TempScopInfo::getTempScop(const Region *R) const {
|
|||
return at == TempScops.end() ? 0 : at->second;
|
||||
}
|
||||
|
||||
void TempScopInfo::print(raw_ostream &OS, const Module *) const {
|
||||
void TempScopInfo::print(raw_ostream &OS, const Module *)const {
|
||||
for (TempScopMapType::const_iterator I = TempScops.begin(),
|
||||
E = TempScops.end(); I != E; ++I)
|
||||
E = TempScops.end();
|
||||
I != E; ++I)
|
||||
I->second->print(OS, SE, LI);
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ bool TempScopInfo::runOnFunction(Function &F) {
|
|||
TD = &getAnalysis<DataLayout>();
|
||||
|
||||
for (ScopDetection::iterator I = SD->begin(), E = SD->end(); I != E; ++I) {
|
||||
Region *R = const_cast<Region*>(*I);
|
||||
Region *R = const_cast<Region *>(*I);
|
||||
TempScops.insert(std::make_pair(R, buildTempScop(*R)));
|
||||
}
|
||||
|
||||
|
@ -281,9 +281,7 @@ void TempScopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||
AU.setPreservesAll();
|
||||
}
|
||||
|
||||
TempScopInfo::~TempScopInfo() {
|
||||
clear();
|
||||
}
|
||||
TempScopInfo::~TempScopInfo() { clear(); }
|
||||
|
||||
void TempScopInfo::clear() {
|
||||
BBConds.clear();
|
||||
|
|
Loading…
Reference in New Issue