Refactor: Use positive field names in VectorizeConfig.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hongbin Zheng 2012-04-07 03:56:23 +00:00
parent 847307a35b
commit 86312cc15f
2 changed files with 27 additions and 25 deletions

View File

@ -28,23 +28,23 @@ struct VectorizeConfig {
/// @brief The size of the native vector registers. /// @brief The size of the native vector registers.
unsigned VectorBits; unsigned VectorBits;
/// @brief Don't try to vectorize integer values. /// @brief Vectorize integer values.
bool NoInts; bool VectorizeInts;
/// @brief Don't try to vectorize floating-point values. /// @brief Vectorize floating-point values.
bool NoFloats; bool VectorizeFloats;
/// @brief Don't try to vectorize casting (conversion) operations. /// @brief Vectorize casting (conversion) operations.
bool NoCasts; bool VectorizeCasts;
/// @brief Don't try to vectorize floating-point math intrinsics. /// @brief Vectorize floating-point math intrinsics.
bool NoMath; bool VectorizeMath;
/// @brief Don't try to vectorize the fused-multiply-add intrinsic. /// @brief Vectorize the fused-multiply-add intrinsic.
bool NoFMA; bool VectorizeFMA;
/// @brief Don't try to vectorize loads and stores. /// @brief Vectorize loads and stores.
bool NoMemOps; bool VectorizeMemOps;
/// @brief Only generate aligned loads and stores. /// @brief Only generate aligned loads and stores.
bool AlignedOnly; bool AlignedOnly;

View File

@ -437,9 +437,9 @@ namespace {
case Intrinsic::exp: case Intrinsic::exp:
case Intrinsic::exp2: case Intrinsic::exp2:
case Intrinsic::pow: case Intrinsic::pow:
return !Config.NoMath; return Config.VectorizeMath;
case Intrinsic::fma: case Intrinsic::fma:
return !Config.NoFMA; return Config.VectorizeFMA;
} }
} }
@ -533,16 +533,16 @@ namespace {
} else if (LoadInst *L = dyn_cast<LoadInst>(I)) { } else if (LoadInst *L = dyn_cast<LoadInst>(I)) {
// Vectorize simple loads if possbile: // Vectorize simple loads if possbile:
IsSimpleLoadStore = L->isSimple(); IsSimpleLoadStore = L->isSimple();
if (!IsSimpleLoadStore || Config.NoMemOps) if (!IsSimpleLoadStore || !Config.VectorizeMemOps)
return false; return false;
} else if (StoreInst *S = dyn_cast<StoreInst>(I)) { } else if (StoreInst *S = dyn_cast<StoreInst>(I)) {
// Vectorize simple stores if possbile: // Vectorize simple stores if possbile:
IsSimpleLoadStore = S->isSimple(); IsSimpleLoadStore = S->isSimple();
if (!IsSimpleLoadStore || Config.NoMemOps) if (!IsSimpleLoadStore || !Config.VectorizeMemOps)
return false; return false;
} else if (CastInst *C = dyn_cast<CastInst>(I)) { } else if (CastInst *C = dyn_cast<CastInst>(I)) {
// We can vectorize casts, but not casts of pointer types, etc. // We can vectorize casts, but not casts of pointer types, etc.
if (Config.NoCasts) if (!Config.VectorizeCasts)
return false; return false;
Type *SrcTy = C->getSrcTy(); Type *SrcTy = C->getSrcTy();
@ -582,10 +582,12 @@ namespace {
!(VectorType::isValidElementType(T2) || T2->isVectorTy())) !(VectorType::isValidElementType(T2) || T2->isVectorTy()))
return false; return false;
if (Config.NoInts && (T1->isIntOrIntVectorTy() || T2->isIntOrIntVectorTy())) if (!Config.VectorizeInts
&& (T1->isIntOrIntVectorTy() || T2->isIntOrIntVectorTy()))
return false; return false;
if (Config.NoFloats && (T1->isFPOrFPVectorTy() || T2->isFPOrFPVectorTy())) if (!Config.VectorizeFloats
&& (T1->isFPOrFPVectorTy() || T2->isFPOrFPVectorTy()))
return false; return false;
if (T1->getPrimitiveSizeInBits() > Config.VectorBits/2 || if (T1->getPrimitiveSizeInBits() > Config.VectorBits/2 ||
@ -1887,12 +1889,12 @@ llvm::vectorizeBasicBlock(Pass *P, BasicBlock &BB, const VectorizeConfig &C) {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
VectorizeConfig::VectorizeConfig() { VectorizeConfig::VectorizeConfig() {
VectorBits = ::VectorBits; VectorBits = ::VectorBits;
NoInts = ::NoInts; VectorizeInts = !::NoInts;
NoFloats = ::NoFloats; VectorizeFloats = !::NoFloats;
NoCasts = ::NoCasts; VectorizeCasts = !::NoCasts;
NoMath = ::NoMath; VectorizeMath = !::NoMath;
NoFMA = ::NoFMA; VectorizeFMA = !::NoFMA;
NoMemOps = ::NoMemOps; VectorizeMemOps = !::NoMemOps;
AlignedOnly = ::AlignedOnly; AlignedOnly = ::AlignedOnly;
ReqChainDepth= ::ReqChainDepth; ReqChainDepth= ::ReqChainDepth;
SearchLimit = ::SearchLimit; SearchLimit = ::SearchLimit;