[PATCH] [RFC] Pragma Vectorize in Clang

Renato Golin renato.golin at linaro.org
Mon Dec 16 14:32:15 PST 2013


Hi nadav, aschwaighofer, rsmith,

So, I have progressed a little bit, but I got stuck again on something a little more fundamental: where in Stmt to store the vectorizer information to add as a metadata later?

I've done:
 1. Added the PragmaVectorizeHandler to read the #pragma and create a Token with the information
 2. Added HandlePragmaVectorize and ActOnPragmaVectorize to transform this into Sema's context
 3. Added VectorizeTraits to Stmt, so that loops, functions and blocks can get their metadata

My assumptions:
 1. Every time a pragma is encountered, the pragma handler is called, and Sema's vectorizer context gets filled with data
 2. Whenever the loop/function/block which the pragma is associated (ActOnCompoundStmt), I should check this statement, populate the vectorizer traits (VectorizerTraitsBitfields), so when the IR is lowered, I know what metadata to fill in.

My questions are:
 1. Are my assumptions correct?
 2. Is VectorizerTraitsBitfields the correct way to pass this information down?

Thanks!

PS: For now, I'm not allowing two #pragma lines to refer to the same loop/block, but this could become important, and will depend on the syntax of the #pragma, which I'll handle later.

http://llvm-reviews.chandlerc.com/D2420

Files:
  include/clang/AST/Stmt.h
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/TokenKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Parse/ParsePragma.cpp
  lib/Parse/ParsePragma.h
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaAttr.cpp
  lib/Sema/SemaStmt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2420.1.patch
Type: text/x-patch
Size: 13295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131216/83239c22/attachment.bin>


More information about the cfe-commits mailing list