From 16a16ec7db0a5c626567b57ba49e09c4a5cccb76 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 25 Jun 2015 16:51:35 +0000 Subject: function.h (struct incoming_args): Move struct. 2015-06-25 Andrew MacLeod * 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 --- gcc/calls.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'gcc/calls.c') 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. -- cgit v1.1