d: Refactor use of built-in memcmp/memcpy/memset into helper functions.
authorIain Buclaw <ibuclaw@gdcproject.org>
Fri, 17 Jul 2020 15:20:02 +0000 (17:20 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Thu, 30 Jul 2020 16:01:33 +0000 (18:01 +0200)
commitab0edbcb371cce5f82136f20ad45155c003d4982
tree2601487ec66c374c0560c25a47ce266cbbd7bc2b
parentdc60d67674dd809fd5d57390e1360436351ae7ae
d: Refactor use of built-in memcmp/memcpy/memset into helper functions.

Generating calls to memset, memcpy, and memcmp is frequent enough that
it becomes beneficial to put them into their own routine.  All parts of
the front-end have been updated to call the new helper functions instead
of doing it themselves.

gcc/d/ChangeLog:

* d-codegen.cc (build_memcmp_call): New function.
(build_memcpy_call): New function.
(build_memset_call): New function.
(build_float_identity): Call build_memcmp_call.
(lower_struct_comparison): Likewise.
(build_struct_comparison): Likewise.
* d-tree.h (build_memcmp_call): Declare.
(build_memcpy_call): Declare.
(build_memset_call): Declare.
* expr.cc (ExprVisitor::visit (EqualExp *)): Call build_memcmp_call.
(ExprVisitor::visit (AssignExp *)): Call build_memset_call.
(ExprVisitor::visit (ArrayLiteralExp *)): Call build_memcpy_call.
(ExprVisitor::visit (StructLiteralExp *)): Call build_memset_call.
gcc/d/d-codegen.cc
gcc/d/d-tree.h
gcc/d/expr.cc