[llvm-commits] [polly] r151904 - /polly/trunk/lib/CodeGeneration.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Fri Mar 2 03:27:18 PST 2012
Author: grosser
Date: Fri Mar 2 05:27:18 2012
New Revision: 151904
URL: http://llvm.org/viewvc/llvm-project?rev=151904&view=rev
Log:
CodeGen: Extract code into the new function copyVectorInstruction
Modified:
polly/trunk/lib/CodeGeneration.cpp
Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=151904&r1=151903&r2=151904&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Fri Mar 2 05:27:18 2012
@@ -266,6 +266,8 @@
bool isVectorBlock();
+ void copyVectorInstruction(const Instruction *Inst, ValueMapT &VectorMap,
+ VectorValueMapT &ScalarMaps);
void copyInstruction(const Instruction *Inst, ValueMapT &VectorMap,
VectorValueMapT &ScalarMaps);
@@ -659,41 +661,47 @@
return getVectorWidth() > 1;
}
-void BlockGenerator::copyInstruction(const Instruction *Inst,
- ValueMapT &VectorMap,
- VectorValueMapT &ScalarMaps) {
- // Terminator instructions control the control flow. They are explicitly
- // expressed in the clast and do not need to be copied.
- if (Inst->isTerminator())
+void BlockGenerator::copyVectorInstruction(const Instruction *Inst,
+ ValueMapT &VectorMap,
+ VectorValueMapT &ScalarMaps) {
+ if (const LoadInst *Load = dyn_cast<LoadInst>(Inst)) {
+ generateVectorLoad(Load, VectorMap, ScalarMaps);
return;
+ }
- if (isVectorBlock()) {
- if (const LoadInst *Load = dyn_cast<LoadInst>(Inst)) {
- generateVectorLoad(Load, VectorMap, ScalarMaps);
+ if (hasVectorOperands(Inst, VectorMap)) {
+ if (const StoreInst *Store = dyn_cast<StoreInst>(Inst)) {
+ copyVectorStore(Store, ScalarMaps[0], VectorMap, ScalarMaps);
return;
}
- if (hasVectorOperands(Inst, VectorMap)) {
- if (const StoreInst *Store = dyn_cast<StoreInst>(Inst)) {
- copyVectorStore(Store, ScalarMaps[0], VectorMap, ScalarMaps);
- return;
- }
+ if (const UnaryInstruction *Unary = dyn_cast<UnaryInstruction>(Inst)) {
+ copyVectorUnaryInst(Unary, ScalarMaps[0], VectorMap);
+ return;
+ }
- if (const UnaryInstruction *Unary = dyn_cast<UnaryInstruction>(Inst)) {
- copyVectorUnaryInst(Unary, ScalarMaps[0], VectorMap);
- return;
- }
+ if (const BinaryOperator *Binary = dyn_cast<BinaryOperator>(Inst)) {
+ copyVectorBinInst(Binary, ScalarMaps[0], VectorMap);
+ return;
+ }
- if (const BinaryOperator *Binary = dyn_cast<BinaryOperator>(Inst)) {
- copyVectorBinInst(Binary, ScalarMaps[0], VectorMap);
- return;
- }
+ llvm_unreachable("Cannot issue vector code for this instruction");
+ }
- llvm_unreachable("Cannot issue vector code for this instruction");
- }
+ for (int VectorLane = 0; VectorLane < getVectorWidth(); VectorLane++)
+ copyInstScalar(Inst, ScalarMaps[VectorLane]);
+}
+
+void BlockGenerator::copyInstruction(const Instruction *Inst,
+ ValueMapT &VectorMap,
+ VectorValueMapT &ScalarMaps) {
+ // Terminator instructions control the control flow. They are explicitly
+ // expressed in the clast and do not need to be copied.
+ if (Inst->isTerminator())
+ return;
- for (int VectorLane = 0; VectorLane < getVectorWidth(); VectorLane++)
- copyInstScalar(Inst, ScalarMaps[VectorLane]);
+ if (isVectorBlock()) {
+ copyVectorInstruction(Inst, VectorMap, ScalarMaps);
return;
}
More information about the llvm-commits
mailing list