public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alexey Lapshin <alexey.lapshin@espressif.com>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Cc: Alexey Gerenkov <alexey.gerenkov@espressif.com>,
	Ivan Grokhotkov <ivan@espressif.com>,
	Anton Maklakov <anton.maklakov@espressif.com>
Subject: [PATCH 2/5] gas: xtensa: add endianness, loops, booleans options
Date: Sat, 22 Oct 2022 12:55:16 +0000	[thread overview]
Message-ID: <63f2699e6ef3e6d1ca415a6ed1187d4f64297521.camel@espressif.com> (raw)
In-Reply-To: <94fd668465b77e94f3c000982c694e7da8f828f1.camel@espressif.com>

Added additional assembley options for a better flexibility.

---
 gas/config/tc-xtensa.c    | 53 ++++++++++++++++++++++++++++++++++++---
 gas/config/tc-xtensa.h    |  2 +-
 gas/config/xtensa-relax.c |  8 ++++--
 3 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index df6a3cec8a1..630d147bf63 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -89,6 +89,9 @@ static vliw_insn cur_vinsn;
 unsigned xtensa_num_pipe_stages;
 unsigned xtensa_fetch_width;
 
+unsigned target_have_booleans = XCHAL_HAVE_LOOPS;
+unsigned target_have_loops = XCHAL_HAVE_BOOLEANS;
+
 static enum debug_info_type xt_saved_debug_type = DEBUG_NONE;
 
 /* Some functions are only valid in the front end.  This variable
@@ -746,6 +749,15 @@ enum
 
   option_abi_windowed,
   option_abi_call0,
+
+  option_eb,
+  option_el,
+
+  option_loops,
+  option_no_loops,
+
+  option_booleans,
+  option_no_booleans,
 };
 
 const char *md_shortopts = "";
@@ -830,6 +842,15 @@ struct option md_longopts[] =
   { "abi-windowed", no_argument, NULL, option_abi_windowed },
   { "abi-call0", no_argument, NULL, option_abi_call0 },
 
+  { "EL", no_argument, NULL, option_el },
+  { "EB", no_argument, NULL, option_eb },
+
+  { "loops", no_argument, NULL, option_loops },
+  { "no-loops", no_argument, NULL, option_no_loops },
+
+  { "booleans", no_argument, NULL, option_booleans },
+  { "no-booleans", no_argument, NULL, option_no_booleans },
+
   { NULL, no_argument, NULL, 0 }
 };
 
@@ -1066,6 +1087,30 @@ md_parse_option (int c, const char *arg)
       elf32xtensa_abi = XTHAL_ABI_CALL0;
       return 1;
 
+    case option_eb:
+      target_big_endian = 1;
+      return 1;
+
+    case option_el:
+      target_big_endian = 0;
+      return 1;
+
+    case option_loops:
+      target_have_loops = 1;
+      return 1;
+
+    case option_no_loops:
+      target_have_loops = 0;
+      return 1;
+
+    case option_booleans:
+      target_have_booleans = 1;
+      return 1;
+
+    case option_no_booleans:
+      target_have_booleans = 0;
+      return 1;
+
     default:
       return 0;
     }
@@ -1100,7 +1145,11 @@ Xtensa options:\n\
   --[no-]separate-prop-tables\n\
                           [Do not] place Xtensa property records into\n\
                           individual property sections for each section.\n\
-                          Default is to generate single property section.\n", stream);
+                          Default is to generate single property section.\n\
+  --EB                    Generate code for a big endian machine.\n\
+  --EL                    Generate code for a little endian machine.\n\
+  --[no-]booleans         [Do not] use boolean registers.\n\
+  --[no-]loops            [Do not] zero-overhead loops.\n", stream);
 }
 
 \f
@@ -5268,8 +5317,6 @@ md_number_to_chars (char *buf, valueT val, int n)
 static void
 xg_init_global_config (void)
 {
-  target_big_endian = XCHAL_HAVE_BE;
-
   density_supported = XCHAL_HAVE_DENSITY;
   absolute_literals_supported = XSHAL_USE_ABSOLUTE_LITERALS;
   xtensa_fetch_width = XCHAL_INST_FETCH_WIDTH;
diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h
index 1887558ecf1..914f4565c52 100644
--- a/gas/config/tc-xtensa.h
+++ b/gas/config/tc-xtensa.h
@@ -30,7 +30,7 @@ struct fix;
 #include "xtensa-isa.h"
 #include "xtensa-config.h"
 
-#define TARGET_BYTES_BIG_ENDIAN 0
+#define TARGET_BYTES_BIG_ENDIAN XCHAL_HAVE_BE
 
 
 /* Maximum number of opcode slots in a VLIW instruction.  */
diff --git a/gas/config/xtensa-relax.c b/gas/config/xtensa-relax.c
index 0682b29f815..aad9ae7d348 100644
--- a/gas/config/xtensa-relax.c
+++ b/gas/config/xtensa-relax.c
@@ -102,6 +102,10 @@
 /* Imported from bfd.  */
 extern xtensa_isa xtensa_default_isa;
 
+/* Imported from tc-xtensa.  */
+extern unsigned target_have_booleans;
+extern unsigned target_have_loops;
+
 /* The opname_list is a small list of names that we use for opcode and
    operand variable names to simplify ownership of these commonly used
    strings.  Strings entered in the table can be compared by pointer
@@ -1569,7 +1573,7 @@ transition_applies (insn_pattern *initial_insn,
 	  else if (!strcmp (option_name, "Const16"))
 	    option_available = (XCHAL_HAVE_CONST16 == 1);
 	  else if (!strcmp (option_name, "Loops"))
-	    option_available = (XCHAL_HAVE_LOOPS == 1);
+	    option_available = (target_have_loops == 1);
 	  else if (!strcmp (option_name, "WideBranches"))
 	    option_available
 	      = (XCHAL_HAVE_WIDE_BRANCHES == 1 && produce_flix == FLIX_ALL);
@@ -1578,7 +1582,7 @@ transition_applies (insn_pattern *initial_insn,
 	      = (XCHAL_HAVE_PREDICTED_BRANCHES == 1
 		 && produce_flix == FLIX_ALL);
 	  else if (!strcmp (option_name, "Booleans"))
-	    option_available = (XCHAL_HAVE_BOOLEANS == 1);
+	    option_available = (target_have_booleans == 1);
 	  else
 	    as_warn (_("invalid configuration option '%s' in transition rule '%s'"),
 		     req_or_option->option_name, from_string);
-- 
2.34.1


  parent reply	other threads:[~2022-10-22 12:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 12:51 [PATCH 0/5] Add Xtensa ESP chips support Alexey Lapshin
2022-10-22 12:53 ` [PATCH 1/5] bfd: xtensa: move common code from ld and gas Alexey Lapshin
2022-10-22 12:55 ` Alexey Lapshin [this message]
2022-10-22 12:56 ` [PATCH 3/5] ld: xtensa: use default LD command line options for endianness Alexey Lapshin
2022-10-22 13:54 ` [PATCH 4/5] gas: xtensa: add esp32, esp32s2, esp32s3 isa-modules options Alexey Lapshin
2022-10-22 13:56 ` [PATCH 5/5] gdb: xtensa: add support for esp32, esp32s2, esp32s3 isa-modules Alexey Lapshin
2022-10-25 19:13 ` [PATCH 0/5] Add Xtensa ESP chips support Max Filippov
2022-10-25 20:17   ` Alexey Lapshin
2022-10-27 15:39     ` Max Filippov
2022-10-27 19:39       ` Alexey Lapshin
2022-10-28 15:48         ` Max Filippov
2022-10-28 16:05           ` Max Filippov
2022-10-31  6:38             ` Alexey Lapshin
2022-10-31 16:10               ` 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=63f2699e6ef3e6d1ca415a6ed1187d4f64297521.camel@espressif.com \
    --to=alexey.lapshin@espressif.com \
    --cc=alexey.gerenkov@espressif.com \
    --cc=anton.maklakov@espressif.com \
    --cc=binutils@sourceware.org \
    --cc=ivan@espressif.com \
    /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).