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