Rename a few more DataLayout variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201833 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-02-21 01:53:35 +00:00
parent f116e5308d
commit eb6e1d3165
8 changed files with 30 additions and 30 deletions

View File

@ -104,7 +104,7 @@ bool NVPTXLowerAggrCopies::runOnFunction(Function &F) {
SmallVector<MemTransferInst *, 4> aggrMemcpys; SmallVector<MemTransferInst *, 4> aggrMemcpys;
SmallVector<MemSetInst *, 4> aggrMemsets; SmallVector<MemSetInst *, 4> aggrMemsets;
DataLayout *TD = &getAnalysis<DataLayout>(); DataLayout *DL = &getAnalysis<DataLayout>();
LLVMContext &Context = F.getParent()->getContext(); LLVMContext &Context = F.getParent()->getContext();
// //
@ -120,7 +120,7 @@ bool NVPTXLowerAggrCopies::runOnFunction(Function &F) {
if (load->hasOneUse() == false) if (load->hasOneUse() == false)
continue; continue;
if (TD->getTypeStoreSize(load->getType()) < MaxAggrCopySize) if (DL->getTypeStoreSize(load->getType()) < MaxAggrCopySize)
continue; continue;
User *use = *(load->use_begin()); User *use = *(load->use_begin());
@ -166,7 +166,7 @@ bool NVPTXLowerAggrCopies::runOnFunction(Function &F) {
StoreInst *store = dyn_cast<StoreInst>(*load->use_begin()); StoreInst *store = dyn_cast<StoreInst>(*load->use_begin());
Value *srcAddr = load->getOperand(0); Value *srcAddr = load->getOperand(0);
Value *dstAddr = store->getOperand(1); Value *dstAddr = store->getOperand(1);
unsigned numLoads = TD->getTypeStoreSize(load->getType()); unsigned numLoads = DL->getTypeStoreSize(load->getType());
Value *len = ConstantInt::get(Type::getInt32Ty(Context), numLoads); Value *len = ConstantInt::get(Type::getInt32Ty(Context), numLoads);
convertTransferToLoop(store, srcAddr, dstAddr, len, load->isVolatile(), convertTransferToLoop(store, srcAddr, dstAddr, len, load->isVolatile(),

View File

@ -109,7 +109,7 @@ namespace {
PPCTargetMachine *TM; PPCTargetMachine *TM;
LoopInfo *LI; LoopInfo *LI;
ScalarEvolution *SE; ScalarEvolution *SE;
DataLayout *TD; DataLayout *DL;
DominatorTree *DT; DominatorTree *DT;
const TargetLibraryInfo *LibInfo; const TargetLibraryInfo *LibInfo;
}; };
@ -171,7 +171,7 @@ bool PPCCTRLoops::runOnFunction(Function &F) {
LI = &getAnalysis<LoopInfo>(); LI = &getAnalysis<LoopInfo>();
SE = &getAnalysis<ScalarEvolution>(); SE = &getAnalysis<ScalarEvolution>();
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
TD = getAnalysisIfAvailable<DataLayout>(); DL = getAnalysisIfAvailable<DataLayout>();
LibInfo = getAnalysisIfAvailable<TargetLibraryInfo>(); LibInfo = getAnalysisIfAvailable<TargetLibraryInfo>();
bool MadeChange = false; bool MadeChange = false;

View File

@ -124,7 +124,7 @@ static void AdjustCallerSSPLevel(Function *Caller, Function *Callee) {
static bool InlineCallIfPossible(CallSite CS, InlineFunctionInfo &IFI, static bool InlineCallIfPossible(CallSite CS, InlineFunctionInfo &IFI,
InlinedArrayAllocasTy &InlinedArrayAllocas, InlinedArrayAllocasTy &InlinedArrayAllocas,
int InlineHistory, bool InsertLifetime, int InlineHistory, bool InsertLifetime,
const DataLayout *TD) { const DataLayout *DL) {
Function *Callee = CS.getCalledFunction(); Function *Callee = CS.getCalledFunction();
Function *Caller = CS.getCaller(); Function *Caller = CS.getCaller();
@ -203,7 +203,7 @@ static bool InlineCallIfPossible(CallSite CS, InlineFunctionInfo &IFI,
// If we don't have data layout information, and only one alloca is using // If we don't have data layout information, and only one alloca is using
// the target default, then we can't safely merge them because we can't // the target default, then we can't safely merge them because we can't
// pick the greater alignment. // pick the greater alignment.
if (!TD && (!Align1 || !Align2) && Align1 != Align2) if (!DL && (!Align1 || !Align2) && Align1 != Align2)
continue; continue;
// The available alloca has to be in the right function, not in some other // The available alloca has to be in the right function, not in some other
@ -225,8 +225,8 @@ static bool InlineCallIfPossible(CallSite CS, InlineFunctionInfo &IFI,
if (Align1 != Align2) { if (Align1 != Align2) {
if (!Align1 || !Align2) { if (!Align1 || !Align2) {
assert(TD && "DataLayout required to compare default alignments"); assert(DL && "DataLayout required to compare default alignments");
unsigned TypeAlign = TD->getABITypeAlignment(AI->getAllocatedType()); unsigned TypeAlign = DL->getABITypeAlignment(AI->getAllocatedType());
Align1 = Align1 ? Align1 : TypeAlign; Align1 = Align1 ? Align1 : TypeAlign;
Align2 = Align2 ? Align2 : TypeAlign; Align2 = Align2 ? Align2 : TypeAlign;
@ -410,7 +410,7 @@ static bool InlineHistoryIncludes(Function *F, int InlineHistoryID,
bool Inliner::runOnSCC(CallGraphSCC &SCC) { bool Inliner::runOnSCC(CallGraphSCC &SCC) {
CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph(); CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
const DataLayout *TD = getAnalysisIfAvailable<DataLayout>(); const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
const TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>(); const TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
SmallPtrSet<Function*, 8> SCCFunctions; SmallPtrSet<Function*, 8> SCCFunctions;
@ -470,7 +470,7 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
InlinedArrayAllocasTy InlinedArrayAllocas; InlinedArrayAllocasTy InlinedArrayAllocas;
InlineFunctionInfo InlineInfo(&CG, TD); InlineFunctionInfo InlineInfo(&CG, DL);
// Now that we have all of the call sites, loop over them and inline them if // Now that we have all of the call sites, loop over them and inline them if
// it looks profitable to do so. // it looks profitable to do so.
@ -519,7 +519,7 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
// Attempt to inline the function. // Attempt to inline the function.
if (!InlineCallIfPossible(CS, InlineInfo, InlinedArrayAllocas, if (!InlineCallIfPossible(CS, InlineInfo, InlinedArrayAllocas,
InlineHistoryID, InsertLifetime, TD)) InlineHistoryID, InsertLifetime, DL))
continue; continue;
++NumInlined; ++NumInlined;

View File

@ -67,7 +67,7 @@ bool ConstantPropagation::runOnFunction(Function &F) {
WorkList.insert(&*i); WorkList.insert(&*i);
} }
bool Changed = false; bool Changed = false;
DataLayout *TD = getAnalysisIfAvailable<DataLayout>(); DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>(); TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
while (!WorkList.empty()) { while (!WorkList.empty()) {
@ -75,7 +75,7 @@ bool ConstantPropagation::runOnFunction(Function &F) {
WorkList.erase(WorkList.begin()); // Get an element from the worklist... WorkList.erase(WorkList.begin()); // Get an element from the worklist...
if (!I->use_empty()) // Don't muck with dead instructions... if (!I->use_empty()) // Don't muck with dead instructions...
if (Constant *C = ConstantFoldInstruction(I, TD, TLI)) { if (Constant *C = ConstantFoldInstruction(I, DL, TLI)) {
// Add all of the users of this instruction to the worklist, they might // Add all of the users of this instruction to the worklist, they might
// be constant propagatable now... // be constant propagatable now...
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();

View File

@ -72,7 +72,7 @@ bool LoopInstSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
getAnalysisIfAvailable<DominatorTreeWrapperPass>(); getAnalysisIfAvailable<DominatorTreeWrapperPass>();
DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0; DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0;
LoopInfo *LI = &getAnalysis<LoopInfo>(); LoopInfo *LI = &getAnalysis<LoopInfo>();
const DataLayout *TD = getAnalysisIfAvailable<DataLayout>(); const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>(); const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
SmallVector<BasicBlock*, 8> ExitBlocks; SmallVector<BasicBlock*, 8> ExitBlocks;
@ -114,7 +114,7 @@ bool LoopInstSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
// Don't bother simplifying unused instructions. // Don't bother simplifying unused instructions.
if (!I->use_empty()) { if (!I->use_empty()) {
Value *V = SimplifyInstruction(I, TD, TLI, DT); Value *V = SimplifyInstruction(I, DL, TLI, DT);
if (V && LI->replacementPreservesLCSSAForm(I, V)) { if (V && LI->replacementPreservesLCSSAForm(I, V)) {
// Mark all uses for resimplification next time round the loop. // Mark all uses for resimplification next time round the loop.
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();

View File

@ -162,7 +162,7 @@ private:
ScatterMap Scattered; ScatterMap Scattered;
GatherList Gathered; GatherList Gathered;
unsigned ParallelLoopAccessMDKind; unsigned ParallelLoopAccessMDKind;
const DataLayout *TDL; const DataLayout *DL;
}; };
char Scalarizer::ID = 0; char Scalarizer::ID = 0;
@ -240,7 +240,7 @@ bool Scalarizer::doInitialization(Module &M) {
} }
bool Scalarizer::runOnFunction(Function &F) { bool Scalarizer::runOnFunction(Function &F) {
TDL = getAnalysisIfAvailable<DataLayout>(); DL = getAnalysisIfAvailable<DataLayout>();
for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) { for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) {
BasicBlock *BB = BBI; BasicBlock *BB = BBI;
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;) { for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;) {
@ -333,7 +333,7 @@ void Scalarizer::transferMetadata(Instruction *Op, const ValueVector &CV) {
// the alignment of the vector, or 0 if the ABI default should be used. // the alignment of the vector, or 0 if the ABI default should be used.
bool Scalarizer::getVectorLayout(Type *Ty, unsigned Alignment, bool Scalarizer::getVectorLayout(Type *Ty, unsigned Alignment,
VectorLayout &Layout) { VectorLayout &Layout) {
if (!TDL) if (!DL)
return false; return false;
// Make sure we're dealing with a vector. // Make sure we're dealing with a vector.
@ -343,15 +343,15 @@ bool Scalarizer::getVectorLayout(Type *Ty, unsigned Alignment,
// Check that we're dealing with full-byte elements. // Check that we're dealing with full-byte elements.
Layout.ElemTy = Layout.VecTy->getElementType(); Layout.ElemTy = Layout.VecTy->getElementType();
if (TDL->getTypeSizeInBits(Layout.ElemTy) != if (DL->getTypeSizeInBits(Layout.ElemTy) !=
TDL->getTypeStoreSizeInBits(Layout.ElemTy)) DL->getTypeStoreSizeInBits(Layout.ElemTy))
return false; return false;
if (Alignment) if (Alignment)
Layout.VecAlign = Alignment; Layout.VecAlign = Alignment;
else else
Layout.VecAlign = TDL->getABITypeAlignment(Layout.VecTy); Layout.VecAlign = DL->getABITypeAlignment(Layout.VecTy);
Layout.ElemSize = TDL->getTypeStoreSize(Layout.ElemTy); Layout.ElemSize = DL->getTypeStoreSize(Layout.ElemTy);
return true; return true;
} }

View File

@ -145,7 +145,7 @@ static bool mergeEmptyReturnBlocks(Function &F) {
/// iterativelySimplifyCFG - Call SimplifyCFG on all the blocks in the function, /// iterativelySimplifyCFG - Call SimplifyCFG on all the blocks in the function,
/// iterating until no more changes are made. /// iterating until no more changes are made.
static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI, static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI,
const DataLayout *TD) { const DataLayout *DL) {
bool Changed = false; bool Changed = false;
bool LocalChange = true; bool LocalChange = true;
while (LocalChange) { while (LocalChange) {
@ -154,7 +154,7 @@ static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI,
// Loop over all of the basic blocks and remove them if they are unneeded... // Loop over all of the basic blocks and remove them if they are unneeded...
// //
for (Function::iterator BBIt = F.begin(); BBIt != F.end(); ) { for (Function::iterator BBIt = F.begin(); BBIt != F.end(); ) {
if (SimplifyCFG(BBIt++, TTI, TD)) { if (SimplifyCFG(BBIt++, TTI, DL)) {
LocalChange = true; LocalChange = true;
++NumSimpl; ++NumSimpl;
} }
@ -172,10 +172,10 @@ bool CFGSimplifyPass::runOnFunction(Function &F) {
return false; return false;
const TargetTransformInfo &TTI = getAnalysis<TargetTransformInfo>(); const TargetTransformInfo &TTI = getAnalysis<TargetTransformInfo>();
const DataLayout *TD = getAnalysisIfAvailable<DataLayout>(); const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
bool EverChanged = removeUnreachableBlocks(F); bool EverChanged = removeUnreachableBlocks(F);
EverChanged |= mergeEmptyReturnBlocks(F); EverChanged |= mergeEmptyReturnBlocks(F);
EverChanged |= iterativelySimplifyCFG(F, TTI, TD); EverChanged |= iterativelySimplifyCFG(F, TTI, DL);
// If neither pass changed anything, we're done. // If neither pass changed anything, we're done.
if (!EverChanged) return false; if (!EverChanged) return false;
@ -189,7 +189,7 @@ bool CFGSimplifyPass::runOnFunction(Function &F) {
return true; return true;
do { do {
EverChanged = iterativelySimplifyCFG(F, TTI, TD); EverChanged = iterativelySimplifyCFG(F, TTI, DL);
EverChanged |= removeUnreachableBlocks(F); EverChanged |= removeUnreachableBlocks(F);
} while (EverChanged); } while (EverChanged);

View File

@ -48,7 +48,7 @@ namespace {
const DominatorTreeWrapperPass *DTWP = const DominatorTreeWrapperPass *DTWP =
getAnalysisIfAvailable<DominatorTreeWrapperPass>(); getAnalysisIfAvailable<DominatorTreeWrapperPass>();
const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0; const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0;
const DataLayout *TD = getAnalysisIfAvailable<DataLayout>(); const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>(); const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
SmallPtrSet<const Instruction*, 8> S1, S2, *ToSimplify = &S1, *Next = &S2; SmallPtrSet<const Instruction*, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
bool Changed = false; bool Changed = false;
@ -65,7 +65,7 @@ namespace {
continue; continue;
// Don't waste time simplifying unused instructions. // Don't waste time simplifying unused instructions.
if (!I->use_empty()) if (!I->use_empty())
if (Value *V = SimplifyInstruction(I, TD, TLI, DT)) { if (Value *V = SimplifyInstruction(I, DL, TLI, DT)) {
// Mark all uses for resimplification next time round the loop. // Mark all uses for resimplification next time round the loop.
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();
UI != UE; ++UI) UI != UE; ++UI)