aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1997-04-10 23:40:30 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1997-04-10 23:40:30 +0000
commitf3f00e9486bea45381acd8d156117351c22513dd (patch)
tree3a75b5c1c0ad3db24c09b476c2fcb072f7a37c7c
parenta394e3262fa7a03f9ca4e198044de683999457f0 (diff)
downloadgdb-f3f00e9486bea45381acd8d156117351c22513dd.zip
gdb-f3f00e9486bea45381acd8d156117351c22513dd.tar.gz
gdb-f3f00e9486bea45381acd8d156117351c22513dd.tar.bz2
* cgen.c (cgen_parse_operand): Renamed from cgen_asm_parse_operand.
New argument `want'. Update enum cgen_parse_operand_result values. Initialize if CGEN_PARSE_OPERAND_INIT. * config/tc-m32r.c (md_begin): Set cgen_parse_operand_fn. (md_assemble): Call cgen_asm_init_parse. Update call to m32r_cgen_assemble_insn, call as_bad if assembly failed.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/cgen.c32
2 files changed, 28 insertions, 9 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 880e9a5..4b49623 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,6 +1,9 @@
Thu Apr 10 14:40:00 1997 Doug Evans <dje@canuck.cygnus.com>
- * config/tc-m32r.c (md_begin): Set cgen_asm_parse_operand_fn.
+ * cgen.c (cgen_parse_operand): Renamed from cgen_asm_parse_operand.
+ New argument `want'. Update enum cgen_parse_operand_result values.
+ Initialize if CGEN_PARSE_OPERAND_INIT.
+ * config/tc-m32r.c (md_begin): Set cgen_parse_operand_fn.
(md_assemble): Call cgen_asm_init_parse.
Update call to m32r_cgen_assemble_insn, call as_bad if assembly failed.
diff --git a/gas/cgen.c b/gas/cgen.c
index 355268f..3ed8d99 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -61,6 +61,9 @@ struct fixup
static struct fixup fixups[MAX_FIXUPS];
static int num_fixups;
+/* Prepare to parse an instruction.
+ ??? May wish to make this static and delete calls in md_assemble. */
+
void
cgen_asm_init_parse ()
{
@@ -161,50 +164,63 @@ cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp)
/* Callback for cgen interface. Parse the expression at *STRP.
The result is an error message or NULL for success (in which case
*STRP is advanced past the parsed text).
- An enum cgen_asm_result is stored in RESULTP.
+ WANT is an indication of what the caller is looking for.
+ If WANT == CGEN_ASM_PARSE_INIT the caller is beginning to try to match
+ a table entry with the insn, reset the queued fixups counter.
+ An enum cgen_parse_operand_result is stored in RESULTP.
+ OPINDEX is the operand's table entry index.
OPINFO is something the caller chooses to help in reloc determination.
The resulting value is stored in VALUEP. */
const char *
-cgen_asm_parse_operand (strP, opindex, opinfo, resultP, valueP)
+cgen_parse_operand (want, strP, opindex, opinfo, resultP, valueP)
+ enum cgen_parse_operand_type want;
const char **strP;
int opindex;
int opinfo;
- enum cgen_asm_result *resultP;
+ enum cgen_parse_operand_result *resultP;
bfd_vma *valueP;
{
char *hold;
const char *errmsg = NULL;
expressionS exp;
+ if (want == CGEN_PARSE_OPERAND_INIT)
+ {
+ cgen_asm_init_parse ();
+ return NULL;
+ }
+
hold = input_line_pointer;
input_line_pointer = (char *) *strP;
expression (&exp);
*strP = input_line_pointer;
input_line_pointer = hold;
+ /* FIXME: Need to check `want'. */
+
switch (exp.X_op)
{
case O_illegal :
errmsg = "illegal operand";
- *resultP = CGEN_ASM_ERROR;
+ *resultP = CGEN_PARSE_OPERAND_RESULT_ERROR;
break;
case O_absent :
errmsg = "missing operand";
- *resultP = CGEN_ASM_ERROR;
+ *resultP = CGEN_PARSE_OPERAND_RESULT_ERROR;
break;
case O_constant :
*valueP = exp.X_add_number;
- *resultP = CGEN_ASM_NUMBER;
+ *resultP = CGEN_PARSE_OPERAND_RESULT_NUMBER;
break;
case O_register :
*valueP = exp.X_add_number;
- *resultP = CGEN_ASM_REGISTER;
+ *resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER;
break;
default :
cgen_queue_fixup (opindex, opinfo, &exp);
*valueP = 0;
- *resultP = CGEN_ASM_QUEUED;
+ *resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED;
break;
}