* [PATCH][calls.c] Remove #ifdef checks on STACK_GROWS_DOWNWARD
@ 2015-05-18 9:25 Kyrill Tkachov
2015-05-18 14:57 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2015-05-18 9:25 UTC (permalink / raw)
To: GCC Patches; +Cc: Jeff Law
[-- Attachment #1: Type: text/plain, Size: 794 bytes --]
Hi all,
As per https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01166.html
I saw that STACK_GROWS_DOWNWARD is being checked for ifdef in a number of places
unrelated to the patch in the PR, so decided to remove the ifdef checks for STACK_GROWS_DOWNWARD
in a separate patch. It's fairly mechanical.
Bootstrapped on x86_64 and aarch64 and tested on arm.
I believe these patches are considered obvious, so I'll commit this in a day, unless someone objects,
before proceeding with the changes in https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01166.html
2015-05-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* calls.c: Always define STACK_GROWS_DOWNWARD as 0 or 1.
(mem_overlaps_already_clobbered_arg_p): Rewrite ifdef
STACK_GROWS_DOWNWARD as normal if.
(expand_call): Likewise.
[-- Attachment #2: calls-stack-grows-downward.patch --]
[-- Type: text/x-patch, Size: 1860 bytes --]
commit 13a36809b55631dbc2c7e7dfb564857f6fb74339
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Wed May 13 10:20:59 2015 +0100
[calls.c] Remove #ifdef checks on STACK_GROWS_DOWNWARD
diff --git a/gcc/calls.c b/gcc/calls.c
index caa7d60..e11b1b9 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -81,6 +81,15 @@ along with GCC; see the file COPYING3. If not see
#include "tree-chkp.h"
#include "rtl-chkp.h"
+
+/* Redefine STACK_GROWS_DOWNWARD in terms of 0 or 1. */
+#ifdef STACK_GROWS_DOWNWARD
+# undef STACK_GROWS_DOWNWARD
+# define STACK_GROWS_DOWNWARD 1
+#else
+# define STACK_GROWS_DOWNWARD 0
+#endif
+
/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
@@ -1974,11 +1983,12 @@ mem_overlaps_already_clobbered_arg_p (rtx addr, unsigned HOST_WIDE_INT size)
return true;
else
i = INTVAL (val);
-#ifdef STACK_GROWS_DOWNWARD
- i -= crtl->args.pretend_args_size;
-#else
- i += crtl->args.pretend_args_size;
-#endif
+
+ if (STACK_GROWS_DOWNWARD)
+ i -= crtl->args.pretend_args_size;
+ else
+ i += crtl->args.pretend_args_size;
+
if (ARGS_GROW_DOWNWARD)
i = -i - size;
@@ -2908,12 +2918,13 @@ expand_call (tree exp, rtx target, int ignore)
if (pass == 0)
{
argblock = crtl->args.internal_arg_pointer;
- argblock
-#ifdef STACK_GROWS_DOWNWARD
- = plus_constant (Pmode, argblock, crtl->args.pretend_args_size);
-#else
- = plus_constant (Pmode, argblock, -crtl->args.pretend_args_size);
-#endif
+ if (STACK_GROWS_DOWNWARD)
+ argblock
+ = plus_constant (Pmode, argblock, crtl->args.pretend_args_size);
+ else
+ argblock
+ = plus_constant (Pmode, argblock, -crtl->args.pretend_args_size);
+
stored_args_map = sbitmap_alloc (args_size.constant);
bitmap_clear (stored_args_map);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-18 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 9:25 [PATCH][calls.c] Remove #ifdef checks on STACK_GROWS_DOWNWARD Kyrill Tkachov
2015-05-18 14:57 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).