summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-01-07 09:57:00 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-01-07 09:57:00 +0000
commitcf8814f9753b0757ac74d736587b551da82cf9b0 (patch)
tree83ea6758451204897c1e15b7bf64fa72e973e1f7
parentd12aae6c0535bd2713207ef84b7098f905a89b78 (diff)
downloadllvm-cf8814f9753b0757ac74d736587b551da82cf9b0.tar.gz
llvm-cf8814f9753b0757ac74d736587b551da82cf9b0.tar.bz2
llvm-cf8814f9753b0757ac74d736587b551da82cf9b0.tar.xz
Fix a slew of indentation and parameter naming style issues. This 80% of
this patch brought to you by the tool clang-format. I wanted to fix up the names of constructor parameters because they followed a bit of an anti-pattern by naming initialisms with CamelCase: 'Tti', 'Se', etc. This appears to have been in an attempt to not overlap with the names of member variables 'TTI', 'SE', etc. However, constructor arguments can very safely alias members, and in fact that's the conventional way to pass in members. I've fixed all of these I saw, along with making some strang abbreviations such as 'Lp' be simpler 'L', or 'Lgl' be the word 'Legal'. However, the code I was touching had indentation and formatting somewhat all over the map. So I ran clang-format and fixed them. I also fixed a few other formatting or doxygen formatting issues such as using ///< on trailing comments so they are associated with the correct entry. There is still a lot of room for improvement of the formating and cleanliness of this code. ;] At least a few parts of the coding standards or common practices in LLVM's code aren't followed, the enum naming rules jumped out at me. I may mix some of these while I'm here, but not all of them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171719 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.h78
1 files changed, 36 insertions, 42 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.h b/lib/Transforms/Vectorize/LoopVectorize.h
index 324d425302..60426ad844 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.h
+++ b/lib/Transforms/Vectorize/LoopVectorize.h
@@ -94,13 +94,12 @@ class TargetTransformInfo;
/// and reduction variables that were found to a given vectorization factor.
class InnerLoopVectorizer {
public:
- /// Ctor.
- InnerLoopVectorizer(Loop *Orig, ScalarEvolution *Se, LoopInfo *Li,
- DominatorTree *Dt, DataLayout *Dl,
- unsigned VecWidth, unsigned UnrollFactor):
- OrigLoop(Orig), SE(Se), LI(Li), DT(Dt), DL(Dl), VF(VecWidth),
- UF(UnrollFactor), Builder(Se->getContext()), Induction(0), OldInduction(0),
- WidenMap(UnrollFactor) { }
+ InnerLoopVectorizer(Loop *OrigLoop, ScalarEvolution *SE, LoopInfo *LI,
+ DominatorTree *DT, DataLayout *DL, unsigned VecWidth,
+ unsigned UnrollFactor)
+ : OrigLoop(OrigLoop), SE(SE), LI(LI), DT(DT), DL(DL), VF(VecWidth),
+ UF(UnrollFactor), Builder(SE->getContext()), Induction(0),
+ OldInduction(0), WidenMap(UnrollFactor) {}
// Perform the actual loop widening (vectorization).
void vectorize(LoopVectorizationLegality *Legal) {
@@ -192,9 +191,9 @@ private:
/// save value in 'Val'.
/// \return A reference to a vector with splat values.
VectorParts &splat(Value *Key, Value *Val) {
- MapStoreage[Key].clear();
- MapStoreage[Key].append(UF, Val);
- return MapStoreage[Key];
+ MapStoreage[Key].clear();
+ MapStoreage[Key].append(UF, Val);
+ return MapStoreage[Key];
}
///\return A reference to the value that is stored at 'Key'.
@@ -273,37 +272,35 @@ private:
/// induction variable and the different reduction variables.
class LoopVectorizationLegality {
public:
- LoopVectorizationLegality(Loop *Lp, ScalarEvolution *Se, DataLayout *Dl,
- DominatorTree *Dt):
- TheLoop(Lp), SE(Se), DL(Dl), DT(Dt), Induction(0) { }
+ LoopVectorizationLegality(Loop *L, ScalarEvolution *SE, DataLayout *DL,
+ DominatorTree *DT)
+ : TheLoop(L), SE(SE), DL(DL), DT(DT), Induction(0) {}
/// This enum represents the kinds of reductions that we support.
enum ReductionKind {
- NoReduction, /// Not a reduction.
- IntegerAdd, /// Sum of numbers.
- IntegerMult, /// Product of numbers.
- IntegerOr, /// Bitwise or logical OR of numbers.
- IntegerAnd, /// Bitwise or logical AND of numbers.
- IntegerXor /// Bitwise or logical XOR of numbers.
+ NoReduction, ///< Not a reduction.
+ IntegerAdd, ///< Sum of numbers.
+ IntegerMult, ///< Product of numbers.
+ IntegerOr, ///< Bitwise or logical OR of numbers.
+ IntegerAnd, ///< Bitwise or logical AND of numbers.
+ IntegerXor ///< Bitwise or logical XOR of numbers.
};
/// This enum represents the kinds of inductions that we support.
enum InductionKind {
- NoInduction, /// Not an induction variable.
- IntInduction, /// Integer induction variable. Step = 1.
- ReverseIntInduction, /// Reverse int induction variable. Step = -1.
- PtrInduction /// Pointer induction variable. Step = sizeof(elem).
+ NoInduction, ///< Not an induction variable.
+ IntInduction, ///< Integer induction variable. Step = 1.
+ ReverseIntInduction, ///< Reverse int induction variable. Step = -1.
+ PtrInduction ///< Pointer induction variable. Step = sizeof(elem).
};
/// This POD struct holds information about reduction variables.
struct ReductionDescriptor {
- // Default C'tor
- ReductionDescriptor():
- StartValue(0), LoopExitInstr(0), Kind(NoReduction) {}
+ ReductionDescriptor() : StartValue(0), LoopExitInstr(0), Kind(NoReduction) {
+ }
- // C'tor.
- ReductionDescriptor(Value *Start, Instruction *Exit, ReductionKind K):
- StartValue(Start), LoopExitInstr(Exit), Kind(K) {}
+ ReductionDescriptor(Value *Start, Instruction *Exit, ReductionKind K)
+ : StartValue(Start), LoopExitInstr(Exit), Kind(K) {}
// The starting value of the reduction.
// It does not have to be zero!
@@ -317,7 +314,7 @@ public:
// This POD struct holds information about the memory runtime legality
// check that a group of pointers do not overlap.
struct RuntimePointerCheck {
- RuntimePointerCheck(): Need(false) {}
+ RuntimePointerCheck() : Need(false) {}
/// Reset the state of the pointer runtime information.
void reset() {
@@ -342,10 +339,8 @@ public:
/// A POD for saving information about induction variables.
struct InductionInfo {
- /// Ctors.
- InductionInfo(Value *Start, InductionKind K):
- StartValue(Start), IK(K) {};
- InductionInfo(): StartValue(0), IK(NoInduction) {};
+ InductionInfo(Value *Start, InductionKind K) : StartValue(Start), IK(K) {}
+ InductionInfo() : StartValue(0), IK(NoInduction) {}
/// Start value.
Value *StartValue;
/// Induction kind.
@@ -366,7 +361,7 @@ public:
bool canVectorize();
/// Returns the Induction variable.
- PHINode *getInduction() {return Induction;}
+ PHINode *getInduction() { return Induction; }
/// Returns the reduction variables found in the loop.
ReductionList *getReductionVars() { return &Reductions; }
@@ -395,10 +390,10 @@ public:
bool isUniform(Value *V);
/// Returns true if this instruction will remain scalar after vectorization.
- bool isUniformAfterVectorization(Instruction* I) {return Uniforms.count(I);}
+ bool isUniformAfterVectorization(Instruction* I) { return Uniforms.count(I); }
/// Returns the information that we collected about runtime memory check.
- RuntimePointerCheck *getRuntimePointerCheck() {return &PtrRtCheck; }
+ RuntimePointerCheck *getRuntimePointerCheck() { return &PtrRtCheck; }
private:
/// Check if a single basic block loop is vectorizable.
/// At this point we know that this is a loop with a constant trip count
@@ -475,11 +470,10 @@ private:
/// different operations.
class LoopVectorizationCostModel {
public:
- /// C'tor.
- LoopVectorizationCostModel(Loop *Lp, ScalarEvolution *Se, LoopInfo *Li,
- LoopVectorizationLegality *Leg,
- const TargetTransformInfo *Tti):
- TheLoop(Lp), SE(Se), LI(Li), Legal(Leg), TTI(Tti) { }
+ LoopVectorizationCostModel(Loop *L, ScalarEvolution *SE, LoopInfo *LI,
+ LoopVectorizationLegality *Legal,
+ const TargetTransformInfo *TTI)
+ : TheLoop(L), SE(SE), LI(LI), Legal(Legal), TTI(TTI) {}
/// \return The most profitable vectorization factor.
/// This method checks every power of two up to VF. If UserVF is not ZERO