[polly] r206361 - [C++11] Use nullptr
Tobias Grosser
tobias at grosser.es
Wed Apr 16 00:33:54 PDT 2014
Author: grosser
Date: Wed Apr 16 02:33:47 2014
New Revision: 206361
URL: http://llvm.org/viewvc/llvm-project?rev=206361&view=rev
Log:
[C++11] Use nullptr
Modified:
polly/trunk/lib/Analysis/Dependences.cpp
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/IslAst.cpp
polly/trunk/lib/Exchange/ScopLib.cpp
polly/trunk/lib/JSON/json_writer.cpp
polly/trunk/lib/Transform/IndVarSimplify.cpp
polly/trunk/lib/Transform/ScheduleOptimizer.cpp
Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Wed Apr 16 02:33:47 2014
@@ -64,7 +64,7 @@ static cl::opt<enum AnalysisType> OptAna
cl::cat(PollyCategory));
//===----------------------------------------------------------------------===//
-Dependences::Dependences() : ScopPass(ID) { RAW = WAR = WAW = NULL; }
+Dependences::Dependences() : ScopPass(ID) { RAW = WAR = WAW = nullptr; }
void Dependences::collectInfo(Scop &S, isl_union_map **Read,
isl_union_map **Write, isl_union_map **MayWrite,
@@ -117,18 +117,18 @@ void Dependences::calculateDependences(S
// The pointers below will be set by the subsequent calls to
// isl_union_map_compute_flow.
- RAW = WAW = WAR = NULL;
+ RAW = WAW = WAR = nullptr;
if (OptAnalysisType == VALUE_BASED_ANALYSIS) {
isl_union_map_compute_flow(
isl_union_map_copy(Read), isl_union_map_copy(Write),
- isl_union_map_copy(MayWrite), isl_union_map_copy(Schedule), &RAW, NULL,
- NULL, NULL);
+ isl_union_map_copy(MayWrite), isl_union_map_copy(Schedule), &RAW,
+ nullptr, nullptr, nullptr);
isl_union_map_compute_flow(
isl_union_map_copy(Write), isl_union_map_copy(Write),
isl_union_map_copy(Read), isl_union_map_copy(Schedule), &WAW, &WAR,
- NULL, NULL);
+ nullptr, nullptr);
} else {
isl_union_map *Empty;
@@ -137,18 +137,18 @@ void Dependences::calculateDependences(S
isl_union_map_compute_flow(
isl_union_map_copy(Read), isl_union_map_copy(Empty),
- isl_union_map_copy(Write), isl_union_map_copy(Schedule), NULL, &RAW,
- NULL, NULL);
+ isl_union_map_copy(Write), isl_union_map_copy(Schedule), nullptr, &RAW,
+ nullptr, nullptr);
isl_union_map_compute_flow(
isl_union_map_copy(Write), isl_union_map_copy(Empty),
- isl_union_map_copy(Read), isl_union_map_copy(Schedule), NULL, &WAR,
- NULL, NULL);
+ isl_union_map_copy(Read), isl_union_map_copy(Schedule), nullptr, &WAR,
+ nullptr, nullptr);
isl_union_map_compute_flow(
isl_union_map_copy(Write), isl_union_map_copy(Empty),
- isl_union_map_copy(Write), isl_union_map_copy(Schedule), NULL, &WAW,
- NULL, NULL);
+ isl_union_map_copy(Write), isl_union_map_copy(Schedule), nullptr, &WAW,
+ nullptr, nullptr);
isl_union_map_free(Empty);
}
@@ -165,7 +165,7 @@ void Dependences::calculateDependences(S
isl_union_map_free(RAW);
isl_union_map_free(WAW);
isl_union_map_free(WAR);
- RAW = WAW = WAR = NULL;
+ RAW = WAW = WAR = nullptr;
isl_ctx_reset_error(S.getIslCtx());
}
isl_options_set_on_error(S.getIslCtx(), ISL_ON_ERROR_ABORT);
@@ -327,7 +327,7 @@ void Dependences::releaseMemory() {
isl_union_map_free(WAR);
isl_union_map_free(WAW);
- RAW = WAR = WAW = NULL;
+ RAW = WAR = WAW = nullptr;
}
isl_union_map *Dependences::getDependences(int Kinds) {
@@ -350,7 +350,7 @@ isl_union_map *Dependences::getDependenc
}
bool Dependences::hasValidDependences() {
- return (RAW != NULL) && (WAR != NULL) && (WAW != NULL);
+ return (RAW != nullptr) && (WAR != nullptr) && (WAW != nullptr);
}
void Dependences::getAnalysisUsage(AnalysisUsage &AU) const {
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Wed Apr 16 02:33:47 2014
@@ -468,7 +468,7 @@ bool ScopDetection::isValidLoop(Loop *L,
Region *ScopDetection::expandRegion(Region &R) {
// Initial no valid region was found (greater than R)
- Region *LastValidRegion = NULL;
+ Region *LastValidRegion = nullptr;
Region *ExpandedRegion = R.getExpandedRegion();
DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Apr 16 02:33:47 2014
@@ -187,7 +187,7 @@ __isl_give isl_pw_aff *SCEVAffinator::vi
if (!isl_pw_aff_is_cst(Product) && !isl_pw_aff_is_cst(NextOperand)) {
isl_pw_aff_free(Product);
isl_pw_aff_free(NextOperand);
- return NULL;
+ return nullptr;
}
Product = isl_pw_aff_mul(Product, NextOperand);
@@ -318,7 +318,7 @@ isl_basic_map *MemoryAccess::createBasic
MemoryAccess::MemoryAccess(const IRAccess &Access, const Instruction *AccInst,
ScopStmt *Statement)
- : Statement(Statement), Inst(AccInst), newAccessRelation(NULL) {
+ : Statement(Statement), Inst(AccInst), newAccessRelation(nullptr) {
BaseAddr = Access.getBase();
setBaseName();
@@ -513,7 +513,7 @@ void ScopStmt::restrictDomain(__isl_take
}
void ScopStmt::setScattering(isl_map *NewScattering) {
- assert(NewScattering && "New scattering is NULL");
+ assert(NewScattering && "New scattering is nullptr");
isl_map_free(Scattering);
Scattering = NewScattering;
}
@@ -801,7 +801,7 @@ __isl_give isl_id *Scop::getIdForParam(c
ParamIdType::const_iterator IdIter = ParameterIds.find(Parameter);
if (IdIter == ParameterIds.end())
- return NULL;
+ return nullptr;
std::string ParameterName;
@@ -969,7 +969,7 @@ void Scop::dump() const { print(dbgs());
isl_ctx *Scop::getIslCtx() const { return IslCtx; }
__isl_give isl_union_set *Scop::getDomains() {
- isl_union_set *Domain = NULL;
+ isl_union_set *Domain = nullptr;
for (Scop::iterator SI = begin(), SE = end(); SI != SE; ++SI)
if (!Domain)
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Wed Apr 16 02:33:47 2014
@@ -133,7 +133,7 @@ int IslGenerator::mergeIslAffValues(__is
__isl_take isl_aff *Aff, void *User) {
IslGenInfo *GenInfo = (IslGenInfo *)User;
- assert((GenInfo->Result == NULL) &&
+ assert((GenInfo->Result == nullptr) &&
"Result is already set. Currently only single isl_aff is supported");
assert(isl_set_plain_is_universe(Set) &&
"Code generation failed because the set is not universe");
@@ -146,7 +146,7 @@ int IslGenerator::mergeIslAffValues(__is
Value *IslGenerator::generateIslPwAff(__isl_take isl_pw_aff *PwAff) {
IslGenInfo User;
- User.Result = NULL;
+ User.Result = nullptr;
User.Generator = this;
isl_pw_aff_foreach_piece(PwAff, mergeIslAffValues, &User);
assert(User.Result && "Code generation for isl_pw_aff failed");
@@ -186,7 +186,7 @@ Value *BlockGenerator::lookupAvailableVa
if (Value *New = BBMap.lookup(Old))
return New;
- return NULL;
+ return nullptr;
}
Value *BlockGenerator::getNewValue(const Value *Old, ValueMapT &BBMap,
@@ -215,7 +215,7 @@ Value *BlockGenerator::getNewValue(const
// Now the scalar dependence is neither available nor SCEVCodegenable, this
// should never happen in the current code generator.
llvm_unreachable("Unexpected scalar dependence in region!");
- return NULL;
+ return nullptr;
}
void BlockGenerator::copyInstScalar(const Instruction *Inst, ValueMapT &BBMap,
@@ -446,7 +446,7 @@ VectorBlockGenerator::generateStrideOneL
Type *VectorPtrType = getVectorPtrTy(Pointer, VectorWidth);
unsigned Offset = NegativeStride ? VectorWidth - 1 : 0;
- Value *NewPointer = NULL;
+ Value *NewPointer = nullptr;
NewPointer = getNewValue(Pointer, ScalarMaps[Offset], GlobalMaps[Offset],
VLTS[Offset], getLoopForInst(Load));
Value *VectorPtr =
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Wed Apr 16 02:33:47 2014
@@ -116,7 +116,7 @@ Value *ClastExpCodeGen::codegen(const cl
}
static APInt APInt_from_MPZ(const mpz_t mpz) {
- uint64_t *p = NULL;
+ uint64_t *p = nullptr;
size_t sz;
p = (uint64_t *)mpz_export(p, &sz, -1, sizeof(uint64_t), 0, 0, mpz);
@@ -294,8 +294,8 @@ private:
std::vector<ValueMapT> *VectorVMap = 0,
std::vector<LoopToScevMapT> *VLTS = 0);
- void codegen(const clast_user_stmt *u, std::vector<Value *> *IVS = NULL,
- const char *iterator = NULL,
+ void codegen(const clast_user_stmt *u, std::vector<Value *> *IVS = nullptr,
+ const char *iterator = nullptr,
__isl_take isl_set *scatteringDomain = 0);
void codegen(const clast_block *b);
Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Wed Apr 16 02:33:47 2014
@@ -238,16 +238,16 @@ static int containsLoops(__isl_take isl_
return 0;
case isl_ast_node_block: {
isl_ast_node_list *List = isl_ast_node_block_get_children(Node);
- int Res = isl_ast_node_list_foreach(List, &containsLoops, NULL);
+ int Res = isl_ast_node_list_foreach(List, &containsLoops, nullptr);
isl_ast_node_list_free(List);
isl_ast_node_free(Node);
return Res;
}
case isl_ast_node_if: {
int Res = -1;
- if (0 == containsLoops(isl_ast_node_if_get_then(Node), NULL) ||
+ if (0 == containsLoops(isl_ast_node_if_get_then(Node), nullptr) ||
(isl_ast_node_if_has_else(Node) &&
- 0 == containsLoops(isl_ast_node_if_get_else(Node), NULL)))
+ 0 == containsLoops(isl_ast_node_if_get_else(Node), nullptr)))
Res = 0;
isl_ast_node_free(Node);
return Res;
@@ -261,7 +261,7 @@ static int containsLoops(__isl_take isl_
// Returns true when Node contains loops.
static bool containsLoops(__isl_take isl_ast_node *Node) {
- return 0 == containsLoops(Node, NULL);
+ return 0 == containsLoops(Node, nullptr);
}
// This method is executed after the construction of a for node.
@@ -297,7 +297,7 @@ astBuildAfterFor(__isl_take isl_ast_node
static __isl_give isl_ast_node *AtEachDomain(__isl_take isl_ast_node *Node,
__isl_keep isl_ast_build *Context,
void *User) {
- struct IslAstUser *Info = NULL;
+ struct IslAstUser *Info = nullptr;
isl_id *Id = isl_ast_node_get_annotation(Node);
if (Id)
@@ -307,7 +307,7 @@ static __isl_give isl_ast_node *AtEachDo
// Allocate annotations once: parallel for detection might have already
// allocated the annotations for this node.
Info = allocateIslAstUser();
- Id = isl_id_alloc(isl_ast_node_get_ctx(Node), NULL, Info);
+ Id = isl_id_alloc(isl_ast_node_get_ctx(Node), nullptr, Info);
Id = isl_id_set_free_user(Id, &freeIslAstUser);
}
@@ -361,7 +361,7 @@ IslAst::IslAst(Scop *Scop, Dependences &
else
Context = isl_ast_build_from_context(isl_set_universe(S->getParamSpace()));
- Context = isl_ast_build_set_at_each_domain(Context, AtEachDomain, NULL);
+ Context = isl_ast_build_set_at_each_domain(Context, AtEachDomain, nullptr);
isl_union_map *Schedule = getSchedule();
@@ -418,7 +418,7 @@ void IslAst::pprint(llvm::raw_ostream &O
isl_ast_print_options *Options;
Options = isl_ast_print_options_alloc(S->getIslCtx());
- Options = isl_ast_print_options_set_print_for(Options, &printFor, NULL);
+ Options = isl_ast_print_options_set_print_for(Options, &printFor, nullptr);
isl_printer *P = isl_printer_to_str(S->getIslCtx());
P = isl_printer_set_output_format(P, ISL_FORMAT_C);
Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Wed Apr 16 02:33:47 2014
@@ -129,32 +129,32 @@ void ScopLib::initializeStatements() {
void ScopLib::freeStatement(scoplib_statement_p stmt) {
if (stmt->read)
scoplib_matrix_free(stmt->read);
- stmt->read = NULL;
+ stmt->read = nullptr;
if (stmt->write)
scoplib_matrix_free(stmt->write);
- stmt->write = NULL;
+ stmt->write = nullptr;
scoplib_matrix_list_p current = stmt->domain;
while (current) {
scoplib_matrix_list_p next = current->next;
- current->next = NULL;
+ current->next = nullptr;
scoplib_matrix_free(current->elt);
- current->elt = NULL;
+ current->elt = nullptr;
scoplib_matrix_list_free(current);
current = next;
}
- stmt->domain = NULL;
+ stmt->domain = nullptr;
if (stmt->schedule)
scoplib_matrix_free(stmt->schedule);
- stmt->schedule = NULL;
+ stmt->schedule = nullptr;
for (int i = 0; i < stmt->nb_iterators; ++i)
free(stmt->iterators[i]);
free(stmt->iterators);
- stmt->iterators = NULL;
+ stmt->iterators = nullptr;
stmt->nb_iterators = 0;
scoplib_statement_free(stmt);
@@ -473,7 +473,7 @@ ScopLib::~ScopLib() {
free(scoplib->arrays[i]);
free(scoplib->arrays);
- scoplib->arrays = NULL;
+ scoplib->arrays = nullptr;
scoplib->nb_arrays = 0;
// Free parameters
@@ -481,7 +481,7 @@ ScopLib::~ScopLib() {
free(scoplib->parameters[i]);
free(scoplib->parameters);
- scoplib->parameters = NULL;
+ scoplib->parameters = nullptr;
scoplib->nb_parameters = 0;
scoplib_statement_p stmt = scoplib->statement;
@@ -489,12 +489,12 @@ ScopLib::~ScopLib() {
// Free Statements
while (stmt) {
scoplib_statement_p TempStmt = stmt->next;
- stmt->next = NULL;
+ stmt->next = nullptr;
freeStatement(stmt);
stmt = TempStmt;
}
- scoplib->statement = NULL;
+ scoplib->statement = nullptr;
scoplib_scop_free(scoplib);
}
@@ -720,7 +720,7 @@ StatementToIslMapTy *readScattering(Scop
if (!stmt) {
errs() << "Not enough statements available in ScopLib file\n";
freeStmtToIslMap(&NewScattering);
- return NULL;
+ return nullptr;
}
NewScattering[*SI] =
@@ -731,7 +731,7 @@ StatementToIslMapTy *readScattering(Scop
if (stmt) {
errs() << "Too many statements in ScopLib file\n";
freeStmtToIslMap(&NewScattering);
- return NULL;
+ return nullptr;
}
return &NewScattering;
Modified: polly/trunk/lib/JSON/json_writer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/JSON/json_writer.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/JSON/json_writer.cpp (original)
+++ polly/trunk/lib/JSON/json_writer.cpp Wed Apr 16 02:33:47 2014
@@ -111,12 +111,12 @@ std::string valueToString( bool value )
std::string valueToQuotedString( const char *value )
{
// Not sure how to handle unicode...
- if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
+ if (strpbrk(value, "\"\\\b\f\n\r\t") == nullptr && !containsControlCharacter( value ))
return std::string("\"") + value + "\"";
// We have to walk value and escape any special characters.
// Appending to std::string is not efficient, but this should be rare.
// (Note: forward slashes are *not* rare, but I am not escaping them.)
- unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL
+ unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+nullptr
std::string result;
result.reserve(maxsize); // to avoid lots of mallocs
result += "\"";
@@ -542,7 +542,7 @@ StyledWriter::normalizeEOL( const std::s
// //////////////////////////////////////////////////////////////////
StyledStreamWriter::StyledStreamWriter( std::string indentation )
- : document_(NULL)
+ : document_(nullptr)
, rightMargin_( 74 )
, indentation_( indentation )
{
@@ -559,7 +559,7 @@ StyledStreamWriter::write( std::ostream
writeValue( root );
writeCommentAfterValueOnSameLine( root );
*document_ << "\n";
- document_ = NULL; // Forget the stream, for safety.
+ document_ = nullptr; // Forget the stream, for safety.
}
Modified: polly/trunk/lib/Transform/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndVarSimplify.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndVarSimplify.cpp (original)
+++ polly/trunk/lib/Transform/IndVarSimplify.cpp Wed Apr 16 02:33:47 2014
@@ -970,7 +970,7 @@ const SCEVAddRecExpr *WidenIV::GetExtend
/// IVUsers' perspective after widening it's type? In other words, can the
/// extend be safely hoisted out of the loop with SCEV reducing the value to a
/// recurrence on the same loop. If so, return the sign or zero extended
-/// recurrence. Otherwise return NULL.
+/// recurrence. Otherwise return nullptr.
const SCEVAddRecExpr *WidenIV::GetWideRecurrence(Instruction *NarrowUse) {
if (!SE->isSCEVable(NarrowUse->getType()))
return 0;
@@ -1110,7 +1110,7 @@ PHINode *WidenIV::CreateWideIV(SCEVExpan
// Is this phi an induction variable?
const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(OrigPhi));
if (!AddRec)
- return NULL;
+ return nullptr;
// Widen the induction variable expression.
const SCEV *WideIVExpr = IsSigned ? SE->getSignExtendExpr(AddRec, WideType)
@@ -1122,7 +1122,7 @@ PHINode *WidenIV::CreateWideIV(SCEVExpan
// Can the IV be extended outside the loop without overflow?
AddRec = dyn_cast<SCEVAddRecExpr>(WideIVExpr);
if (!AddRec || AddRec->getLoop() != L)
- return NULL;
+ return nullptr;
// An AddRec must have loop-invariant operands. Since this AddRec is
// materialized by a loop header phi, the expression cannot have any post-loop
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=206361&r1=206360&r2=206361&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Wed Apr 16 02:33:47 2014
@@ -83,7 +83,7 @@ namespace {
class IslScheduleOptimizer : public ScopPass {
public:
static char ID;
- explicit IslScheduleOptimizer() : ScopPass(ID) { LastSchedule = NULL; }
+ explicit IslScheduleOptimizer() : ScopPass(ID) { LastSchedule = nullptr; }
~IslScheduleOptimizer() { isl_schedule_free(LastSchedule); }
@@ -187,7 +187,7 @@ private:
virtual bool doFinalization() {
isl_schedule_free(LastSchedule);
- LastSchedule = NULL;
+ LastSchedule = nullptr;
return true;
}
};
@@ -444,7 +444,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
return false;
isl_schedule_free(LastSchedule);
- LastSchedule = NULL;
+ LastSchedule = nullptr;
// Build input data.
int ValidityKinds =
More information about the llvm-commits
mailing list