From: Max Filippov <jcmvbkbc@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: linux-xtensa@linux-xtensa.org,
Sterling Augustine <augustine.sterling@gmail.com>,
Max Filippov <jcmvbkbc@gmail.com>
Subject: [RFC 1/5] gcc: xtensa: allow XCHAL_* macros to be non-constant
Date: Mon, 22 May 2017 21:31:00 -0000 [thread overview]
Message-ID: <1495487362-18969-2-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1495487362-18969-1-git-send-email-jcmvbkbc@gmail.com>
XCHAL_* macros from the xtensa-config.h are used in a number of places
that require them to be preprocessor constants. Rewrite these places so
that non-constant XCHAL_* definitions could be used there.
2017-05-22 Max Filippov <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (xtensa_option_override): Append
MASK_CONST16 to target_flags in the absence of TARGET_L32R.
(hwloop_optimize, hwloop_fail, hwloop_pattern_reg,
xtensa_doloop_hooks): Define unconditionally.
(xtensa_reorg_loops): Only call reorg_loops in the presence of
TARGET_LOOPS.
* config/xtensa/xtensa.h (TARGET_L32R): New definition.
(TARGET_DEFAULT): Remove XCHAL_HAVE_L32R condition and account
for it in xtensa_option_override.
(HARD_FRAME_POINTER_IS_FRAME_POINTER,
HARD_FRAME_POINTER_IS_ARG_POINTER): New definitions.
---
gcc/config/xtensa/xtensa.c | 18 +++++++++---------
gcc/config/xtensa/xtensa.h | 11 ++++++++---
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 0181dde..8b20c64 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -2181,6 +2181,13 @@ xtensa_option_override (void)
int regno;
machine_mode mode;
+ /* Use CONST16 in the absence of L32R.
+ Set it in the TARGET_OPTION_OVERRIDE to avoid dependency on xtensa
+ configuration in the xtensa-common.c */
+
+ if (!TARGET_L32R)
+ target_flags |= MASK_CONST16;
+
if (!TARGET_BOOLEANS && TARGET_HARD_FLOAT)
error ("boolean registers required for the floating-point option");
@@ -4053,8 +4060,6 @@ xtensa_invalid_within_doloop (const rtx_insn *insn)
/* Optimize LOOP. */
-#if TARGET_LOOPS
-
static bool
hwloop_optimize (hwloop_info loop)
{
@@ -4241,14 +4246,9 @@ static struct hw_doloop_hooks xtensa_doloop_hooks =
static void
xtensa_reorg_loops (void)
{
- reorg_loops (false, &xtensa_doloop_hooks);
-}
-#else
-static inline void
-xtensa_reorg_loops (void)
-{
+ if (TARGET_LOOPS)
+ reorg_loops (false, &xtensa_doloop_hooks);
}
-#endif
/* Implement the TARGET_MACHINE_DEPENDENT_REORG pass. */
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index c32e8ca..59d6b00 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -66,10 +66,9 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_LOOPS XCHAL_HAVE_LOOPS
#define TARGET_WINDOWED_ABI (XSHAL_ABI == XTHAL_ABI_WINDOWED)
#define TARGET_DEBUG XCHAL_HAVE_DEBUG
+#define TARGET_L32R XCHAL_HAVE_L32R
-#define TARGET_DEFAULT \
- ((XCHAL_HAVE_L32R ? 0 : MASK_CONST16) | \
- MASK_SERIALIZE_VOLATILE)
+#define TARGET_DEFAULT (MASK_SERIALIZE_VOLATILE)
#ifndef HAVE_AS_TLS
#define HAVE_AS_TLS 0
@@ -362,6 +361,12 @@ extern char xtensa_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
/* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM (GP_REG_FIRST + 17)
+/* Hard frame pointer is neither frame nor arg pointer.
+ The definitions are here because actual hard frame pointer register
+ definition is not a preprocessor constant. */
+#define HARD_FRAME_POINTER_IS_FRAME_POINTER 0
+#define HARD_FRAME_POINTER_IS_ARG_POINTER 0
+
/* For now we don't try to use the full set of boolean registers. Without
software pipelining of FP operations, there's not much to gain and it's
a real pain to get them reloaded. */
--
2.1.4
next prev parent reply other threads:[~2017-05-22 21:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 21:09 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
2017-05-22 21:09 ` [RFC 3/5] gcc: xtensa: support dynconfig on windows Max Filippov
2017-05-22 21:09 ` [RFC 2/5] gcc: xtensa: make configuration dynamic Max Filippov
2017-05-25 18:25 ` augustine.sterling
2017-05-25 20:57 ` Max Filippov
2017-05-26 15:04 ` Ian Lance Taylor via gcc-patches
2017-05-26 18:48 ` Max Filippov
2017-05-22 21:09 ` [RFC 4/5] gcc: xtensa: add __XCHAL_* builtins Max Filippov
2017-05-22 21:09 ` [RFC 5/5] libgcc: xtensa: use built-in configuration Max Filippov
2017-05-22 21:31 ` Max Filippov [this message]
2017-05-22 21:49 ` [RFC 1/5] gcc: xtensa: allow XCHAL_* macros to be non-constant augustine.sterling
2017-05-23 2:19 ` Max Filippov
2017-05-25 18:24 ` augustine.sterling
2017-06-14 17:23 ` Max Filippov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495487362-18969-2-git-send-email-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=augustine.sterling@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linux-xtensa@linux-xtensa.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).