llvm.org GIT mirror llvm / 87825e7
Add the function "vectorizeBasicBlock" which allow users vectorize a BasicBlock in other passes, e.g. we can call vectorizeBasicBlock in the loop unroll pass right after the loop is unrolled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154089 91177308-0d34-0410-b5e6-96231b3b80d8 Hongbin Zheng 8 years ago
2 changed file(s) with 32 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1515 #define LLVM_TRANSFORMS_VECTORIZE_H
1616
1717 namespace llvm {
18
18 class BasicBlock;
1919 class BasicBlockPass;
2020
2121 //===----------------------------------------------------------------------===//
2424 //
2525 BasicBlockPass *createBBVectorizePass();
2626
27 //===----------------------------------------------------------------------===//
28 /// @brief Vectorize the BasicBlock.
29 ///
30 /// @param BB The BasicBlock to be vectorized
31 /// @param P The current running pass, should require AliasAnalysis and
32 /// ScalarEvolution. After the vectorization, AliasAnalysis,
33 /// ScalarEvolution and CFG are preserved.
34 ///
35 /// @return True if the BB is changed, false otherwise.
36 ///
37 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB);
38
2739 } // End llvm namespace
2840
2941 #endif
143143 initializeBBVectorizePass(*PassRegistry::getPassRegistry());
144144 }
145145
146 BBVectorize(Pass *P) : BasicBlockPass(ID) {
147 AA = &P->getAnalysis();
148 SE = &P->getAnalysis();
149 TD = P->getAnalysisIfAvailable();
150 }
151
146152 typedef std::pair ValuePair;
147153 typedef std::pair ValuePairWithDepth;
148154 typedef std::pair VPPair; // A ValuePair pair
279285 Instruction *&InsertionPt,
280286 Instruction *I, Instruction *J);
281287
282 virtual bool runOnBasicBlock(BasicBlock &BB) {
283 AA = &getAnalysis();
284 SE = &getAnalysis();
285 TD = getAnalysisIfAvailable();
286
288 bool vectorizeBB(BasicBlock &BB) {
287289 bool changed = false;
288290 // Iterate a sufficient number of times to merge types of size 1 bit,
289291 // then 2 bits, then 4, etc. up to half of the target vector width of the
301303
302304 DEBUG(dbgs() << "BBV: done!\n");
303305 return changed;
306 }
307
308 virtual bool runOnBasicBlock(BasicBlock &BB) {
309 AA = &getAnalysis();
310 SE = &getAnalysis();
311 TD = getAnalysisIfAvailable();
312
313 return vectorizeBB(BB);
304314 }
305315
306316 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
18601870 return new BBVectorize();
18611871 }
18621872
1873 bool llvm::vectorizeBasicBlock(Pass *P, BasicBlock &BB) {
1874 BBVectorize BBVectorizer(P);
1875 return BBVectorizer.vectorizeBB(BB);
1876 }