[llvm] r339670 - [TableGen] Pass string/vector types by const reference (PR37666). NFCI

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 14:19:38 PDT 2018


Looks to me like these should be passed by value but the missing thing was
the std::move in the ctor init list.

(since the members are values - if a caller passes in a temporary, it'd be
nice to avoid the copy & move the values into the members)

On Tue, Aug 14, 2018 at 4:18 AM Simon Pilgrim via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rksimon
> Date: Tue Aug 14 04:17:38 2018
> New Revision: 339670
>
> URL: http://llvm.org/viewvc/llvm-project?rev=339670&view=rev
> Log:
> [TableGen] Pass string/vector types by const reference (PR37666). NFCI
>
> Modified:
>     llvm/trunk/utils/TableGen/FastISelEmitter.cpp
>
> Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=339670&r1=339669&r2=339670&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Tue Aug 14 04:17:38 2018
> @@ -39,11 +39,12 @@ struct InstructionMemo {
>    std::vector<std::string> PhysRegs;
>    std::string PredicateCheck;
>
> -  InstructionMemo(std::string Name, const CodeGenRegisterClass *RC,
> -                  std::string SubRegNo, std::vector<std::string> PhysRegs,
> -                  std::string PredicateCheck)
> -    : Name(Name), RC(RC), SubRegNo(SubRegNo), PhysRegs(PhysRegs),
> -      PredicateCheck(PredicateCheck) {}
> +  InstructionMemo(const std::string &Name, const CodeGenRegisterClass *RC,
> +                  const std::string &SubRegNo,
> +                  const std::vector<std::string> &PhysRegs,
> +                  const std::string &PredicateCheck)
> +      : Name(Name), RC(RC), SubRegNo(SubRegNo), PhysRegs(PhysRegs),
> +        PredicateCheck(PredicateCheck) {}
>
>    // Make sure we do not copy InstructionMemo.
>    InstructionMemo(const InstructionMemo &Other) = delete;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180820/9d1b4003/attachment.html>


More information about the llvm-commits mailing list