Language independent return value optimizations
Copyright (C) 2004-2024 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>.
This file implements return value optimizations for functions which
return aggregate types.
Basically this pass searches the function for return statements which
return a local aggregate. When converted to RTL such statements will
generate a copy from the local aggregate to final return value destination
mandated by the target's ABI.
That copy can often be avoided by directly constructing the return value
into the final destination mandated by the target's ABI.
This is basically a generic equivalent to the C++ front-end's
Named Return Value optimization.