[Polly][Refactor] IslAst [1/7]

Tobias Grosser tobias at grosser.es
Wed Jul 16 23:01:19 PDT 2014


On 17/07/2014 02:46, Johannes Doerfert wrote:
> Hey,
>
>
>
> Attached the first patch to refactor IslAst.
>
>
>
> What do you think?
>
>
>
> Best regards,
>
>    Johannes
>
>
>
> --
>
>
>
> Johannes Doerfert
>
> Employee of Qualcomm Innovation Center, Inc.
>
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
> The Linux Foundation
>
>
>
>
>
> 0001-Refactor-Move-code-out-of-the-IslAst-header.patch
>
>
>  From 4ef613e913ab8dba932417c6b139d08136f43c02 Mon Sep 17 00:00:00 2001
> From: Johannes Doerfert<jdoerfert at codeaurora.org>
> Date: Wed, 16 Jul 2014 09:48:32 -0700
> Subject: [PATCH 1/7] [Refactor] Move code out of the IslAst header
>
>    Offer the static functions to extract information out of an IslAst for node
>    as members of IslAstInfo not as top level entities.
>
>    + Refactor common code
>    + Add isParallel and isReductionParallel
>    + Rename IslAstUser to IslAstUserPayload to make it clear this is just a (or
>      the) payload struct.
> ---
>   include/polly/CodeGen/IslAst.h    | 53 ++++++++++++++++--------------------
>   lib/CodeGen/IslAst.cpp            | 57 +++++++++++++++++++++++++++++++--------
>   lib/CodeGen/IslCodeGeneration.cpp | 10 ++++---
>   3 files changed, 75 insertions(+), 45 deletions(-)
>
> diff --git a/include/polly/CodeGen/IslAst.h b/include/polly/CodeGen/IslAst.h
> index 495b7eb..28bb051 100644
> --- a/include/polly/CodeGen/IslAst.h
> +++ b/include/polly/CodeGen/IslAst.h
> @@ -27,7 +27,6 @@
>
>   #include "isl/ast.h"
>
> -struct clast_name;
>   namespace llvm {
>   class raw_ostream;
>   }
> @@ -42,7 +41,7 @@ class Scop;
>   class IslAst;
>
>   // Information about an ast node.
> -struct IslAstUser {
> +struct IslAstUserPayload {
>     struct isl_ast_build *Context;
>     // The node is the outermost parallel loop.
>     int IsOutermostParallel;
> @@ -77,37 +76,31 @@ public:
>
>     bool runOnScop(Scop &S);
>     void printScop(llvm::raw_ostream &OS) const;
> +
> +  /// @name Extract information attached to an isl ast (for) node

Missing dot at the end of the sentence.

> +  ///
> +  ///{
> +
> +  /// @brief Get the complete payload attached to @p Node
Missing dot at the end of the sentence.

> +  static IslAstUserPayload *getNodePayload(__isl_keep isl_ast_node *Node);
> +
> +  /// @brief Is this loop a parallel loop?
> +  static bool isParallel(__isl_keep isl_ast_node *Node);
> +
> +  /// @brief Is this loop an outer parallel loop?
> +  static bool isOuterParallel(__isl_keep isl_ast_node *Node);
> +
> +  /// @brief Is this loop an innermost parallel loop?
> +  static bool isInnermostParallel(__isl_keep isl_ast_node *Node);
> +
> +  /// @brief Is this loop a reduction parallel loop?
> +  static bool isReductionParallel(__isl_keep isl_ast_node *Node);
> +
> +  ///}
> +
>     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
>     virtual void releaseMemory();
>   };


>   }
>

>     Printer = printParallelFor(Node, Printer, PrintOptions, Info);
>     isl_id_free(Id);
>     return Printer;
>   }
>
>   // Allocate an AstNodeInfo structure and initialize it with default values.
> -static struct IslAstUser *allocateIslAstUser() {
> -  struct IslAstUser *NodeInfo;
> -  NodeInfo = (struct IslAstUser *)malloc(sizeof(struct IslAstUser));
> +static struct IslAstUserPayload *allocateIslAstUser() {
> +  struct IslAstUserPayload *NodeInfo;
> +  NodeInfo =
> +      (struct IslAstUserPayload *)malloc(sizeof(struct IslAstUserPayload));

Maybe use new IslAstUserPayload(), instead of malloc?

Otherwise, this is fine with me.

Tobias




More information about the llvm-commits mailing list