aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>1999-10-18 22:29:15 +0000
committerMichael Meissner <gnu@the-meissners.org>1999-10-18 22:29:15 +0000
commit446a06c9b8819b20be7704f0b540471d76959c66 (patch)
tree3cd5e989d37bc3540f2f33bfc0b290e9cb783878 /gas
parenta67a87777490844b90870b030a0669e752427ad9 (diff)
downloadgdb-446a06c9b8819b20be7704f0b540471d76959c66.zip
gdb-446a06c9b8819b20be7704f0b540471d76959c66.tar.gz
gdb-446a06c9b8819b20be7704f0b540471d76959c66.tar.bz2
Add md expression support; Cleanup alpha warnings
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog44
-rw-r--r--gas/config/tc-alpha.c73
-rw-r--r--gas/expr.c8
-rw-r--r--gas/expr.h27
4 files changed, 114 insertions, 38 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8afc9fe..6cfad1d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,47 @@
+1999-10-18 Michael Meissner <meissner@cygnus.com>
+
+ * expr.h (operatorT): Add machine dependent operators md1..md8.
+ (expressionS): Make X_op 8 bits instead of 7. Add a X_md field
+ for the machine dependent operators to use.
+
+ * expr.c (op_rank): Add machine dependent operators.
+
+ * config/tc-alpha.c (O_pregister): Define as a machine dependent
+ operator.
+ (O_cpregister): Ditto.
+ (md_begin): Change X_op test that field is wide enough to use
+ O_max instead of O_alpha_max.
+ (cpu_types): Fill in missing initializer.
+ (alpha_num_macros): Make unsigned.
+ (md_assemble): Make opnamelen be size_t.
+ (md_apply_fix): Cast alpha_num_operands to int before testing.
+ (alpha_force_relocation): Ditto.
+ (alpha_fix_adjustable): Ditto.
+ (alpha_fix_adjustable): Mark unused arguments ATTRIBUTE_UNUSED.
+ (tc_gen_reloc): Ditto.
+ (tc_get_register): Ditto.
+ (emit_ldgp): Ditto.
+ (emit_lda): Ditto.
+ (emit_ldah): Ditto.
+ (emit_ldil): Ditto.
+ (s_alpha_ent): Ditto.
+ (s_alpha_end): Ditto.
+ (s_alpha_frame): Ditto.
+ (s_alpha_prologue): Ditto.
+ (s_alpha_file): Ditto.
+ (s_alpha_gprel32): Ditto.
+ (s_alpha_proc): Ditto.
+ (s_alpha_set): Ditto.
+ (s_alpha_base): Ditto.
+ (s_alpha_align): Ditto.
+ (s_alpha_arch): Ditto.
+ (alpha_align): Ditto.
+ (assemble_insn): Suppress unused variable warning.
+ (emit_insn): Ditto.
+ (assemble_insn): Don't assume X_op and X_unsigned are in a given
+ order in the structure.
+ (s_alpha_coff_wrapper): Avoid int/unsigned comparison.
+
Sun Oct 17 17:15:58 1999 Jeffrey A Law (law@cygnus.com)
* config/tc-hppa.c (md_apply_fix): Make "fmt" an int.
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 69432dc..3ca8e63 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -93,12 +93,10 @@ struct alpha_macro
enum alpha_macro_arg argsets[16];
};
-/* Two extra symbols we want to see in our input. This is a blatent
- misuse of the expressionS.X_op field. */
+/* Extra expression types. */
-#define O_pregister ((operatorT) (O_max+1)) /* O_register, in parentheses */
-#define O_cpregister ((operatorT) (O_pregister+1)) /* + a leading comma */
-#define O_alpha_max ((operatorT) (O_cpregister+1))
+#define O_pregister O_md1 /* O_register, in parentheses */
+#define O_cpregister O_md2 /* + a leading comma */
/* Macros for extracting the type and number of encoded register tokens */
@@ -467,7 +465,7 @@ static const struct cpu_type
{ "ev6", AXP_OPCODE_BASE|AXP_OPCODE_BWX|AXP_OPCODE_MAX|AXP_OPCODE_CIX },
{ "all", AXP_OPCODE_BASE },
- { 0 }
+ { 0, 0 }
};
/* The macro table */
@@ -696,7 +694,7 @@ static const struct alpha_macro alpha_macros[] = {
MACRO_EOA } },
};
-static const int alpha_num_macros
+static const unsigned int alpha_num_macros
= sizeof(alpha_macros) / sizeof(*alpha_macros);
/* Public interface functions */
@@ -713,8 +711,8 @@ md_begin ()
/* Verify that X_op field is wide enough. */
{
expressionS e;
- e.X_op = O_alpha_max;
- assert (e.X_op == O_alpha_max);
+ e.X_op = O_max;
+ assert (e.X_op == O_max);
}
/* Create the opcode hash table */
@@ -824,7 +822,8 @@ md_assemble (str)
{
char opname[32]; /* current maximum is 13 */
expressionS tok[MAX_INSN_ARGS];
- int ntok, opnamelen, trunclen;
+ int ntok, trunclen;
+ size_t opnamelen;
/* split off the opcode */
opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/468");
@@ -1173,7 +1172,7 @@ md_apply_fix (fixP, valueP)
as_fatal (_("unhandled relocation type %s"),
bfd_get_reloc_code_name (fixP->fx_r_type));
- assert (-(int)fixP->fx_r_type < alpha_num_operands);
+ assert (-(int)fixP->fx_r_type < (int)alpha_num_operands);
operand = &alpha_operands[-(int)fixP->fx_r_type];
/* The rest of these fixups only exist internally during symbol
@@ -1334,7 +1333,7 @@ alpha_force_relocation (f)
return 0;
default:
- assert((int)f->fx_r_type < 0 && -(int)f->fx_r_type < alpha_num_operands);
+ assert((int)f->fx_r_type < 0 && -(int)f->fx_r_type < (int)alpha_num_operands);
return 0;
}
}
@@ -1384,7 +1383,7 @@ alpha_fix_adjustable (f)
default:
assert ((int)f->fx_r_type < 0
- && - (int)f->fx_r_type < alpha_num_operands);
+ && - (int)f->fx_r_type < (int)alpha_num_operands);
return 1;
}
/*NOTREACHED*/
@@ -1395,7 +1394,7 @@ alpha_fix_adjustable (f)
arelent *
tc_gen_reloc (sec, fixp)
- asection *sec;
+ asection *sec ATTRIBUTE_UNUSED;
fixS *fixp;
{
arelent *reloc;
@@ -1459,7 +1458,7 @@ tc_gen_reloc (sec, fixp)
int
tc_get_register (frame)
- int frame;
+ int frame ATTRIBUTE_UNUSED;
{
int framereg = AXP_REG_SP;
@@ -1846,7 +1845,7 @@ assemble_insn(opcode, tok, ntok, insn)
for (argidx = opcode->operands; *argidx; ++argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
- const expressionS *t;
+ const expressionS *t = (const expressionS *)0;
if (operand->flags & AXP_OPERAND_FAKE)
{
@@ -1867,8 +1866,10 @@ assemble_insn(opcode, tok, ntok, insn)
break;
case AXP_OPERAND_DEFAULT_ZERO:
{
- static const expressionS zero_exp = { 0, 0, 0, O_constant, 1 };
+ static expressionS zero_exp;
t = &zero_exp;
+ zero_exp.X_op = O_constant;
+ zero_exp.X_unsigned = 1;
}
break;
default:
@@ -1935,7 +1936,7 @@ emit_insn (insn)
/* Apply the fixups in order */
for (i = 0; i < insn->nfixups; ++i)
{
- const struct alpha_operand *operand;
+ const struct alpha_operand *operand = (const struct alpha_operand *)0;
struct alpha_fixup *fixup = &insn->fixups[i];
int size, pcrel;
fixS *fixP;
@@ -2105,8 +2106,8 @@ static const char * const ldXu_op[] = { "ldbu", "ldwu", NULL, NULL };
static void
emit_ldgp (tok, ntok, unused)
const expressionS *tok;
- int ntok;
- const PTR unused;
+ int ntok ATTRIBUTE_UNUSED;
+ const PTR unused ATTRIBUTE_UNUSED;
{
#ifdef OBJ_AOUT
FIXME
@@ -2589,7 +2590,7 @@ static void
emit_lda (tok, ntok, unused)
const expressionS *tok;
int ntok;
- const PTR unused;
+ const PTR unused ATTRIBUTE_UNUSED;
{
int basereg;
@@ -2607,8 +2608,8 @@ emit_lda (tok, ntok, unused)
static void
emit_ldah (tok, ntok, unused)
const expressionS *tok;
- int ntok;
- const PTR unused;
+ int ntok ATTRIBUTE_UNUSED;
+ const PTR unused ATTRIBUTE_UNUSED;
{
expressionS newtok[3];
@@ -2843,7 +2844,7 @@ static void
emit_ldil (tok, ntok, unused)
const expressionS *tok;
int ntok;
- const PTR unused;
+ const PTR unused ATTRIBUTE_UNUSED;
{
expressionS newtok[2];
@@ -3544,7 +3545,7 @@ s_alpha_section (ignore)
static void
s_alpha_ent (dummy)
- int dummy;
+ int dummy ATTRIBUTE_UNUSED;
{
if (ECOFF_DEBUGGING)
ecoff_directive_ent (0);
@@ -3588,7 +3589,7 @@ s_alpha_ent (dummy)
static void
s_alpha_end (dummy)
- int dummy;
+ int dummy ATTRIBUTE_UNUSED;
{
if (ECOFF_DEBUGGING)
ecoff_directive_end (0);
@@ -3648,7 +3649,7 @@ s_alpha_mask (fp)
static void
s_alpha_frame (dummy)
- int dummy;
+ int dummy ATTRIBUTE_UNUSED;
{
if (ECOFF_DEBUGGING)
ecoff_directive_frame (0);
@@ -3658,7 +3659,7 @@ s_alpha_frame (dummy)
static void
s_alpha_prologue (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
symbolS *sym;
int arg;
@@ -3706,7 +3707,7 @@ s_alpha_coff_wrapper (which)
ecoff_directive_loc,
};
- assert (which >= 0 && which < sizeof(fns)/sizeof(*fns));
+ assert (which >= 0 && which < (int)(sizeof(fns)/sizeof(*fns)));
if (ECOFF_DEBUGGING)
(*fns[which])(0);
@@ -4171,7 +4172,7 @@ s_alpha_file (ignore)
static void
s_alpha_gprel32 (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
expressionS e;
char *p;
@@ -4266,7 +4267,7 @@ s_alpha_float_cons (type)
static void
s_alpha_proc (is_static)
- int is_static;
+ int is_static ATTRIBUTE_UNUSED;
{
char *name;
char c;
@@ -4305,7 +4306,7 @@ s_alpha_proc (is_static)
static void
s_alpha_set (x)
- int x;
+ int x ATTRIBUTE_UNUSED;
{
char *name, ch, *s;
int yesno = 1;
@@ -4342,7 +4343,7 @@ s_alpha_set (x)
static void
s_alpha_base (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
#if 0
if (first_32bit_quadrant)
@@ -4377,7 +4378,7 @@ s_alpha_base (ignore)
static void
s_alpha_align (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
int align;
char fill, *pfill;
@@ -4475,7 +4476,7 @@ s_alpha_ucons (bytes)
static void
s_alpha_arch (ignored)
- int ignored;
+ int ignored ATTRIBUTE_UNUSED;
{
char *name, ch;
const struct cpu_type *p;
@@ -4719,7 +4720,7 @@ alpha_align (n, pfill, label, force)
int n;
char *pfill;
symbolS *label;
- int force;
+ int force ATTRIBUTE_UNUSED;
{
if (alpha_current_align >= n)
return;
diff --git a/gas/expr.c b/gas/expr.c
index acf2804..bb4fd55 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -1484,6 +1484,14 @@ static operator_rankT op_rank[] =
3, /* O_logical_and */
2, /* O_logical_or */
1, /* O_index */
+ 0, /* O_md1 */
+ 0, /* O_md2 */
+ 0, /* O_md3 */
+ 0, /* O_md4 */
+ 0, /* O_md5 */
+ 0, /* O_md6 */
+ 0, /* O_md7 */
+ 0, /* O_md8 */
};
/* Unfortunately, in MRI mode for the m68k, multiplication and
diff --git a/gas/expr.h b/gas/expr.h
index e376409..d7c7a3b 100644
--- a/gas/expr.h
+++ b/gas/expr.h
@@ -104,6 +104,22 @@ typedef enum
O_logical_or,
/* X_op_symbol [ X_add_symbol ] */
O_index,
+ /* machine dependent #1 */
+ O_md1,
+ /* machine dependent #2 */
+ O_md2,
+ /* machine dependent #3 */
+ O_md3,
+ /* machine dependent #4 */
+ O_md4,
+ /* machine dependent #5 */
+ O_md5,
+ /* machine dependent #6 */
+ O_md6,
+ /* machine dependent #7 */
+ O_md7,
+ /* machine dependent #8 */
+ O_md8,
/* this must be the largest value */
O_max
} operatorT;
@@ -116,20 +132,27 @@ typedef struct expressionS
symbolS *X_op_symbol;
/* A number to add. */
offsetT X_add_number;
+
/* The type of the expression. We can't assume that an arbitrary
compiler can handle a bitfield of enum type. FIXME: We could
check this using autoconf. */
#ifdef __GNUC__
- operatorT X_op : 7;
+ operatorT X_op : 8;
#else
- unsigned X_op : 7;
+ unsigned char X_op;
#endif
+
/* Non-zero if X_add_number should be regarded as unsigned. This is
only valid for O_constant expressions. It is only used when an
O_constant must be extended into a bignum (i.e., it is not used
when performing arithmetic on these values).
FIXME: This field is not set very reliably. */
unsigned int X_unsigned : 1;
+
+ /* 7 additional bits can be defined if needed. */
+
+ /* Machine dependent field */
+ unsigned short X_md;
} expressionS;
/* "result" should be type (expressionS *). */