]> granicus.if.org Git - clang/commitdiff
Make the variable names match the name of the metadata they control.
authorTyler Nowicki <tyler.nowicki@gmail.com>
Tue, 14 Jul 2015 23:03:09 +0000 (23:03 +0000)
committerTyler Nowicki <tyler.nowicki@gmail.com>
Tue, 14 Jul 2015 23:03:09 +0000 (23:03 +0000)
Rename Vectorizer to Vectorize and VectorizeUnroll to InterleaveCount.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242241 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGLoopInfo.cpp
lib/CodeGen/CGLoopInfo.h
lib/CodeGen/CGStmtOpenMP.cpp

index 1163d63b4a20484f1ed9286617e34b18b0cb3547..63de2d98fd7f50c565c4fff1f8973fa4677f9848 100644 (file)
@@ -20,9 +20,9 @@ using namespace llvm;
 
 static MDNode *createMetadata(LLVMContext &Ctx, const LoopAttributes &Attrs) {
 
-  if (!Attrs.IsParallel && Attrs.VectorizerWidth == 0 &&
-      Attrs.VectorizerUnroll == 0 &&
-      Attrs.VectorizerEnable == LoopAttributes::VecUnspecified)
+  if (!Attrs.IsParallel && Attrs.VectorizeWidth == 0 &&
+      Attrs.InterleaveCount == 0 &&
+      Attrs.VectorizeEnable == LoopAttributes::Unspecified)
     return nullptr;
 
   SmallVector<Metadata *, 4> Args;
@@ -30,29 +30,28 @@ static MDNode *createMetadata(LLVMContext &Ctx, const LoopAttributes &Attrs) {
   auto TempNode = MDNode::getTemporary(Ctx, None);
   Args.push_back(TempNode.get());
 
-  // Setting vectorizer.width
-  if (Attrs.VectorizerWidth > 0) {
+  // Setting vectorize.width
+  if (Attrs.VectorizeWidth > 0) {
     Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.vectorize.width"),
                         ConstantAsMetadata::get(ConstantInt::get(
-                            Type::getInt32Ty(Ctx), Attrs.VectorizerWidth))};
+                            Type::getInt32Ty(Ctx), Attrs.VectorizeWidth))};
     Args.push_back(MDNode::get(Ctx, Vals));
   }
 
-  // Setting vectorizer.unroll
-  if (Attrs.VectorizerUnroll > 0) {
+  // Setting interleave.count
+  if (Attrs.InterleaveCount > 0) {
     Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.interleave.count"),
                         ConstantAsMetadata::get(ConstantInt::get(
-                            Type::getInt32Ty(Ctx), Attrs.VectorizerUnroll))};
+                            Type::getInt32Ty(Ctx), Attrs.InterleaveCount))};
     Args.push_back(MDNode::get(Ctx, Vals));
   }
 
-  // Setting vectorizer.enable
-  if (Attrs.VectorizerEnable != LoopAttributes::VecUnspecified) {
-    Metadata *Vals[] = {
-        MDString::get(Ctx, "llvm.loop.vectorize.enable"),
-        ConstantAsMetadata::get(ConstantInt::get(
-            Type::getInt1Ty(Ctx),
-            (Attrs.VectorizerEnable == LoopAttributes::VecEnable)))};
+  // Setting vectorize.enable
+  if (Attrs.VectorizeEnable != LoopAttributes::Unspecified) {
+    Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+                        ConstantAsMetadata::get(ConstantInt::get(
+                            Type::getInt1Ty(Ctx), (Attrs.VectorizeEnable ==
+                                                   LoopAttributes::Enable)))};
     Args.push_back(MDNode::get(Ctx, Vals));
   }
 
@@ -63,14 +62,14 @@ static MDNode *createMetadata(LLVMContext &Ctx, const LoopAttributes &Attrs) {
 }
 
 LoopAttributes::LoopAttributes(bool IsParallel)
-    : IsParallel(IsParallel), VectorizerEnable(LoopAttributes::VecUnspecified),
-      VectorizerWidth(0), VectorizerUnroll(0) {}
+    : IsParallel(IsParallel), VectorizeEnable(LoopAttributes::Unspecified),
+      VectorizeWidth(0), InterleaveCount(0) {}
 
 void LoopAttributes::clear() {
   IsParallel = false;
-  VectorizerWidth = 0;
-  VectorizerUnroll = 0;
-  VectorizerEnable = LoopAttributes::VecUnspecified;
+  VectorizeWidth = 0;
+  InterleaveCount = 0;
+  VectorizeEnable = LoopAttributes::Unspecified;
 }
 
 LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs)
index 2249937cd0d0ac37d821ea4c13ed0468849e92fd..8822c22c91c8a2f3edc4b03986a632d36a712777 100644 (file)
@@ -39,17 +39,17 @@ struct LoopAttributes {
   /// \brief Generate llvm.loop.parallel metadata for loads and stores.
   bool IsParallel;
 
-  /// \brief Values of llvm.loop.vectorize.enable metadata.
-  enum LVEnableState { VecUnspecified, VecEnable, VecDisable };
+  /// \brief State of loop vectorization or unrolling.
+  enum LVEnableState { Unspecified, Enable, Disable };
 
-  /// \brief llvm.loop.vectorize.enable
-  LVEnableState VectorizerEnable;
+  /// \brief Value for llvm.loop.vectorize.enable metadata.
+  LVEnableState VectorizeEnable;
 
-  /// \brief llvm.loop.vectorize.width
-  unsigned VectorizerWidth;
+  /// \brief Value for llvm.loop.vectorize.width metadata.
+  unsigned VectorizeWidth;
 
-  /// \brief llvm.loop.interleave.count
-  unsigned VectorizerUnroll;
+  /// \brief Value for llvm.loop.interleave.count metadata.
+  unsigned InterleaveCount;
 };
 
 /// \brief Information used when generating a structured loop.
@@ -109,17 +109,17 @@ public:
   /// \brief Set the next pushed loop as parallel.
   void setParallel(bool Enable = true) { StagedAttrs.IsParallel = Enable; }
 
-  /// \brief Set the next pushed loop 'vectorizer.enable'
-  void setVectorizerEnable(bool Enable = true) {
-    StagedAttrs.VectorizerEnable =
-        Enable ? LoopAttributes::VecEnable : LoopAttributes::VecDisable;
+  /// \brief Set the next pushed loop 'vectorize.enable'
+  void setVectorizeEnable(bool Enable = true) {
+    StagedAttrs.VectorizeEnable =
+        Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
   }
 
-  /// \brief Set the vectorizer width for the next loop pushed.
-  void setVectorizerWidth(unsigned W) { StagedAttrs.VectorizerWidth = W; }
+  /// \brief Set the vectorize width for the next loop pushed.
+  void setVectorizeWidth(unsigned W) { StagedAttrs.VectorizeWidth = W; }
 
-  /// \brief Set the vectorizer unroll for the next loop pushed.
-  void setVectorizerUnroll(unsigned U) { StagedAttrs.VectorizerUnroll = U; }
+  /// \brief Set the interleave count for the next loop pushed.
+  void setInterleaveCount(unsigned C) { StagedAttrs.InterleaveCount = C; }
 
 private:
   /// \brief Returns true if there is LoopInfo on the stack.
index a1f093a8d866d089e36d47147b284e08da6cd994..b11372bbcb7b486acead9125258af357c494822e 100644 (file)
@@ -741,7 +741,7 @@ static void emitSafelenClause(CodeGenFunction &CGF,
     RValue Len = CGF.EmitAnyExpr(C->getSafelen(), AggValueSlot::ignored(),
                                  /*ignoreResult=*/true);
     llvm::ConstantInt *Val = cast<llvm::ConstantInt>(Len.getScalarVal());
-    CGF.LoopStack.setVectorizerWidth(Val->getZExtValue());
+    CGF.LoopStack.setVectorizeWidth(Val->getZExtValue());
     // In presence of finite 'safelen', it may be unsafe to mark all
     // the memory instructions parallel, because loop-carried
     // dependences of 'safelen' iterations are possible.
@@ -752,7 +752,7 @@ static void emitSafelenClause(CodeGenFunction &CGF,
 void CodeGenFunction::EmitOMPSimdInit(const OMPLoopDirective &D) {
   // Walk clauses and process safelen/lastprivate.
   LoopStack.setParallel();
-  LoopStack.setVectorizerEnable(true);
+  LoopStack.setVectorizeEnable(true);
   emitSafelenClause(*this, D);
 }