aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-09-19 15:36:38 +0000
committerIan Lance Taylor <ian@airs.com>1995-09-19 15:36:38 +0000
commite1c0287d1c8d2ba3ff67f0d1babc89a5d24c96d3 (patch)
treefa5effc231ef2ac4688f610b2b4dce1bed41a11d
parent486e0f0ac5320742b2765d5ee103c661e22f0553 (diff)
downloadgdb-e1c0287d1c8d2ba3ff67f0d1babc89a5d24c96d3.zip
gdb-e1c0287d1c8d2ba3ff67f0d1babc89a5d24c96d3.tar.gz
gdb-e1c0287d1c8d2ba3ff67f0d1babc89a5d24c96d3.tar.bz2
* 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.
-rw-r--r--gas/ChangeLog15
-rw-r--r--gas/config/tc-m68k.c157
2 files changed, 127 insertions, 45 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 27d5e78..426e5d5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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>
* config/tc-m68k.c (parse_mri_control_operand): Change leftstart
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 652b54a..01200f0 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -4708,12 +4708,12 @@ static struct mri_control_info *push_mri_control
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));
@@ -4810,9 +4810,9 @@ static 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;
@@ -4937,52 +4937,52 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart,
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)
@@ -5044,9 +5044,9 @@ parse_mri_control_expression (stop, qual, truelab, falselab, extent)
int c;
int cc;
char *leftstart;
- const char *leftstop;
+ char *leftstop;
char *rightstart;
- const char *rightstop;
+ char *rightstop;
c = *stop;
*stop = '\0';
@@ -5154,7 +5154,8 @@ s_mri_if (qual)
/* 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'))
@@ -5205,6 +5206,12 @@ s_mri_if (qual)
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 ();
}
@@ -5261,6 +5268,12 @@ s_mri_else (qual)
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 ();
}
@@ -5287,6 +5300,12 @@ s_mri_endi (ignore)
pop_mri_control ();
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
@@ -5320,6 +5339,12 @@ s_mri_break (extent)
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 ();
}
@@ -5353,6 +5378,12 @@ s_mri_next (extent)
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 ();
}
@@ -5580,6 +5611,12 @@ s_mri_for (qual)
*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 ();
}
@@ -5610,6 +5647,12 @@ s_mri_endf (ignore)
pop_mri_control ();
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}
@@ -5623,6 +5666,11 @@ s_mri_repeat (ignore)
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 ();
}
@@ -5654,6 +5702,12 @@ s_mri_until (qual)
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 ();
}
@@ -5668,7 +5722,8 @@ s_mri_while (qual)
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')
@@ -5695,6 +5750,12 @@ s_mri_while (qual)
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 ();
}
@@ -5723,6 +5784,12 @@ s_mri_endw (ignore)
pop_mri_control ();
+ if (flag_mri)
+ {
+ while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ ++input_line_pointer;
+ }
+
demand_empty_rest_of_line ();
}