[llvm] r225785 - [PM] In the PassManager template, remove a pointless indirection through

David Blaikie dblaikie at gmail.com
Tue Jan 13 08:33:23 PST 2015


On Tue, Jan 13, 2015 at 3:36 AM, Chandler Carruth <chandlerc at gmail.com>
wrote:

> Author: chandlerc
> Date: Tue Jan 13 05:36:43 2015
> New Revision: 225785
>
> URL: http://llvm.org/viewvc/llvm-project?rev=225785&view=rev
> Log:
> [PM] In the PassManager template, remove a pointless indirection through
> a nested class template for the PassModel, and use the T-suffix for the
> two typedefs to match the code in the AnalysisManager.
>
> This is the last of the fairly fundamental code cleanups here. Will be
> focusing on the printing of analyses next to finish that aspect off.
>
> Modified:
>     llvm/trunk/include/llvm/IR/PassManager.h
>
> Modified: llvm/trunk/include/llvm/IR/PassManager.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=225785&r1=225784&r2=225785&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/PassManager.h (original)
> +++ llvm/trunk/include/llvm/IR/PassManager.h Tue Jan 13 05:36:43 2015
> @@ -236,24 +236,19 @@ public:
>    }
>
>    template <typename PassT> void addPass(PassT Pass) {
> -    Passes.emplace_back(new PassModel<PassT>(std::move(Pass)));
> +    typedef detail::PassModel<IRUnitT, PassT> PassModelT;
> +    Passes.emplace_back(new PassModelT(std::move(Pass)));
>

Generally I prefer to avoid raw 'new' because it makes me think harder
about the code - but perhaps there's something I'm missing (PassModelT
private/protected in some way?) that makes this preferable over
push_back(make_unique<PassModelT>(...)) - or just avoiding the extra move?


>    }
>
>    static StringRef name() { return "PassManager"; }
>
>  private:
> -  // Pull in the concept type and model template specialized for modules.
> -  typedef detail::PassConcept<IRUnitT> PassConcept;
> -  template <typename PassT>
> -  struct PassModel : detail::PassModel<IRUnitT, PassT> {
> -    PassModel(PassT Pass)
> -        : detail::PassModel<IRUnitT, PassT>(std::move(Pass)) {}
> -  };
> +  typedef detail::PassConcept<IRUnitT> PassConceptT;
>
>    PassManager(const PassManager &) LLVM_DELETED_FUNCTION;
>    PassManager &operator=(const PassManager &) LLVM_DELETED_FUNCTION;
>
> -  std::vector<std::unique_ptr<PassConcept>> Passes;
> +  std::vector<std::unique_ptr<PassConceptT>> Passes;
>  };
>
>  /// \brief Convenience typedef for a pass manager over modules.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150113/03163364/attachment.html>


More information about the llvm-commits mailing list