Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
include/polly/CodeGen/IslExprBuilder.h
//===-IslExprBuilder.h - Helper to generate code for isl AST expressions --===// | //===-IslExprBuilder.h - Helper to generate code for isl AST expressions --===// | ||||
// | // | ||||
// The LLVM Compiler Infrastructure | // The LLVM Compiler Infrastructure | ||||
// | // | ||||
// This file is distributed under the University of Illinois Open Source | // This file is distributed under the University of Illinois Open Source | ||||
// License. See LICENSE.TXT for details. | // License. See LICENSE.TXT for details. | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#ifndef POLLY_ISL_EXPR_BUILDER_H | #ifndef POLLY_ISL_EXPR_BUILDER_H | ||||
#define POLLY_ISL_EXPR_BUILDER_H | #define POLLY_ISL_EXPR_BUILDER_H | ||||
#include "polly/CodeGen/IRBuilder.h" | #include "polly/CodeGen/IRBuilder.h" | ||||
#include "isl/ast.h" | #include "llvm/ADT/MapVector.h" | ||||
#include <map> | #include "isl/ast.h" | ||||
namespace llvm { | namespace llvm { | ||||
class SCEVExpander; | class SCEVExpander; | ||||
} | } | ||||
namespace polly { | namespace polly { | ||||
/// @brief LLVM-IR generator for isl_ast_expr[essions] | /// @brief LLVM-IR generator for isl_ast_expr[essions] | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
/// 2) We always flag computations with 'nsw' | /// 2) We always flag computations with 'nsw' | ||||
/// | /// | ||||
/// As isl_ast_expr[essions] assume arbitrary precision, no wrapping should | /// As isl_ast_expr[essions] assume arbitrary precision, no wrapping should | ||||
/// ever occur in the generated LLVM-IR (assuming the data type chosen is large | /// ever occur in the generated LLVM-IR (assuming the data type chosen is large | ||||
/// enough). | /// enough). | ||||
class IslExprBuilder { | class IslExprBuilder { | ||||
public: | public: | ||||
/// @brief A map from isl_ids to llvm::Values. | /// @brief A map from isl_ids to llvm::Values. | ||||
typedef std::map<isl_id *, llvm::Value *> IDToValueTy; | typedef llvm::MapVector<isl_id *, llvm::Value *> IDToValueTy; | ||||
jdoerfert: This change can/should be commited earlier, LGTM btw. but is there a particular reason for… | |||||
/// @brief Construct an IslExprBuilder. | /// @brief Construct an IslExprBuilder. | ||||
/// | /// | ||||
/// @param Builder The IRBuilder used to construct the isl_ast_expr[ession]. | /// @param Builder The IRBuilder used to construct the isl_ast_expr[ession]. | ||||
/// The insert location of this IRBuilder defines WHERE the | /// The insert location of this IRBuilder defines WHERE the | ||||
/// corresponding LLVM-IR is generated. | /// corresponding LLVM-IR is generated. | ||||
/// | /// | ||||
/// @param IDToValue The isl_ast_expr[ession] may reference parameters or | /// @param IDToValue The isl_ast_expr[ession] may reference parameters or | ||||
Show All 27 Lines | public: | ||||
/// possible output values. | /// possible output values. | ||||
/// | /// | ||||
/// @param Expr The expression for which to find the type. | /// @param Expr The expression for which to find the type. | ||||
/// @return The type with which the expression should be computed. | /// @return The type with which the expression should be computed. | ||||
llvm::IntegerType *getType(__isl_keep isl_ast_expr *Expr); | llvm::IntegerType *getType(__isl_keep isl_ast_expr *Expr); | ||||
private: | private: | ||||
PollyIRBuilder &Builder; | PollyIRBuilder &Builder; | ||||
std::map<isl_id *, llvm::Value *> &IDToValue; | IDToValueTy &IDToValue; | ||||
/// @brief A SCEVExpander to translate dimension sizes to llvm values. | /// @brief A SCEVExpander to translate dimension sizes to llvm values. | ||||
llvm::SCEVExpander &Expander; | llvm::SCEVExpander &Expander; | ||||
llvm::Value *createOp(__isl_take isl_ast_expr *Expr); | llvm::Value *createOp(__isl_take isl_ast_expr *Expr); | ||||
llvm::Value *createOpUnary(__isl_take isl_ast_expr *Expr); | llvm::Value *createOpUnary(__isl_take isl_ast_expr *Expr); | ||||
llvm::Value *createOpAccess(__isl_take isl_ast_expr *Expr); | llvm::Value *createOpAccess(__isl_take isl_ast_expr *Expr); | ||||
llvm::Value *createOpBin(__isl_take isl_ast_expr *Expr); | llvm::Value *createOpBin(__isl_take isl_ast_expr *Expr); | ||||
Show All 12 Lines |
This change can/should be commited earlier, LGTM btw. but is there a particular reason for MapVector instead of SmallDenseMap or just DenseMap?