diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index 86473900f7c..a923f8344cf 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -498,6 +498,12 @@ Pass *createLoopSimplifyCFGPass(); // FunctionPass *createLoopVersioningPass(); +//===----------------------------------------------------------------------===// +// +// LoopDataPrefetch - Perform data prefetching in loops. +// +FunctionPass *createLoopDataPrefetchPass(); + } // End llvm namespace #endif diff --git a/lib/Target/PowerPC/CMakeLists.txt b/lib/Target/PowerPC/CMakeLists.txt index c31ababafbe..e8316e937cb 100644 --- a/lib/Target/PowerPC/CMakeLists.txt +++ b/lib/Target/PowerPC/CMakeLists.txt @@ -24,7 +24,6 @@ add_llvm_target(PowerPCCodeGen PPCEarlyReturn.cpp PPCFastISel.cpp PPCFrameLowering.cpp - PPCLoopDataPrefetch.cpp PPCLoopPreIncPrep.cpp PPCMCInstLower.cpp PPCMachineFunctionInfo.cpp diff --git a/lib/Target/PowerPC/PPC.h b/lib/Target/PowerPC/PPC.h index a259ed3fd32..a4235fa6e04 100644 --- a/lib/Target/PowerPC/PPC.h +++ b/lib/Target/PowerPC/PPC.h @@ -34,7 +34,6 @@ namespace llvm { #ifndef NDEBUG FunctionPass *createPPCCTRLoopsVerify(); #endif - FunctionPass *createPPCLoopDataPrefetchPass(); FunctionPass *createPPCLoopPreIncPrepPass(PPCTargetMachine &TM); FunctionPass *createPPCTOCRegDepsPass(); FunctionPass *createPPCEarlyReturnPass(); diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index d24b590317f..230f2f9c5f2 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -313,7 +313,7 @@ void PPCPassConfig::addIRPasses() { if (EnablePrefetch.getNumOccurrences() > 0) UsePrefetching = EnablePrefetch; if (UsePrefetching) - addPass(createPPCLoopDataPrefetchPass()); + addPass(createLoopDataPrefetchPass()); if (TM->getOptLevel() == CodeGenOpt::Aggressive && EnableGEPOpt) { // Call SeparateConstOffsetFromGEP pass to extract constants within indices diff --git a/lib/Transforms/Scalar/CMakeLists.txt b/lib/Transforms/Scalar/CMakeLists.txt index e25ac8ed87b..2684cee838f 100644 --- a/lib/Transforms/Scalar/CMakeLists.txt +++ b/lib/Transforms/Scalar/CMakeLists.txt @@ -17,6 +17,7 @@ add_llvm_library(LLVMScalarOpts LICM.cpp LoadCombine.cpp LoopDeletion.cpp + LoopDataPrefetch.cpp LoopDistribute.cpp LoopIdiomRecognize.cpp LoopInstSimplify.cpp diff --git a/lib/Target/PowerPC/PPCLoopDataPrefetch.cpp b/lib/Transforms/Scalar/LoopDataPrefetch.cpp similarity index 97% rename from lib/Target/PowerPC/PPCLoopDataPrefetch.cpp rename to lib/Transforms/Scalar/LoopDataPrefetch.cpp index e687a6d3d57..0edceec8e13 100644 --- a/lib/Target/PowerPC/PPCLoopDataPrefetch.cpp +++ b/lib/Transforms/Scalar/LoopDataPrefetch.cpp @@ -1,4 +1,4 @@ -//===-------- PPCLoopDataPrefetch.cpp - Loop Data Prefetching Pass --------===// +//===-------- LoopDataPrefetch.cpp - Loop Data Prefetching Pass -----------===// // // The LLVM Compiler Infrastructure // @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "loop-data-prefetch" -#include "PPC.h" #include "llvm/Transforms/Scalar.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" @@ -91,7 +90,7 @@ INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) INITIALIZE_PASS_END(LoopDataPrefetch, "loop-data-prefetch", "Loop Data Prefetch", false, false) -FunctionPass *llvm::createPPCLoopDataPrefetchPass() { return new LoopDataPrefetch(); } +FunctionPass *llvm::createLoopDataPrefetchPass() { return new LoopDataPrefetch(); } bool LoopDataPrefetch::runOnFunction(Function &F) { LI = &getAnalysis().getLoopInfo();