* read.c (potable): Add "mri" and ".mri".
authorIan Lance Taylor <ian@airs.com>
Tue, 13 Feb 1996 00:20:13 +0000 (00:20 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 13 Feb 1996 00:20:13 +0000 (00:20 +0000)
(s_mri): New function.
* read.h (s_mri): Declare.
* app.c (scrub_m68k_mri): New static variable.
(mri_pseudo): New static variable.
(do_scrub_begin): Add m68k_mri parameter.  Use it rather than
flag_m68k_mri.  Initialize scrub_m68k_mri.
(mri_state, mri_last_ch): New static variables.
(struct app_save): Add scrub_m68k_mri, mri_state, and mri_last_ch
fields.
(app_push): Save new fields.
(app_pop): Restore new fields.
(do_scrub_chars): Check scrub_m68k_mri rather than flag_mri_mri.
If TC_M68K, use a trivial state machine to look for occurrences of
the .mri pseudo-op, and change the mode appropriately.
* as.h (do_scrub_begin): Update prototype.
* input-scrub.c (input_scrub_begin): Pass flag_m68k_mri to
do_scrub_begin.
* config/tc-m68k.c (reg_prefix_optional_seen): New static
variable.
(m68k_mri_mode_change): New function.
(md_parse_option): Set reg_prefix_optional_seen.
* config/tc-m68k.h (m68k_mri_mode_change): Declare.
(MRI_MODE_CHANGE): Define.
* doc/as.texinfo: Document .mri pseudo-op.

gas/ChangeLog
gas/config/tc-m68k.c
gas/config/tc-m68k.h
gas/read.c

index 33454ac..5b5ded5 100644 (file)
@@ -5,6 +5,32 @@ Mon Feb 12 15:53:46 1996  Doug Evans  <dje@charmed.cygnus.com>
 
 Mon Feb 12 15:41:21 1996  Ian Lance Taylor  <ian@cygnus.com>
 
+       * read.c (potable): Add "mri" and ".mri".
+       (s_mri): New function.
+       * read.h (s_mri): Declare.
+       * app.c (scrub_m68k_mri): New static variable.
+       (mri_pseudo): New static variable.
+       (do_scrub_begin): Add m68k_mri parameter.  Use it rather than
+       flag_m68k_mri.  Initialize scrub_m68k_mri.
+       (mri_state, mri_last_ch): New static variables.
+       (struct app_save): Add scrub_m68k_mri, mri_state, and mri_last_ch
+       fields.
+       (app_push): Save new fields.
+       (app_pop): Restore new fields.
+       (do_scrub_chars): Check scrub_m68k_mri rather than flag_mri_mri.
+       If TC_M68K, use a trivial state machine to look for occurrences of
+       the .mri pseudo-op, and change the mode appropriately.
+       * as.h (do_scrub_begin): Update prototype.
+       * input-scrub.c (input_scrub_begin): Pass flag_m68k_mri to
+       do_scrub_begin.
+       * config/tc-m68k.c (reg_prefix_optional_seen): New static
+       variable.
+       (m68k_mri_mode_change): New function.
+       (md_parse_option): Set reg_prefix_optional_seen.
+       * config/tc-m68k.h (m68k_mri_mode_change): Declare.
+       (MRI_MODE_CHANGE): Define.
+       * doc/as.texinfo: Document .mri pseudo-op.
+
        * app.c (do_scrub_chars): In MRI mode, don't treat '#' as a
        comment character.
 
index 8b31283..5235db4 100644 (file)
@@ -74,6 +74,9 @@ int flag_reg_prefix_optional = REGISTER_PREFIX_OPTIONAL;
 int flag_reg_prefix_optional;
 #endif
 
+/* Whether --register-prefix-optional was used on the command line.  */
+static int reg_prefix_optional_seen;
+
 /* The floating point coprocessor to use by default.  */
 static enum m68k_register m68k_float_copnum = COP1;
 
@@ -3488,6 +3491,43 @@ m68k_init_after_args ()
     md_relax_table[TAB (PCINDEX, BYTE)].rlx_more = 0;
 }
 
+/* This is called if we go in or out of MRI mode because of the .mri
+   pseudo-op.  */
+
+void
+m68k_mri_mode_change (on)
+     int on;
+{
+  if (on)
+    {
+      if (! flag_reg_prefix_optional)
+       {
+         flag_reg_prefix_optional = 1;
+#ifdef REGISTER_PREFIX
+         init_regtable ();
+#endif
+       }
+      m68k_abspcadd = 1;
+      m68k_rel32 = 0;
+    }
+  else
+    {
+      if (! reg_prefix_optional_seen)
+       {
+#ifdef REGISTER_PREFIX_OPTIONAL
+         flag_reg_prefix_optional = REGISTER_PREFIX_OPTIONAL;
+#else
+         flag_reg_prefix_optional = 0;
+#endif
+#ifdef REGISTER_PREFIX
+         init_regtable ();
+#endif
+       }
+      m68k_abspcadd = 0;
+      m68k_rel32 = 1;
+    }
+}
+
 /* Equal to MAX_PRECISION in atof-ieee.c */
 #define MAX_LITTLENUMS 6
 
@@ -6189,6 +6229,7 @@ md_parse_option (c, arg)
 
     case OPTION_REGISTER_PREFIX_OPTIONAL:
       flag_reg_prefix_optional = 1;
+      reg_prefix_optional_seen = 1;
       break;
 
       /* -V: SVR4 argument to print version ID.  */
index 3f99de9..5602857 100644 (file)
@@ -116,6 +116,9 @@ extern int m68k_aout_machtype;
 #define NO_PSEUDO_DOT
 #endif
 
+extern void m68k_mri_mode_change PARAMS ((int));
+#define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i)
+
 #ifdef BFD_ASSEMBLER
 
 #define tc_frob_symbol(sym,punt) \
index ba392c0..8e0a1c9 100644 (file)
@@ -333,6 +333,8 @@ static const pseudo_typeS potable[] =
   {"lsym", s_lsym, 0},
   {"macro", s_macro, 0},
   {"mexit", s_mexit, 0},
+  {"mri", s_mri, 0},
+  {".mri", s_mri, 0},  /* Special case so .mri works in MRI mode.  */
   {"name", s_ignore, 0},
   {"noformat", s_ignore, 0},
   {"nolist", listing_list, 0}, /* Turn listing off */
@@ -1994,6 +1996,37 @@ s_mexit (ignore)
   buffer_limit = input_scrub_next_buffer (&input_line_pointer);
 }
 
+/* Switch in and out of MRI mode.  */
+
+void
+s_mri (ignore)
+     int ignore;
+{
+  int on, old_flag;
+
+  on = get_absolute_expression ();
+  old_flag = flag_mri;
+  if (on != 0)
+    {
+      flag_mri = 1;
+#ifdef TC_M68K
+      flag_m68k_mri = 1;
+#endif
+    }
+  else
+    {
+      flag_mri = 0;
+      flag_m68k_mri = 0;
+    }
+
+#ifdef MRI_MODE_CHANGE
+  if (on != old_flag)
+    MRI_MODE_CHANGE (on);
+#endif
+
+  demand_empty_rest_of_line ();
+}
+
 /* Handle changing the location counter.  */
 
 static void