* config/tc-m68k.c (parse_mri_control_operand): Change leftstop

and rightstop to not be const.
	(parse_mri_control_expression): Likewise.
	(build_mri_control_operand): Likewise.  Use m68k_ip_op to examine
	the operand, not m68k_reg_parse.
	(s_mri_if): In MRI mode, stop at the first '*'.
	(s_mri_while): Likewise.
	(s_mri_else): In MRI mode, ignore trailing characters.
	(s_mri_endi, s_mri_break, s_mri_next, s_mri_for): Likewise.
	(s_mri_endf, s_mri_repeat, s_mri_until, s_mri_endw): Likewise.
	* config/m68k-parse.y: Revert yesterday's change.
	* config/m68k-parse.h: Revert yesterday's change.
This commit is contained in:
Ian Lance Taylor
1995-09-19 15:36:38 +00:00
parent 486e0f0ac5
commit e1c0287d1c
2 changed files with 124 additions and 42 deletions

View File

@ -1,3 +1,18 @@
Tue Sep 19 11:31:31 1995 Ian Lance Taylor <ian@cygnus.com>
* config/tc-m68k.c (parse_mri_control_operand): Change leftstop
and rightstop to not be const.
(parse_mri_control_expression): Likewise.
(build_mri_control_operand): Likewise. Use m68k_ip_op to examine
the operand, not m68k_reg_parse.
(s_mri_if): In MRI mode, stop at the first '*'.
(s_mri_while): Likewise.
(s_mri_else): In MRI mode, ignore trailing characters.
(s_mri_endi, s_mri_break, s_mri_next, s_mri_for): Likewise.
(s_mri_endf, s_mri_repeat, s_mri_until, s_mri_endw): Likewise.
* config/m68k-parse.y: Revert yesterday's change.
* config/m68k-parse.h: Revert yesterday's change.
Mon Sep 18 15:22:28 1995 Ian Lance Taylor <ian@cygnus.com> Mon Sep 18 15:22:28 1995 Ian Lance Taylor <ian@cygnus.com>
* config/tc-m68k.c (parse_mri_control_operand): Change leftstart * config/tc-m68k.c (parse_mri_control_operand): Change leftstart

View File

@ -4708,12 +4708,12 @@ static struct mri_control_info *push_mri_control
static void pop_mri_control PARAMS ((void)); static void pop_mri_control PARAMS ((void));
static int parse_mri_condition PARAMS ((int *)); static int parse_mri_condition PARAMS ((int *));
static int parse_mri_control_operand static int parse_mri_control_operand
PARAMS ((int *, char **, const char **, char **, const char **)); PARAMS ((int *, char **, char **, char **, char **));
static int swap_mri_condition PARAMS ((int)); static int swap_mri_condition PARAMS ((int));
static int reverse_mri_condition PARAMS ((int)); static int reverse_mri_condition PARAMS ((int));
static void build_mri_control_operand static void build_mri_control_operand
PARAMS ((int, int, char *, const char *, char *, const char *, PARAMS ((int, int, char *, char *, char *, char *, const char *,
const char *, const char *, int)); const char *, int));
static void parse_mri_control_expression static void parse_mri_control_expression
PARAMS ((char *, int, const char *, const char *, int)); PARAMS ((char *, int, const char *, const char *, int));
@ -4810,9 +4810,9 @@ static int
parse_mri_control_operand (pcc, leftstart, leftstop, rightstart, rightstop) parse_mri_control_operand (pcc, leftstart, leftstop, rightstart, rightstop)
int *pcc; int *pcc;
char **leftstart; char **leftstart;
const char **leftstop; char **leftstop;
char **rightstart; char **rightstart;
const char **rightstop; char **rightstop;
{ {
char *s; char *s;
@ -4937,52 +4937,52 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
int qual; int qual;
int cc; int cc;
char *leftstart; char *leftstart;
const char *leftstop; char *leftstop;
char *rightstart; char *rightstart;
const char *rightstop; char *rightstop;
const char *truelab; const char *truelab;
const char *falselab; const char *falselab;
int extent; int extent;
{ {
int leftreg, rightreg;
char *buf; char *buf;
char *s; char *s;
/* See which sides of the comparison are plain registers. */ if (leftstart != NULL)
if (leftstart == NULL)
leftreg = 0;
else
{ {
char *l; struct m68k_op leftop, rightop;
char c;
l = leftstart; /* Swap the compare operands, if necessary, to produce a legal
leftreg = m68k_reg_parse (&l) != 0; m68k compare instruction. Comparing a register operand with
} a non-register operand requires the register to be on the
if (rightstart == NULL) right (cmp, cmpa). Comparing an immediate value with
rightreg = 0; anything requires the immediate value to be on the left
else (cmpi). */
{
char *l;
l = rightstart; c = *leftstop;
rightreg = m68k_reg_parse (&l) != 0; *leftstop = '\0';
} (void) m68k_ip_op (leftstart, &leftop);
*leftstop = c;
/* Swap the compare operands, if necessary, to produce a legal m68k c = *rightstop;
compare instruction. */ *rightstop = '\0';
if ((leftreg && ! rightreg) (void) m68k_ip_op (rightstart, &rightop);
|| (rightstart != NULL && *rightstart == '#')) *rightstop = c;
{
char *temp;
const char *tempc;
cc = swap_mri_condition (cc); if (rightop.mode == IMMED
temp = leftstart; || ((leftop.mode == DREG || leftop.mode == AREG)
leftstart = rightstart; && (rightop.mode != DREG && rightop.mode != AREG)))
rightstart = temp; {
tempc = leftstop; char *temp;
leftstop = rightstop;
rightstop = tempc; cc = swap_mri_condition (cc);
temp = leftstart;
leftstart = rightstart;
rightstart = temp;
temp = leftstop;
leftstop = rightstop;
rightstop = temp;
}
} }
if (truelab == NULL) if (truelab == NULL)
@ -5044,9 +5044,9 @@ parse_mri_control_expression (stop, qual, truelab, falselab, extent)
int c; int c;
int cc; int cc;
char *leftstart; char *leftstart;
const char *leftstop; char *leftstop;
char *rightstart; char *rightstart;
const char *rightstop; char *rightstop;
c = *stop; c = *stop;
*stop = '\0'; *stop = '\0';
@ -5154,7 +5154,8 @@ s_mri_if (qual)
/* A structured control directive must end with THEN with an /* A structured control directive must end with THEN with an
optional qualifier. */ optional qualifier. */
s = input_line_pointer; s = input_line_pointer;
while (! is_end_of_line[(unsigned char) *s]) while (! is_end_of_line[(unsigned char) *s]
&& (! flag_mri || *s != '*'))
++s; ++s;
--s; --s;
while (s > input_line_pointer && (*s == ' ' || *s == '\t')) while (s > input_line_pointer && (*s == ' ' || *s == '\t'))
@ -5205,6 +5206,12 @@ s_mri_if (qual)
else else
input_line_pointer = s + 1; input_line_pointer = s + 1;
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5261,6 +5268,12 @@ s_mri_else (qual)
colon (mri_control_stack->next); colon (mri_control_stack->next);
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5287,6 +5300,12 @@ s_mri_endi (ignore)
pop_mri_control (); pop_mri_control ();
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5320,6 +5339,12 @@ s_mri_break (extent)
md_assemble (buf); md_assemble (buf);
free (buf); free (buf);
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5353,6 +5378,12 @@ s_mri_next (extent)
md_assemble (buf); md_assemble (buf);
free (buf); free (buf);
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5580,6 +5611,12 @@ s_mri_for (qual)
*s = '\0'; *s = '\0';
n->incr = buf; n->incr = buf;
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5610,6 +5647,12 @@ s_mri_endf (ignore)
pop_mri_control (); pop_mri_control ();
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5623,6 +5666,11 @@ s_mri_repeat (ignore)
n = push_mri_control (mri_repeat); n = push_mri_control (mri_repeat);
colon (n->top); colon (n->top);
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5654,6 +5702,12 @@ s_mri_until (qual)
input_line_pointer = s; input_line_pointer = s;
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5668,7 +5722,8 @@ s_mri_while (qual)
struct mri_control_info *n; struct mri_control_info *n;
s = input_line_pointer; s = input_line_pointer;
while (! is_end_of_line[(unsigned char) *s]) while (! is_end_of_line[(unsigned char) *s]
&& (! flag_mri || *s != '*'))
s++; s++;
--s; --s;
while (*s == ' ' || *s == '\t') while (*s == ' ' || *s == '\t')
@ -5695,6 +5750,12 @@ s_mri_while (qual)
if (*input_line_pointer == '.') if (*input_line_pointer == '.')
input_line_pointer += 2; input_line_pointer += 2;
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }
@ -5723,6 +5784,12 @@ s_mri_endw (ignore)
pop_mri_control (); pop_mri_control ();
if (flag_mri)
{
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
} }