+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>
* config/tc-m68k.c (parse_mri_control_operand): Change leftstart
static void pop_mri_control PARAMS ((void));
static int parse_mri_condition PARAMS ((int *));
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 reverse_mri_condition PARAMS ((int));
static void build_mri_control_operand
- PARAMS ((int, int, char *, const char *, char *, const char *,
- const char *, const char *, int));
+ PARAMS ((int, int, char *, char *, char *, char *, const char *,
+ const char *, int));
static void parse_mri_control_expression
PARAMS ((char *, int, const char *, const char *, int));
parse_mri_control_operand (pcc, leftstart, leftstop, rightstart, rightstop)
int *pcc;
char **leftstart;
- const char **leftstop;
+ char **leftstop;
char **rightstart;
- const char **rightstop;
+ char **rightstop;
{
char *s;
int qual;
int cc;
char *leftstart;
- const char *leftstop;
+ char *leftstop;
char *rightstart;
- const char *rightstop;
+ char *rightstop;
const char *truelab;
const char *falselab;
int extent;
{
- int leftreg, rightreg;
char *buf;
char *s;
- /* See which sides of the comparison are plain registers. */
- if (leftstart == NULL)
- leftreg = 0;
- else
- {
- char *l;
-
- l = leftstart;
- leftreg = m68k_reg_parse (&l) != 0;
- }
- if (rightstart == NULL)
- rightreg = 0;
- else
+ if (leftstart != NULL)
{
- char *l;
-
- l = rightstart;
- rightreg = m68k_reg_parse (&l) != 0;
- }
+ struct m68k_op leftop, rightop;
+ char c;
- /* Swap the compare operands, if necessary, to produce a legal m68k
- compare instruction. */
- if ((leftreg && ! rightreg)
- || (rightstart != NULL && *rightstart == '#'))
- {
- char *temp;
- const char *tempc;
-
- cc = swap_mri_condition (cc);
- temp = leftstart;
- leftstart = rightstart;
- rightstart = temp;
- tempc = leftstop;
- leftstop = rightstop;
- rightstop = tempc;
+ /* Swap the compare operands, if necessary, to produce a legal
+ m68k compare instruction. Comparing a register operand with
+ a non-register operand requires the register to be on the
+ right (cmp, cmpa). Comparing an immediate value with
+ anything requires the immediate value to be on the left
+ (cmpi). */
+
+ c = *leftstop;
+ *leftstop = '\0';
+ (void) m68k_ip_op (leftstart, &leftop);
+ *leftstop = c;
+
+ c = *rightstop;
+ *rightstop = '\0';
+ (void) m68k_ip_op (rightstart, &rightop);
+ *rightstop = c;
+
+ if (rightop.mode == IMMED
+ || ((leftop.mode == DREG || leftop.mode == AREG)
+ && (rightop.mode != DREG && rightop.mode != AREG)))
+ {
+ char *temp;
+
+ cc = swap_mri_condition (cc);
+ temp = leftstart;
+ leftstart = rightstart;
+ rightstart = temp;
+ temp = leftstop;
+ leftstop = rightstop;
+ rightstop = temp;
+ }
}
if (truelab == NULL)
int c;
int cc;
char *leftstart;
- const char *leftstop;
+ char *leftstop;
char *rightstart;
- const char *rightstop;
+ char *rightstop;
c = *stop;
*stop = '\0';
/* A structured control directive must end with THEN with an
optional qualifier. */
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;
while (s > input_line_pointer && (*s == ' ' || *s == '\t'))
else
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 ();
}
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 ();
}
pop_mri_control ();
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
md_assemble (buf);
free (buf);
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
md_assemble (buf);
free (buf);
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
*s = '\0';
n->incr = buf;
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
pop_mri_control ();
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
n = push_mri_control (mri_repeat);
colon (n->top);
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
demand_empty_rest_of_line ();
}
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 ();
}
struct mri_control_info *n;
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;
while (*s == ' ' || *s == '\t')
if (*input_line_pointer == '.')
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 ();
}
pop_mri_control ();
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
\f