aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2016-06-02 13:46:20 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2016-06-02 06:46:20 -0700
commit4a2353126ec971d01425b1fdec42afa316804337 (patch)
treeb0b73d22e0c8a955f7f397790e174ba0ffe5305b /gcc
parentf3c5ecc2b984e186f043ad03cc7a96a6275f4670 (diff)
downloadgcc-4a2353126ec971d01425b1fdec42afa316804337.zip
gcc-4a2353126ec971d01425b1fdec42afa316804337.tar.gz
gcc-4a2353126ec971d01425b1fdec42afa316804337.tar.bz2
Update TARGET_FUNCTION_INCOMING_ARG documentation
On x86, interrupt handlers are only called by processors which push interrupt data onto stack at the address where the normal return address is. Since interrupt handlers must access interrupt data via pointers so that they can update interrupt data, the pointer argument is passed as "argument pointer - word". TARGET_FUNCTION_INCOMING_ARG defines how callee sees its argument. Normally it returns REG, NULL, or CONST_INT. This patch adds arbitrary address computation based on hard register, which can be forced into a register, to the list. When copying an incoming argument onto stack, assign_parm_setup_stack has: if (argument in memory) copy argument in memory to stack else move argument to stack Since an arbitrary address computation may be passed as an argument, we change it to: if (argument in memory) copy argument in memory to stack else { if (argument isn't in register) force argument into a register move argument to stack } * function.c (assign_parm_setup_stack): Force source into a register if needed. * target.def (function_incoming_arg): Update documentation to allow arbitrary address computation based on hard register. * doc/tm.texi: Regenerated. Co-Authored-By: Julia Koval <julia.koval@intel.com> From-SVN: r237037
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/doc/tm.texi14
-rw-r--r--gcc/function.c6
-rw-r--r--gcc/target.def16
4 files changed, 32 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d4af6af..770df07 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2016-06-02 H.J. Lu <hongjiu.lu@intel.com>
+ Julia Koval <julia.koval@intel.com>
+
+ * function.c (assign_parm_setup_stack): Force source into a
+ register if needed.
+ * target.def (function_incoming_arg): Update documentation to
+ allow arbitrary address computation based on hard register.
+ * doc/tm.texi: Regenerated.
+
2016-06-02 Martin Liska <mliska@suse.cz>
* predict.c (combine_predictions_for_bb): Fix first match in
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 8c7f2a1..a343e91 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3938,17 +3938,21 @@ documentation.
@end deftypefn
@deftypefn {Target Hook} rtx TARGET_FUNCTION_INCOMING_ARG (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named})
-Define this hook if the target machine has ``register windows'', so
-that the register in which a function sees an arguments is not
-necessarily the same as the one in which the caller passed the
-argument.
+Define this hook if the caller and callee on the target have different
+views of where arguments are passed. Also define this hook if there are
+functions that are never directly called, but are invoked by the hardware
+and which have nonstandard calling conventions.
-For such machines, @code{TARGET_FUNCTION_ARG} computes the register in
+In this case @code{TARGET_FUNCTION_ARG} computes the register in
which the caller passes the value, and
@code{TARGET_FUNCTION_INCOMING_ARG} should be defined in a similar
fashion to tell the function being called where the arguments will
arrive.
+@code{TARGET_FUNCTION_INCOMING_ARG} can also return arbitrary address
+computation using hard register, which can be forced into a register,
+so that it can be used to pass special arguments.
+
If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined,
@code{TARGET_FUNCTION_ARG} serves both purposes.
@end deftypefn
diff --git a/gcc/function.c b/gcc/function.c
index 726c20c..c15d47d 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3466,7 +3466,11 @@ assign_parm_setup_stack (struct assign_parm_data_all *all, tree parm,
BLOCK_OP_NORMAL);
}
else
- emit_move_insn (dest, src);
+ {
+ if (!REG_P (src))
+ src = force_reg (GET_MODE (src), src);
+ emit_move_insn (dest, src);
+ }
}
if (to_conversion)
diff --git a/gcc/target.def b/gcc/target.def
index 6392e73..5285e57 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4468,21 +4468,23 @@ a register.",
bool named),
default_function_arg)
-/* Likewise, but for machines with register windows. Return the
- location where the argument will appear to the callee. */
DEFHOOK
(function_incoming_arg,
- "Define this hook if the target machine has ``register windows'', so\n\
-that the register in which a function sees an arguments is not\n\
-necessarily the same as the one in which the caller passed the\n\
-argument.\n\
+ "Define this hook if the caller and callee on the target have different\n\
+views of where arguments are passed. Also define this hook if there are\n\
+functions that are never directly called, but are invoked by the hardware\n\
+and which have nonstandard calling conventions.\n\
\n\
-For such machines, @code{TARGET_FUNCTION_ARG} computes the register in\n\
+In this case @code{TARGET_FUNCTION_ARG} computes the register in\n\
which the caller passes the value, and\n\
@code{TARGET_FUNCTION_INCOMING_ARG} should be defined in a similar\n\
fashion to tell the function being called where the arguments will\n\
arrive.\n\
\n\
+@code{TARGET_FUNCTION_INCOMING_ARG} can also return arbitrary address\n\
+computation using hard register, which can be forced into a register,\n\
+so that it can be used to pass special arguments.\n\
+\n\
If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined,\n\
@code{TARGET_FUNCTION_ARG} serves both purposes.",
rtx, (cumulative_args_t ca, machine_mode mode, const_tree type,