diff options
author | Jeff Law <law@redhat.com> | 1996-08-23 19:01:37 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1996-08-23 19:01:37 +0000 |
commit | c9f1b2d9c7ff7bd2c9e86d9c703c8d5bb4ad23b0 (patch) | |
tree | 620176c2232e08e103d980252b5a6715ddb0995c | |
parent | 6c1fc4d3fab30c3d39c9c5f48819f036b5b75ff4 (diff) | |
download | gdb-c9f1b2d9c7ff7bd2c9e86d9c703c8d5bb4ad23b0.zip gdb-c9f1b2d9c7ff7bd2c9e86d9c703c8d5bb4ad23b0.tar.gz gdb-c9f1b2d9c7ff7bd2c9e86d9c703c8d5bb4ad23b0.tar.bz2 |
* config/tc-v850.c (CC_NAME_CNT): Define.
(cc_name): New function.
(md_assemble): Handle V850_OPERAND_CC correctly.
setf stuff
-rw-r--r-- | gas/ChangeLog | 4 | ||||
-rw-r--r-- | gas/config/tc-v850.c | 62 |
2 files changed, 66 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 53d8736..1622897 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -7,6 +7,10 @@ end-sanitize-d10v start-sanitize-v850 Fri Aug 23 10:41:32 1996 Jeffrey A Law (law@cygnus.com) + * config/tc-v850.c (CC_NAME_CNT): Define. + (cc_name): New function. + (md_assemble): Handle V850_OPERAND_CC correctly. + * config/tc-v850.c (md_assemble): Don't forget to initialize "insn"! diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 68b1ceae..79bd779 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -59,6 +59,7 @@ static unsigned long v850_insert_operand static int reg_name_search PARAMS ((char *name, const struct reg_name *, int)); static boolean register_name PARAMS ((expressionS *expressionP)); static boolean system_register_name PARAMS ((expressionS *expressionP)); +static boolean cc_name PARAMS ((expressionS *expressionP)); static int postfix PARAMS ((char *p)); static bfd_reloc_code_real_type get_reloc PARAMS ((struct v850_operand *op)); static unsigned long build_insn PARAMS ((struct v850_opcode *opcode, expressionS *opers)); @@ -178,6 +179,7 @@ static const struct reg_name cc_names[] = { "v", 0x0 }, { "z", 0x2 }, }; +#define CC_NAME_CNT (sizeof(cc_names) / sizeof(struct reg_name)) /* reg_name_search does a binary search of the given register table to see if "name" is a valid regiter name. Returns the register @@ -301,6 +303,52 @@ system_register_name (expressionP) } } +/* Summary of cc_name(). + * + * in: Input_line_pointer points to 1st char of operand. + * + * out: A expressionS. + * The operand may have been a register: in this case, X_op == O_register, + * X_add_number is set to the register number, and truth is returned. + * Input_line_pointer->(next non-blank) char after operand, or is in + * its original state. + */ +static boolean +cc_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char *name; + char *start; + char c; + + /* Find the spelling of the operand */ + start = name = input_line_pointer; + + c = get_symbol_end (); + reg_number = reg_name_search (name, cc_names, CC_NAME_CNT - 1); + + /* look to see if it's in the register table */ + if (reg_number >= 0) + { + expressionP->X_op = O_constant; + expressionP->X_add_number = reg_number; + + /* make the rest nice */ + expressionP->X_add_symbol = NULL; + expressionP->X_op_symbol = NULL; + *input_line_pointer = c; /* put back the delimiting char */ + return true; + } + else + { + /* reset the line as if we had not done anything */ + *input_line_pointer = c; /* put back the delimiting char */ + input_line_pointer = start; /* reset input_line pointer */ + return false; + } +} + void md_show_usage (stream) FILE *stream; @@ -509,6 +557,14 @@ md_assemble (str) goto error; } } + else if ((operand->flags & V850_OPERAND_CC) != 0) + { + if (!cc_name(&ex)) + { + errmsg = "invalid condition code name"; + goto error; + } + } else if (strncmp(input_line_pointer, "lo(", 3) == 0) { input_line_pointer += 3; @@ -569,6 +625,12 @@ md_assemble (str) errmsg = "syntax error: system register not expected"; goto error; } + else if (cc_name (&ex) + && (operand->flags & V850_OPERAND_CC) == 0) + { + errmsg = "syntax error: condition code not expected"; + goto error; + } else { expression(&ex); |