aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2015-06-25 16:51:35 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2015-06-25 16:51:35 +0000
commit16a16ec7db0a5c626567b57ba49e09c4a5cccb76 (patch)
tree08270b7c9b79613ad264a52e14a5567e8d6dc4fb /gcc/calls.c
parent9cad7a76c373e3e18c6d821a8848aae7dcb73675 (diff)
downloadgcc-16a16ec7db0a5c626567b57ba49e09c4a5cccb76.zip
gcc-16a16ec7db0a5c626567b57ba49e09c4a5cccb76.tar.gz
gcc-16a16ec7db0a5c626567b57ba49e09c4a5cccb76.tar.bz2
function.h (struct incoming_args): Move struct.
2015-06-25 Andrew MacLeod <amacleod@redhat.com> * function.h (struct incoming_args): Move struct. (pass_by_reference, reference_callee_copied): Remove prototypes. * emit-rtl.h (struct incoming_args): Relocate struct here. * calls.h (pass_by_reference, reference_callee_copied): Relocate prototypes here. * function.c (pass_by_reference, reference_callee_copied): Move. * calls.c (pass_by_reference, reference_callee_copied): Relocate here. * cfgloop.h: Don't include tm.h or hard-reg-set.h. * ipa-chkp.c: Include calls.h. * ada/gcc-interface/misc.c: Include calls.h not function.h. * c-family/cilk.c: Move calls.h after tm.h in the include chain. From-SVN: r224951
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 5cf0dca..7cb2c3d 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -858,6 +858,50 @@ call_expr_flags (const_tree t)
return flags;
}
+/* Return true if TYPE should be passed by invisible reference. */
+
+bool
+pass_by_reference (CUMULATIVE_ARGS *ca, machine_mode mode,
+ tree type, bool named_arg)
+{
+ if (type)
+ {
+ /* If this type contains non-trivial constructors, then it is
+ forbidden for the middle-end to create any new copies. */
+ if (TREE_ADDRESSABLE (type))
+ return true;
+
+ /* GCC post 3.4 passes *all* variable sized types by reference. */
+ if (!TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ return true;
+
+ /* If a record type should be passed the same as its first (and only)
+ member, use the type and mode of that member. */
+ if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type))
+ {
+ type = TREE_TYPE (first_field (type));
+ mode = TYPE_MODE (type);
+ }
+ }
+
+ return targetm.calls.pass_by_reference (pack_cumulative_args (ca), mode,
+ type, named_arg);
+}
+
+/* Return true if TYPE, which is passed by reference, should be callee
+ copied instead of caller copied. */
+
+bool
+reference_callee_copied (CUMULATIVE_ARGS *ca, machine_mode mode,
+ tree type, bool named_arg)
+{
+ if (type && TREE_ADDRESSABLE (type))
+ return false;
+ return targetm.calls.callee_copies (pack_cumulative_args (ca), mode, type,
+ named_arg);
+}
+
+
/* Precompute all register parameters as described by ARGS, storing values
into fields within the ARGS array.