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.

llvm-svn: 171719
This commit is contained in:
Chandler Carruth 2013-01-07 09:57:00 +00:00
parent df9a2bbcb1
commit 04ece8623e
1 changed files with 36 additions and 42 deletions

View File

@ -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) {
@ -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!
@ -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.
@ -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