[polly] r202853 - Introduce PollyIRBuilder
Tobias Grosser
tobias at grosser.es
Tue Mar 4 06:58:49 PST 2014
Author: grosser
Date: Tue Mar 4 08:58:49 2014
New Revision: 202853
URL: http://llvm.org/viewvc/llvm-project?rev=202853&view=rev
Log:
Introduce PollyIRBuilder
PollyIRBuilder is currently just a typedef to IRBuilder<>. Consequently, this
change should not affect behavior. In subsequent patches we will extend its
functionality to emit loop.parallel metadata.
Added:
polly/trunk/include/polly/CodeGen/IRBuilder.h
Modified:
polly/trunk/include/polly/CodeGen/BlockGenerators.h
polly/trunk/include/polly/CodeGen/LoopGenerators.h
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
polly/trunk/lib/CodeGen/LoopGenerators.cpp
polly/trunk/lib/CodeGen/PTXGenerator.cpp
polly/trunk/lib/CodeGen/Utils.cpp
Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Tue Mar 4 08:58:49 2014
@@ -16,7 +16,7 @@
#ifndef POLLY_BLOCK_GENERATORS_H
#define POLLY_BLOCK_GENERATORS_H
-#include "llvm/IR/IRBuilder.h"
+#include "polly/CodeGen/IRBuilder.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
@@ -70,19 +70,19 @@ public:
/// original code new Values they should be replaced with.
/// @param P A reference to the pass this function is called from.
/// The pass is needed to update other analysis.
- static void generate(IRBuilder<> &Builder, ScopStmt &Stmt,
+ static void generate(PollyIRBuilder &Builder, ScopStmt &Stmt,
ValueMapT &GlobalMap, LoopToScevMapT <S, Pass *P) {
BlockGenerator Generator(Builder, Stmt, P);
Generator.copyBB(GlobalMap, LTS);
}
protected:
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
ScopStmt &Statement;
Pass *P;
ScalarEvolution &SE;
- BlockGenerator(IRBuilder<> &B, ScopStmt &Stmt, Pass *P);
+ BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P);
/// @brief Get the new version of a Value.
///
@@ -208,7 +208,7 @@ public:
/// loop containing the statemenet.
/// @param P A reference to the pass this function is called from.
/// The pass is needed to update other analysis.
- static void generate(IRBuilder<> &B, ScopStmt &Stmt,
+ static void generate(PollyIRBuilder &B, ScopStmt &Stmt,
VectorValueMapT &GlobalMaps,
std::vector<LoopToScevMapT> &VLTS,
__isl_keep isl_map *Schedule, Pass *P) {
@@ -246,7 +246,7 @@ private:
// dimension of the innermost loop containing the statemenet.
isl_map *Schedule;
- VectorBlockGenerator(IRBuilder<> &B, VectorValueMapT &GlobalMaps,
+ VectorBlockGenerator(PollyIRBuilder &B, VectorValueMapT &GlobalMaps,
std::vector<LoopToScevMapT> &VLTS, ScopStmt &Stmt,
__isl_keep isl_map *Schedule, Pass *P);
Added: polly/trunk/include/polly/CodeGen/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IRBuilder.h?rev=202853&view=auto
==============================================================================
--- polly/trunk/include/polly/CodeGen/IRBuilder.h (added)
+++ polly/trunk/include/polly/CodeGen/IRBuilder.h Tue Mar 4 08:58:49 2014
@@ -0,0 +1,23 @@
+//===- Codegen/IRBuilder.h - The IR builder used by Polly -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// The Polly IRBuilder file contains Polly specific extensions for the
+// IRBuilder.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef POLLY_CODEGEN_IRBUILDER_H
+#define POLLY_CODEGEN_IRBUILDER_H
+
+#include "llvm/IR/IRBuilder.h"
+
+namespace polly {
+typedef llvm::IRBuilder<> PollyIRBuilder;
+}
+#endif
Modified: polly/trunk/include/polly/CodeGen/LoopGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/LoopGenerators.h?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/LoopGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/LoopGenerators.h Tue Mar 4 08:58:49 2014
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#ifndef POLLY_LOOP_GENERATORS_H
#define POLLY_LOOP_GENERATORS_H
-#include "llvm/IR/IRBuilder.h"
+#include "polly/CodeGen/IRBuilder.h"
#include "llvm/ADT/SetVector.h"
#include <map>
@@ -40,14 +40,14 @@ using namespace llvm;
/// @param Predicate The predicate used to generate the upper loop bound.
/// @return Value* The newly created induction variable for this loop.
Value *createLoop(Value *LowerBound, Value *UpperBound, Value *Stride,
- IRBuilder<> &Builder, Pass *P, BasicBlock *&ExitBlock,
+ PollyIRBuilder &Builder, Pass *P, BasicBlock *&ExitBlock,
ICmpInst::Predicate Predicate);
class OMPGenerator {
public:
typedef std::map<Value *, Value *> ValueToValueMapTy;
- OMPGenerator(IRBuilder<> &Builder, Pass *P) : Builder(Builder), P(P) {}
+ OMPGenerator(PollyIRBuilder &Builder, Pass *P) : Builder(Builder), P(P) {}
/// @brief Create an OpenMP parallel loop.
///
@@ -73,7 +73,7 @@ public:
BasicBlock::iterator *LoopBody);
private:
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
Pass *P;
IntegerType *getIntPtrTy();
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Tue Mar 4 08:58:49 2014
@@ -65,7 +65,7 @@ bool polly::canSynthesize(const Instruct
namespace {
class IslGenerator {
public:
- IslGenerator(IRBuilder<> &Builder, std::vector<Value *> &IVS)
+ IslGenerator(PollyIRBuilder &Builder, std::vector<Value *> &IVS)
: Builder(Builder), IVS(IVS) {}
Value *generateIslVal(__isl_take isl_val *Val);
Value *generateIslAff(__isl_take isl_aff *Aff);
@@ -77,7 +77,7 @@ private:
class IslGenerator *Generator;
} IslGenInfo;
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
std::vector<Value *> &IVS;
static int mergeIslAffValues(__isl_take isl_set *Set, __isl_take isl_aff *Aff,
void *User);
@@ -155,7 +155,7 @@ Value *IslGenerator::generateIslPwAff(__
return User.Result;
}
-BlockGenerator::BlockGenerator(IRBuilder<> &B, ScopStmt &Stmt, Pass *P)
+BlockGenerator::BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P)
: Builder(B), Statement(Stmt), P(P), SE(P->getAnalysis<ScalarEvolution>()) {
}
@@ -395,7 +395,7 @@ void BlockGenerator::copyBB(ValueMapT &G
copyInstruction(II, BBMap, GlobalMap, LTS);
}
-VectorBlockGenerator::VectorBlockGenerator(IRBuilder<> &B,
+VectorBlockGenerator::VectorBlockGenerator(PollyIRBuilder &B,
VectorValueMapT &GlobalMaps,
std::vector<LoopToScevMapT> &VLTS,
ScopStmt &Stmt,
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Tue Mar 4 08:58:49 2014
@@ -82,7 +82,7 @@ typedef DenseMap<const char *, Value *>
/// Class to generate LLVM-IR that calculates the value of a clast_expr.
class ClastExpCodeGen {
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
const CharMapT &IVS;
Value *codegen(const clast_name *e, Type *Ty);
@@ -98,7 +98,7 @@ public:
// @param IVMAP A Map that translates strings describing the induction
// variables to the Values* that represent these variables
// on the LLVM side.
- ClastExpCodeGen(IRBuilder<> &B, CharMapT &IVMap);
+ ClastExpCodeGen(PollyIRBuilder &B, CharMapT &IVMap);
// Generates code to calculate a given clast expression.
//
@@ -216,7 +216,7 @@ Value *ClastExpCodeGen::codegen(const cl
return old;
}
-ClastExpCodeGen::ClastExpCodeGen(IRBuilder<> &B, CharMapT &IVMap)
+ClastExpCodeGen::ClastExpCodeGen(PollyIRBuilder &B, CharMapT &IVMap)
: Builder(B), IVS(IVMap) {}
Value *ClastExpCodeGen::codegen(const clast_expr *e, Type *Ty) {
@@ -244,7 +244,7 @@ private:
Pass *P;
// The Builder specifies the current location to code generate at.
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
// Map the Values from the old code to their counterparts in the new code.
ValueMapT ValueMap;
@@ -375,7 +375,7 @@ private:
public:
void codegen(const clast_root *r);
- ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P);
+ ClastStmtCodeGen(Scop *scop, PollyIRBuilder &B, Pass *P);
};
}
@@ -1006,7 +1006,7 @@ void ClastStmtCodeGen::codegen(const cla
codegen(stmt->next);
}
-ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P)
+ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, PollyIRBuilder &B, Pass *P)
: S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) {}
namespace {
@@ -1028,7 +1028,7 @@ public:
BasicBlock *StartBlock = executeScopConditionally(S, this);
- IRBuilder<> Builder(StartBlock->begin());
+ PollyIRBuilder Builder(StartBlock->begin());
ClastStmtCodeGen CodeGen(&S, Builder, this);
CloogInfo &C = getAnalysis<CloogInfo>();
Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Tue Mar 4 08:58:49 2014
@@ -58,7 +58,7 @@ using namespace llvm;
/// run time.
class RuntimeDebugBuilder {
public:
- RuntimeDebugBuilder(IRBuilder<> &Builder) : Builder(Builder) {}
+ RuntimeDebugBuilder(PollyIRBuilder &Builder) : Builder(Builder) {}
/// @brief Print a string to stdout.
///
@@ -71,7 +71,7 @@ public:
void createIntPrinter(Value *V);
private:
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
/// @brief Add a call to the fflush function with no file pointer given.
///
@@ -138,8 +138,8 @@ void RuntimeDebugBuilder::createIntPrint
/// @brief Calculate the Value of a certain isl_ast_expr
class IslExprBuilder {
public:
- IslExprBuilder(IRBuilder<> &Builder, std::map<isl_id *, Value *> &IDToValue,
- Pass *P)
+ IslExprBuilder(PollyIRBuilder &Builder,
+ std::map<isl_id *, Value *> &IDToValue, Pass *P)
: Builder(Builder), IDToValue(IDToValue) {}
Value *create(__isl_take isl_ast_expr *Expr);
@@ -147,7 +147,7 @@ public:
IntegerType *getType(__isl_keep isl_ast_expr *Expr);
private:
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
std::map<isl_id *, Value *> &IDToValue;
Value *createOp(__isl_take isl_ast_expr *Expr);
@@ -539,7 +539,7 @@ Value *IslExprBuilder::create(__isl_take
class IslNodeBuilder {
public:
- IslNodeBuilder(IRBuilder<> &Builder, Pass *P)
+ IslNodeBuilder(PollyIRBuilder &Builder, Pass *P)
: Builder(Builder), ExprBuilder(Builder, IDToValue, P), P(P) {}
void addParameters(__isl_take isl_set *Context);
@@ -547,7 +547,7 @@ public:
IslExprBuilder &getExprBuilder() { return ExprBuilder; }
private:
- IRBuilder<> &Builder;
+ PollyIRBuilder &Builder;
IslExprBuilder ExprBuilder;
Pass *P;
@@ -1032,7 +1032,7 @@ public:
BasicBlock *StartBlock = executeScopConditionally(S, this);
isl_ast_node *Ast = AstInfo.getAst();
- IRBuilder<> Builder(StartBlock->begin());
+ PollyIRBuilder Builder(StartBlock->begin());
IslNodeBuilder NodeBuilder(Builder, this);
Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.cpp?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Tue Mar 4 08:58:49 2014
@@ -47,7 +47,7 @@ using namespace polly;
// TODO: We currently always create the GuardBB. If we can prove the loop is
// always executed at least once, we can get rid of this branch.
Value *polly::createLoop(Value *LB, Value *UB, Value *Stride,
- IRBuilder<> &Builder, Pass *P, BasicBlock *&ExitBB,
+ PollyIRBuilder &Builder, Pass *P, BasicBlock *&ExitBB,
ICmpInst::Predicate Predicate) {
DominatorTree &DT = P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
Modified: polly/trunk/lib/CodeGen/PTXGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PTXGenerator.cpp?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PTXGenerator.cpp (original)
+++ polly/trunk/lib/CodeGen/PTXGenerator.cpp Tue Mar 4 08:58:49 2014
@@ -33,7 +33,7 @@
using namespace llvm;
using namespace polly;
-PTXGenerator::PTXGenerator(IRBuilder<> &Builder, Pass *P,
+PTXGenerator::PTXGenerator(PollyIRBuilder &Builder, Pass *P,
const std::string &Triple)
: Builder(Builder), P(P), GPUTriple(Triple), GridWidth(1), GridHeight(1),
BlockWidth(1), BlockHeight(1), OutputBytes(0) {
Modified: polly/trunk/lib/CodeGen/Utils.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Utils.cpp?rev=202853&r1=202852&r2=202853&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Utils.cpp (original)
+++ polly/trunk/lib/CodeGen/Utils.cpp Tue Mar 4 08:58:49 2014
@@ -12,9 +12,9 @@
//===----------------------------------------------------------------------===//
#include "polly/CodeGen/Utils.h"
+#include "polly/CodeGen/IRBuilder.h"
#include "polly/ScopInfo.h"
#include "llvm/Analysis/LoopInfo.h"
-#include "llvm/IR/IRBuilder.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -23,7 +23,7 @@ using namespace llvm;
BasicBlock *polly::executeScopConditionally(Scop &S, Pass *PassInfo) {
BasicBlock *StartBlock, *SplitBlock, *NewBlock;
Region &R = S.getRegion();
- IRBuilder<> Builder(R.getEntry());
+ PollyIRBuilder Builder(R.getEntry());
DominatorTree &DT =
PassInfo->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
RegionInfo &RI = PassInfo->getAnalysis<RegionInfo>();
More information about the llvm-commits
mailing list