diff options
author | Tobias Grosser <tobias@grosser.es> | 2014-04-16 07:33:47 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2014-04-16 07:33:47 +0000 |
commit | 5a56cbf4965f0d7bcd9be4d1c15c559d398df96e (patch) | |
tree | 4d143e508f499bad2aa0050f018673a4c413771f | |
parent | 6f375e5604590fc9c23d8a75176feb951de84211 (diff) | |
download | bcm5719-llvm-5a56cbf4965f0d7bcd9be4d1c15c559d398df96e.tar.gz bcm5719-llvm-5a56cbf4965f0d7bcd9be4d1c15c559d398df96e.zip |
[C++11] Use nullptr
llvm-svn: 206361
-rw-r--r-- | polly/lib/Analysis/Dependences.cpp | 28 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 2 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 10 | ||||
-rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 10 | ||||
-rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 6 | ||||
-rw-r--r-- | polly/lib/CodeGen/IslAst.cpp | 16 | ||||
-rw-r--r-- | polly/lib/Exchange/ScopLib.cpp | 26 | ||||
-rw-r--r-- | polly/lib/JSON/json_writer.cpp | 8 | ||||
-rw-r--r-- | polly/lib/Transform/IndVarSimplify.cpp | 6 | ||||
-rw-r--r-- | polly/lib/Transform/ScheduleOptimizer.cpp | 6 |
10 files changed, 59 insertions, 59 deletions
diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp index 2fb91c90610..ea03f637645 100644 --- a/polly/lib/Analysis/Dependences.cpp +++ b/polly/lib/Analysis/Dependences.cpp @@ -64,7 +64,7 @@ static cl::opt<enum AnalysisType> OptAnalysisType( 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(Scop &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(Scop &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(Scop &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::getDependences(int Kinds) { } bool Dependences::hasValidDependences() { - return (RAW != NULL) && (WAR != NULL) && (WAW != NULL); + return (RAW != nullptr) && (WAR != nullptr) && (WAW != nullptr); } void Dependences::getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index c4935bf6f40..e3ed26741f5 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -468,7 +468,7 @@ bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const { 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"); diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 4003602d2cb..a3c56624842 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -187,7 +187,7 @@ __isl_give isl_pw_aff *SCEVAffinator::visitMulExpr(const SCEVMulExpr *Expr) { 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::createBasicAccessMap(ScopStmt *Statement) { 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 isl_set *NewDomain) { } 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(const SCEV *Parameter) const { 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) diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index c2c4faa267f..8cd12512e56 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -133,7 +133,7 @@ int IslGenerator::mergeIslAffValues(__isl_take isl_set *Set, __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(__isl_take isl_set *Set, 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::lookupAvailableValue(const Value *Old, ValueMapT &BBMap, 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 Value *Old, ValueMapT &BBMap, // 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::generateStrideOneLoad(const LoadInst *Load, 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 = diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 8b8dc790970..d7270bd48e0 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -116,7 +116,7 @@ Value *ClastExpCodeGen::codegen(const clast_name *e, Type *Ty) { } 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); diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp index 5679dfd9728..fafb5a202d3 100644 --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -238,16 +238,16 @@ static int containsLoops(__isl_take isl_ast_node *Node, void *User) { 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_ast_node *Node, void *User) { // 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 *Node, __isl_keep isl_ast_build *Build, 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 *AtEachDomain(__isl_take isl_ast_node *Node, // 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 &D) : S(Scop) { 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 &OS) { 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); diff --git a/polly/lib/Exchange/ScopLib.cpp b/polly/lib/Exchange/ScopLib.cpp index edb4120bce9..0d7c1d758aa 100644 --- a/polly/lib/Exchange/ScopLib.cpp +++ b/polly/lib/Exchange/ScopLib.cpp @@ -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 *S, scoplib_scop_p OScop) { 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 *S, scoplib_scop_p OScop) { if (stmt) { errs() << "Too many statements in ScopLib file\n"; freeStmtToIslMap(&NewScattering); - return NULL; + return nullptr; } return &NewScattering; diff --git a/polly/lib/JSON/json_writer.cpp b/polly/lib/JSON/json_writer.cpp index cdf4188f2ec..bf475c39df5 100644 --- a/polly/lib/JSON/json_writer.cpp +++ b/polly/lib/JSON/json_writer.cpp @@ -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::string &text ) // ////////////////////////////////////////////////////////////////// StyledStreamWriter::StyledStreamWriter( std::string indentation ) - : document_(NULL) + : document_(nullptr) , rightMargin_( 74 ) , indentation_( indentation ) { @@ -559,7 +559,7 @@ StyledStreamWriter::write( std::ostream &out, const Value &root ) writeValue( root ); writeCommentAfterValueOnSameLine( root ); *document_ << "\n"; - document_ = NULL; // Forget the stream, for safety. + document_ = nullptr; // Forget the stream, for safety. } diff --git a/polly/lib/Transform/IndVarSimplify.cpp b/polly/lib/Transform/IndVarSimplify.cpp index def974c2d01..dd56285a4fd 100644 --- a/polly/lib/Transform/IndVarSimplify.cpp +++ b/polly/lib/Transform/IndVarSimplify.cpp @@ -970,7 +970,7 @@ const SCEVAddRecExpr *WidenIV::GetExtendedOperandRecurrence(NarrowIVDefUse DU) { /// 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(SCEVExpander &Rewriter) { // 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(SCEVExpander &Rewriter) { // 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 diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp index 17538a30f1e..3a3c8151d23 100644 --- a/polly/lib/Transform/ScheduleOptimizer.cpp +++ b/polly/lib/Transform/ScheduleOptimizer.cpp @@ -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(Scop &S) { return false; isl_schedule_free(LastSchedule); - LastSchedule = NULL; + LastSchedule = nullptr; // Build input data. int ValidityKinds = |