/* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU.
- Copyright (C) 1989, 93-98, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Contributed by Carnegie Mellon University, 1993.
Written by Alessandro Forin, based on earlier gas-1.38 target CPU files.
Modified by Ken Raeburn for gas-2.x and ECOFF support.
#endif
#include <ctype.h>
-
\f
/* Local types */
#define MAX_INSN_FIXUPS 2
#define MAX_INSN_ARGS 5
-struct alpha_fixup
-{
+struct alpha_fixup {
expressionS exp;
bfd_reloc_code_real_type reloc;
};
-struct alpha_insn
-{
+struct alpha_insn {
unsigned insn;
int nfixups;
struct alpha_fixup fixups[MAX_INSN_FIXUPS];
unsigned sequence[MAX_INSN_FIXUPS];
};
-enum alpha_macro_arg
-{
+enum alpha_macro_arg {
MACRO_EOA = 1,
MACRO_IR,
MACRO_PIR,
MACRO_JSR
};
-struct alpha_macro
-{
+struct alpha_macro {
const char *name;
void (*emit) PARAMS ((const expressionS *, int, const PTR));
const PTR arg;
#define range_signed_32(x) \
(((offsetT) (x) >> 31) == 0 || ((offsetT) (x) >> 31) == -1)
#else
-#define range_signed_16(x) ((offsetT) (x) >= -(offsetT)0x8000 && \
- (offsetT) (x) <= (offsetT)0x7FFF)
-#define range_signed_32(x) ((offsetT) (x) >= -(offsetT)0x80000000 && \
- (offsetT) (x) <= (offsetT)0x7FFFFFFF)
+#define range_signed_16(x) ((offsetT) (x) >= -(offsetT) 0x8000 && \
+ (offsetT) (x) <= (offsetT) 0x7FFF)
+#define range_signed_32(x) ((offsetT) (x) >= -(offsetT) 0x80000000 && \
+ (offsetT) (x) <= (offsetT) 0x7FFFFFFF)
#endif
/* Macros for sign extending from 16- and 32-bits. */
/* Macros to build tokens */
-#define set_tok_reg(t, r) (memset(&(t), 0, sizeof (t)), \
+#define set_tok_reg(t, r) (memset (&(t), 0, sizeof (t)), \
(t).X_op = O_register, \
(t).X_add_number = (r))
-#define set_tok_preg(t, r) (memset(&(t), 0, sizeof (t)), \
+#define set_tok_preg(t, r) (memset (&(t), 0, sizeof (t)), \
(t).X_op = O_pregister, \
(t).X_add_number = (r))
-#define set_tok_cpreg(t, r) (memset(&(t), 0, sizeof (t)), \
+#define set_tok_cpreg(t, r) (memset (&(t), 0, sizeof (t)), \
(t).X_op = O_cpregister, \
(t).X_add_number = (r))
-#define set_tok_freg(t, r) (memset(&(t), 0, sizeof (t)), \
+#define set_tok_freg(t, r) (memset (&(t), 0, sizeof (t)), \
(t).X_op = O_register, \
- (t).X_add_number = (r)+32)
-#define set_tok_sym(t, s, a) (memset(&(t), 0, sizeof (t)), \
+ (t).X_add_number = (r) + 32)
+#define set_tok_sym(t, s, a) (memset (&(t), 0, sizeof (t)), \
(t).X_op = O_symbol, \
(t).X_add_symbol = (s), \
(t).X_add_number = (a))
-#define set_tok_const(t, n) (memset(&(t), 0, sizeof (t)), \
+#define set_tok_const(t, n) (memset (&(t), 0, sizeof (t)), \
(t).X_op = O_constant, \
(t).X_add_number = (n))
-
\f
/* Prototypes for all local functions */
#ifdef RELOC_OP_P
static void alpha_adjust_symtab_relocs PARAMS ((bfd *, asection *, PTR));
#endif
-
\f
/* Generic assembler global variables which must be defined by all
targets. */
struct option md_longopts[] = {
#define OPTION_32ADDR (OPTION_MD_BASE)
{ "32addr", no_argument, NULL, OPTION_32ADDR },
-#define OPTION_RELAX (OPTION_32ADDR+1)
+#define OPTION_RELAX (OPTION_32ADDR + 1)
{ "relax", no_argument, NULL, OPTION_RELAX },
#ifdef OBJ_ELF
-#define OPTION_MDEBUG (OPTION_RELAX+1)
-#define OPTION_NO_MDEBUG (OPTION_MDEBUG+1)
+#define OPTION_MDEBUG (OPTION_RELAX + 1)
+#define OPTION_NO_MDEBUG (OPTION_MDEBUG + 1)
{ "mdebug", no_argument, NULL, OPTION_MDEBUG },
{ "no-mdebug", no_argument, NULL, OPTION_NO_MDEBUG },
#endif
};
size_t md_longopts_size = sizeof (md_longopts);
-
\f
#ifdef OBJ_EVAX
#define AXP_REG_R0 0
#define ALPHA_RELOC_TABLE(op) \
&alpha_reloc_op[ ((!USER_RELOC_P (op)) \
? (abort (), 0) \
- : (int) (op) - (int)O_literal) ]
+ : (int) (op) - (int) O_literal) ]
#define LITUSE_BASE 1
#define LITUSE_BYTOFF 2
\f
/* A table of CPU names and opcode sets. */
-static const struct cpu_type
-{
+static const struct cpu_type {
const char *name;
unsigned flags;
-} cpu_types[] =
-{
+} cpu_types[] = {
/* Ad hoc convention: cpu number gets palcode, process code doesn't.
This supports usage under DU 4.0b that does ".arch ev4", and
usage in MILO that does -m21064. Probably something more
{ "ldt", emit_loadstore, "ldt",
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ldb", emit_ldX, (PTR)0,
+ { "ldb", emit_ldX, (PTR) 0,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ldbu", emit_ldXu, (PTR)0,
+ { "ldbu", emit_ldXu, (PTR) 0,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ldw", emit_ldX, (PTR)1,
+ { "ldw", emit_ldX, (PTR) 1,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ldwu", emit_ldXu, (PTR)1,
+ { "ldwu", emit_ldXu, (PTR) 1,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "uldw", emit_uldX, (PTR)1,
+ { "uldw", emit_uldX, (PTR) 1,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "uldwu", emit_uldXu, (PTR)1,
+ { "uldwu", emit_uldXu, (PTR) 1,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "uldl", emit_uldX, (PTR)2,
+ { "uldl", emit_uldX, (PTR) 2,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "uldlu", emit_uldXu, (PTR)2,
+ { "uldlu", emit_uldXu, (PTR) 2,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "uldq", emit_uldXu, (PTR)3,
+ { "uldq", emit_uldXu, (PTR) 3,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
{ "ldgp", emit_ldgp, NULL,
{ "stt", emit_loadstore, "stt",
{ MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "stb", emit_stX, (PTR)0,
+ { "stb", emit_stX, (PTR) 0,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "stw", emit_stX, (PTR)1,
+ { "stw", emit_stX, (PTR) 1,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ustw", emit_ustX, (PTR)1,
+ { "ustw", emit_ustX, (PTR) 1,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ustl", emit_ustX, (PTR)2,
+ { "ustl", emit_ustX, (PTR) 2,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
- { "ustq", emit_ustX, (PTR)3,
+ { "ustq", emit_ustX, (PTR) 3,
{ MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } },
/* Arithmetic macros */
{ "absq" emit_absq, 2, { EXP, IR } },
#endif
- { "sextb", emit_sextX, (PTR)0,
+ { "sextb", emit_sextX, (PTR) 0,
{ MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EOA,
/* MACRO_EXP, MACRO_IR, MACRO_EOA */ } },
- { "sextw", emit_sextX, (PTR)1,
+ { "sextw", emit_sextX, (PTR) 1,
{ MACRO_IR, MACRO_IR, MACRO_EOA,
MACRO_IR, MACRO_EOA,
/* MACRO_EXP, MACRO_IR, MACRO_EOA */ } },
/* Create the opcode hash table */
alpha_opcode_hash = hash_new ();
- for (i = 0; i < alpha_num_opcodes; )
+ for (i = 0; i < alpha_num_opcodes;)
{
const char *name, *retval, *slash;
name = alpha_opcodes[i].name;
- retval = hash_insert (alpha_opcode_hash, name, (PTR)&alpha_opcodes[i]);
+ retval = hash_insert (alpha_opcode_hash, name, (PTR) &alpha_opcodes[i]);
if (retval)
as_fatal (_("internal error: can't hash opcode `%s': %s"), name, retval);
memcpy (p, name, slash - name);
strcpy (p + (slash - name), slash + 1);
- (void)hash_insert(alpha_opcode_hash, p, (PTR)&alpha_opcodes[i]);
+ (void) hash_insert (alpha_opcode_hash, p, (PTR) &alpha_opcodes[i]);
/* Ignore failures -- the opcode table does duplicate some
variants in different forms, like "hw_stq" and "hw_st/q". */
}
/* Create the macro hash table */
alpha_macro_hash = hash_new ();
- for (i = 0; i < alpha_num_macros; )
+ for (i = 0; i < alpha_num_macros;)
{
const char *name, *retval;
name = alpha_macros[i].name;
- retval = hash_insert (alpha_macro_hash, name, (PTR)&alpha_macros[i]);
+ retval = hash_insert (alpha_macro_hash, name, (PTR) &alpha_macros[i]);
if (retval)
- as_fatal (_("internal error: can't hash macro `%s': %s"), name, retval);
+ as_fatal (_("internal error: can't hash macro `%s': %s"),
+ name, retval);
while (++i < alpha_num_macros
&& (alpha_macros[i].name == name
{
char name[4];
sprintf (name, "$%d", i);
- alpha_register_table[i] = symbol_create(name, reg_section, i,
- &zero_address_frag);
+ alpha_register_table[i] = symbol_create (name, reg_section, i,
+ &zero_address_frag);
}
for (; i < 64; ++i)
{
char name[5];
- sprintf (name, "$f%d", i-32);
- alpha_register_table[i] = symbol_create(name, reg_section, i,
- &zero_address_frag);
+ sprintf (name, "$f%d", i - 32);
+ alpha_register_table[i] = symbol_create (name, reg_section, i,
+ &zero_address_frag);
}
/* Create the special symbols and sections we'll be using */
#ifdef OBJ_ELF
if (ECOFF_DEBUGGING)
{
- segT sec = subseg_new(".mdebug", (subsegT)0);
- bfd_set_section_flags(stdoutput, sec, SEC_HAS_CONTENTS|SEC_READONLY);
- bfd_set_section_alignment(stdoutput, sec, 3);
+ segT sec = subseg_new (".mdebug", (subsegT) 0);
+ bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY);
+ bfd_set_section_alignment (stdoutput, sec, 3);
}
#endif /* OBJ_ELF */
- subseg_set(text_section, 0);
+ subseg_set (text_section, 0);
#ifdef RELOC_OP_P
/* Create literal lookup hash table. */
- alpha_literal_hash = hash_new();
+ alpha_literal_hash = hash_new ();
#endif
}
segT seg;
valueT size;
{
- int align = bfd_get_section_alignment(stdoutput, seg);
- valueT mask = ((valueT)1 << align) - 1;
+ int align = bfd_get_section_alignment (stdoutput, seg);
+ valueT mask = ((valueT) 1 << align) - 1;
return (size + mask) & ~mask;
}
break;
case 'G':
- g_switch_value = atoi(arg);
+ g_switch_value = atoi (arg);
break;
case 'm':
{
const struct cpu_type *p;
for (p = cpu_types; p->name; ++p)
- if (strcmp(arg, p->name) == 0)
+ if (strcmp (arg, p->name) == 0)
{
alpha_target_name = p->name, alpha_target = p->flags;
goto found;
}
- as_warn(_("Unknown CPU identifier `%s'"), arg);
+ as_warn (_("Unknown CPU identifier `%s'"), arg);
found:;
}
break;
md_show_usage (stream)
FILE *stream;
{
- fputs(_("\
+ fputs (_("\
Alpha options:\n\
-32addr treat addresses as 32-bit values\n\
-F lack floating point instructions support\n\
GPDISP. */
int
-md_apply_fix (fixP, valueP)
+md_apply_fix3 (fixP, valueP, seg)
fixS *fixP;
valueT *valueP;
+ segT seg;
{
char * const fixpos = fixP->fx_frag->fr_literal + fixP->fx_where;
valueT value = *valueP;
#endif
do_reloc_gp:
- fixP->fx_addsy = section_symbol (now_seg);
+ fixP->fx_addsy = section_symbol (seg);
md_number_to_chars (fixpos, value, 2);
break;
case BFD_RELOC_23_PCREL_S2:
if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0)
{
- image = bfd_getl32(fixpos);
+ image = bfd_getl32 (fixpos);
image = (image & ~0x1FFFFF) | ((value >> 2) & 0x1FFFFF);
goto write_done;
}
case BFD_RELOC_ALPHA_HINT:
if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0)
{
- image = bfd_getl32(fixpos);
+ image = bfd_getl32 (fixpos);
image = (image & ~0x3FFF) | ((value >> 2) & 0x3FFF);
goto write_done;
}
{
const struct alpha_operand *operand;
- if ((int)fixP->fx_r_type >= 0)
+ if ((int) fixP->fx_r_type >= 0)
as_fatal (_("unhandled relocation type %s"),
bfd_get_reloc_code_name (fixP->fx_r_type));
- assert (-(int)fixP->fx_r_type < (int)alpha_num_operands);
- operand = &alpha_operands[-(int)fixP->fx_r_type];
+ 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
resolution and have no representation in the object file.
as_bad_where (fixP->fx_file, fixP->fx_line,
_("non-absolute expression in constant field"));
- image = bfd_getl32(fixpos);
- image = insert_operand(image, operand, (offsetT)value,
- fixP->fx_file, fixP->fx_line);
+ image = bfd_getl32 (fixpos);
+ image = insert_operand (image, operand, (offsetT) value,
+ fixP->fx_file, fixP->fx_line);
}
goto write_done;
}
return 1;
else
{
- as_warn_where(fixP->fx_file, fixP->fx_line,
- _("type %d reloc done?\n"), (int)fixP->fx_r_type);
+ as_warn_where (fixP->fx_file, fixP->fx_line,
+ _("type %d reloc done?\n"), (int) fixP->fx_r_type);
goto done;
}
write_done:
- md_number_to_chars(fixpos, image, 4);
+ md_number_to_chars (fixpos, image, 4);
done:
fixP->fx_done = 1;
*/
symbolS *
-md_undefined_symbol(name)
+md_undefined_symbol (name)
char *name;
{
if (*name == '$')
/* FALLTHRU */
case 'r':
- if (!isdigit(*++name))
+ if (!isdigit (*++name))
break;
/* FALLTHRU */
case '5': case '6': case '7': case '8': case '9':
if (name[1] == '\0')
num = name[0] - '0';
- else if (name[0] != '0' && isdigit(name[1]) && name[2] == '\0')
+ else if (name[0] != '0' && isdigit (name[1]) && name[2] == '\0')
{
num = (name[0] - '0') * 10 + name[1] - '0';
if (num >= 32)
break;
if (!alpha_noat_on && (num + is_float) == AXP_REG_AT)
- as_warn(_("Used $at without \".set noat\""));
+ as_warn (_("Used $at without \".set noat\""));
return alpha_register_table[num + is_float];
case 'a':
if (name[1] == 't' && name[2] == '\0')
{
if (!alpha_noat_on)
- as_warn(_("Used $at without \".set noat\""));
+ as_warn (_("Used $at without \".set noat\""));
return alpha_register_table[AXP_REG_AT];
}
break;
return 0;
default:
- assert((int)f->fx_r_type < 0 && -(int)f->fx_r_type < (int)alpha_num_operands);
+ assert ((int) f->fx_r_type < 0
+ && -(int) f->fx_r_type < (int) alpha_num_operands);
return 0;
}
}
return 1;
default:
- assert ((int)f->fx_r_type < 0
- && - (int)f->fx_r_type < (int)alpha_num_operands);
+ assert ((int) f->fx_r_type < 0
+ && - (int) f->fx_r_type < (int) alpha_num_operands);
return 1;
}
/*NOTREACHED*/
/* Make sure none of our internal relocations make it this far.
They'd better have been fully resolved by this point. */
- assert ((int)fixp->fx_r_type > 0);
+ assert ((int) fixp->fx_r_type > 0);
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == NULL)
* at assembly time. bfd_perform_reloc doesn't know about this sort
* of thing, and as a result we need to fake it out here.
*/
- if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy))
- && !S_IS_COMMON(fixp->fx_addsy))
+ if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)
+ || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE))
+ && !S_IS_COMMON (fixp->fx_addsy))
reloc->addend -= symbol_get_bfdsym (fixp->fx_addsy)->value;
#endif
}
char c = get_symbol_end ();
symbolS *sym = md_undefined_symbol (s);
- *strchr(s, '\0') = c;
+ *strchr (s, '\0') = c;
if (sym && (framereg = S_GET_VALUE (sym)) <= 31)
goto found;
}
\f
#ifdef RELOC_OP_P
-/* Before the relocations are written, reorder them, so that user supplied
- !lituse relocations follow the appropriate !literal relocations. Also
- convert the gas-internal relocations to the appropriate linker relocations.
- */
+/* Before the relocations are written, reorder them, so that user
+ supplied !lituse relocations follow the appropriate !literal
+ relocations. Also convert the gas-internal relocations to the
+ appropriate linker relocations. */
void
alpha_adjust_symtab ()
fprintf (stderr, "alpha_adjust_symtab called\n");
#endif
- /* Go over each section, reordering the relocations so that all of the
- explicit LITUSE's are adjacent to the explicit LITERAL's */
- bfd_map_over_sections (stdoutput, alpha_adjust_symtab_relocs, (char *) 0);
+ /* Go over each section, reordering the relocations so that all
+ of the explicit LITUSE's are adjacent to the explicit
+ LITERAL's. */
+ bfd_map_over_sections (stdoutput, alpha_adjust_symtab_relocs,
+ (char *) 0);
}
}
-
\f
/* Inner function to move LITUSE's next to the LITERAL. */
int n_dup_literals = 0;
#endif
- /* If seginfo is NULL, we did not create this section; don't do anything with
- it. By using a pointer to a pointer, we can update the links in place. */
+ /* If seginfo is NULL, we did not create this section; don't do
+ anything with it. By using a pointer to a pointer, we can update
+ the links in place. */
if (seginfo == NULL)
return;
for (fixp = seginfo->fix_root; fixp; fixp = next)
{
next = fixp->fx_next;
- fixp->fx_next = (fixS *)0;
+ fixp->fx_next = (fixS *) 0;
#ifdef DEBUG2_ALPHA
n++;
#endif
#ifdef DEBUG2_ALPHA
fprintf (stderr,
"alpha_adjust_symtab_relocs: 0x%lx, other relocation %s\n",
- (long)fixp,
+ (long) fixp,
bfd_get_reloc_code_name (fixp->fx_r_type));
#endif
break;
n_dup_literals++;
fprintf (stderr,
"alpha_adjust_symtab_relocs: 0x%lx, !literal!%.6d, # literals = %2d\n",
- (long)fixp,
+ (long) fixp,
fixp->tc_fix_data.info->sequence,
fixp->tc_fix_data.info->n_literals);
#endif
#ifdef DEBUG2_ALPHA
fprintf (stderr,
"alpha_adjust_symtab_relocs: 0x%lx, !lituse !%.6d, # lituses = %2d, next_lituse = 0x%lx\n",
- (long)fixp,
+ (long) fixp,
fixp->tc_fix_data.info->sequence,
fixp->tc_fix_data.info->n_lituses,
- (long)fixp->tc_fix_data.next_lituse);
+ (long) fixp->tc_fix_data.next_lituse);
#endif
break;
}
&& ! fixp->tc_fix_data.info->multi_section_p)
{
for (lituse = fixp->tc_fix_data.info->lituse;
- lituse != (fixS *)0;
+ lituse != (fixS *) 0;
lituse = lituse->tc_fix_data.next_lituse)
{
lituse->fx_next = fixp->fx_next;
}
#endif /* RELOC_OP_P */
-
\f
#ifdef DEBUG_ALPHA
static void
fprintf (stderr, ", %s(%s, %s, %d)", name,
(t->X_add_symbol) ? S_GET_NAME (t->X_add_symbol) : "--",
(t->X_op_symbol) ? S_GET_NAME (t->X_op_symbol) : "--",
- (int)t->X_add_number);
+ (int) t->X_add_number);
}
fprintf (stderr, "\n");
fflush (stderr);
}
r = &alpha_reloc_op[0];
- for (i = alpha_num_reloc_op-1; i >= 0; i--, r++)
+ for (i = alpha_num_reloc_op - 1; i >= 0; i--, r++)
{
if (len == r->length
&& memcmp (input_line_pointer, r->name, len) == 0)
}
if (i < 0)
{
- as_bad (_("Unknown relocation operand: !%s"), input_line_pointer);
+ as_bad (_("Unknown relocation operand: !%s"),
+ input_line_pointer);
goto err_report;
}
if (tok->X_op != O_constant
|| ! ALPHA_RELOC_SEQUENCE_OK (tok->X_add_number))
{
- as_bad (_("Bad sequence number: !%s!%s"), r->name, input_line_pointer);
+ as_bad (_("Bad sequence number: !%s!%s"),
+ r->name, input_line_pointer);
goto err_report;
}
syntax match. */
static const struct alpha_opcode *
-find_opcode_match(first_opcode, tok, pntok, pcpumatch)
+find_opcode_match (first_opcode, tok, pntok, pcpumatch)
const struct alpha_opcode *first_opcode;
const expressionS *tok;
int *pntok;
{
case AXP_OPERAND_IR:
if (tok[tokidx].X_op != O_register
- || !is_ir_num(tok[tokidx].X_add_number))
+ || !is_ir_num (tok[tokidx].X_add_number))
goto match_failed;
break;
case AXP_OPERAND_FPR:
if (tok[tokidx].X_op != O_register
- || !is_fpr_num(tok[tokidx].X_add_number))
+ || !is_fpr_num (tok[tokidx].X_add_number))
goto match_failed;
break;
- case AXP_OPERAND_IR|AXP_OPERAND_PARENS:
+ case AXP_OPERAND_IR | AXP_OPERAND_PARENS:
if (tok[tokidx].X_op != O_pregister
- || !is_ir_num(tok[tokidx].X_add_number))
+ || !is_ir_num (tok[tokidx].X_add_number))
goto match_failed;
break;
- case AXP_OPERAND_IR|AXP_OPERAND_PARENS|AXP_OPERAND_COMMA:
+ case AXP_OPERAND_IR | AXP_OPERAND_PARENS | AXP_OPERAND_COMMA:
if (tok[tokidx].X_op != O_cpregister
- || !is_ir_num(tok[tokidx].X_add_number))
+ || !is_ir_num (tok[tokidx].X_add_number))
goto match_failed;
break;
match_failed:;
}
- while (++opcode-alpha_opcodes < alpha_num_opcodes
- && !strcmp(opcode->name, first_opcode->name));
+ while (++opcode - alpha_opcodes < alpha_num_opcodes
+ && !strcmp (opcode->name, first_opcode->name));
if (*pcpumatch)
- *pcpumatch = got_cpu_match;
+ *pcpumatch = got_cpu_match;
return NULL;
}
match. */
static const struct alpha_macro *
-find_macro_match(first_macro, tok, pntok)
+find_macro_match (first_macro, tok, pntok)
const struct alpha_macro *first_macro;
const expressionS *tok;
int *pntok;
/* index register */
case MACRO_IR:
if (tokidx >= ntok || tok[tokidx].X_op != O_register
- || !is_ir_num(tok[tokidx].X_add_number))
+ || !is_ir_num (tok[tokidx].X_add_number))
goto match_failed;
++tokidx;
break;
/* parenthesized index register */
case MACRO_PIR:
if (tokidx >= ntok || tok[tokidx].X_op != O_pregister
- || !is_ir_num(tok[tokidx].X_add_number))
+ || !is_ir_num (tok[tokidx].X_add_number))
goto match_failed;
++tokidx;
break;
/* optional parenthesized index register */
case MACRO_OPIR:
if (tokidx < ntok && tok[tokidx].X_op == O_pregister
- && is_ir_num(tok[tokidx].X_add_number))
+ && is_ir_num (tok[tokidx].X_add_number))
++tokidx;
break;
/* leading comma with a parenthesized index register */
case MACRO_CPIR:
if (tokidx >= ntok || tok[tokidx].X_op != O_cpregister
- || !is_ir_num(tok[tokidx].X_add_number))
+ || !is_ir_num (tok[tokidx].X_add_number))
goto match_failed;
++tokidx;
break;
/* floating point register */
case MACRO_FPR:
if (tokidx >= ntok || tok[tokidx].X_op != O_register
- || !is_fpr_num(tok[tokidx].X_add_number))
+ || !is_fpr_num (tok[tokidx].X_add_number))
goto match_failed;
++tokidx;
break;
++arg;
}
}
- while (++macro-alpha_macros < alpha_num_macros
- && !strcmp(macro->name, first_macro->name));
+ while (++macro - alpha_macros < alpha_num_macros
+ && !strcmp (macro->name, first_macro->name));
return NULL;
}
/* Insert an operand value into an instruction. */
static unsigned
-insert_operand(insn, operand, val, file, line)
+insert_operand (insn, operand, val, file, line)
unsigned insn;
const struct alpha_operand *operand;
offsetT val;
_("operand out of range (%s not between %d and %d)");
char buf[sizeof (val) * 3 + 2];
- sprint_value(buf, val);
+ sprint_value (buf, val);
if (file)
- as_warn_where(file, line, err, buf, min, max);
+ as_warn_where (file, line, err, buf, min, max);
else
- as_warn(err, buf, min, max);
+ as_warn (err, buf, min, max);
}
}
*/
static void
-assemble_insn(opcode, tok, ntok, insn)
+assemble_insn (opcode, tok, ntok, insn)
const struct alpha_opcode *opcode;
const expressionS *tok;
int ntok;
for (argidx = opcode->operands; *argidx; ++argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
- const expressionS *t = (const expressionS *)0;
+ const expressionS *t = (const expressionS *) 0;
if (operand->flags & AXP_OPERAND_FAKE)
{
/* fake operands take no value and generate no fixup */
- image = insert_operand(image, operand, 0, NULL, 0);
+ image = insert_operand (image, operand, 0, NULL, 0);
continue;
}
case O_register:
case O_pregister:
case O_cpregister:
- image = insert_operand(image, operand, regno(t->X_add_number),
- NULL, 0);
+ image = insert_operand (image, operand, regno (t->X_add_number),
+ NULL, 0);
break;
case O_constant:
- image = insert_operand(image, operand, t->X_add_number, NULL, 0);
+ image = insert_operand (image, operand, t->X_add_number, NULL, 0);
break;
default:
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
- as_fatal(_("too many fixups"));
+ as_fatal (_("too many fixups"));
fixup = &insn->fixups[insn->nfixups++];
static void
emit_insn (insn)
- struct alpha_insn *insn;
+ struct alpha_insn *insn;
{
char *f;
int i;
- /* Take care of alignment duties */
+ /* Take care of alignment duties. */
if (alpha_auto_align_on && alpha_current_align < 2)
alpha_align (2, (char *) NULL, alpha_insn_label, 0);
if (alpha_current_align > 2)
/* Apply the fixups in order */
for (i = 0; i < insn->nfixups; ++i)
{
- const struct alpha_operand *operand = (const struct alpha_operand *)0;
+ const struct alpha_operand *operand = (const struct alpha_operand *) 0;
struct alpha_fixup *fixup = &insn->fixups[i];
int size, pcrel;
fixS *fixP;
#endif
/* Some fixups are only used internally and so have no howto */
- if ((int)fixup->reloc < 0)
+ if ((int) fixup->reloc < 0)
{
- operand = &alpha_operands[-(int)fixup->reloc];
+ operand = &alpha_operands[-(int) fixup->reloc];
size = 4;
pcrel = ((operand->flags & AXP_OPERAND_RELATIVE) != 0);
}
- else switch (fixup->reloc)
- {
+ else
+ switch (fixup->reloc)
+ {
#ifdef OBJ_ELF
- /* These relocation types are only used internally. */
- case BFD_RELOC_ALPHA_GPDISP_HI16:
- case BFD_RELOC_ALPHA_GPDISP_LO16:
- size = 2;
- pcrel = 0;
- break;
+ /* These relocation types are only used internally. */
+ case BFD_RELOC_ALPHA_GPDISP_HI16:
+ case BFD_RELOC_ALPHA_GPDISP_LO16:
+ size = 2;
+ pcrel = 0;
+ break;
#endif
#ifdef RELOC_OP_P
- /* and these also are internal only relocations */
- case BFD_RELOC_ALPHA_USER_LITERAL:
- case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
- case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
- case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
- case BFD_RELOC_ALPHA_USER_GPDISP:
- case BFD_RELOC_ALPHA_USER_GPRELHIGH:
- case BFD_RELOC_ALPHA_USER_GPRELLOW:
- size = 2;
- pcrel = 0;
- break;
+ /* and these also are internal only relocations */
+ case BFD_RELOC_ALPHA_USER_LITERAL:
+ case BFD_RELOC_ALPHA_USER_LITUSE_BASE:
+ case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF:
+ case BFD_RELOC_ALPHA_USER_LITUSE_JSR:
+ case BFD_RELOC_ALPHA_USER_GPDISP:
+ case BFD_RELOC_ALPHA_USER_GPRELHIGH:
+ case BFD_RELOC_ALPHA_USER_GPRELLOW:
+ size = 2;
+ pcrel = 0;
+ break;
#endif
- default:
- {
- reloc_howto_type *reloc_howto
- = bfd_reloc_type_lookup (stdoutput, fixup->reloc);
- assert (reloc_howto);
+ default:
+ {
+ reloc_howto_type *reloc_howto
+ = bfd_reloc_type_lookup (stdoutput, fixup->reloc);
+ assert (reloc_howto);
- size = bfd_get_reloc_size (reloc_howto);
- pcrel = reloc_howto->pc_relative;
+ size = bfd_get_reloc_size (reloc_howto);
+ pcrel = reloc_howto->pc_relative;
+ }
+ assert (size >= 1 && size <= 4);
+ break;
}
- assert (size >= 1 && size <= 4);
- break;
- }
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size,
&fixup->exp, pcrel, fixup->reloc);
info->segment = now_seg;
info->sequence = insn->sequence[i];
strcpy (info->string, buffer);
- errmsg = hash_insert (alpha_literal_hash, info->string, (PTR)info);
+ errmsg = hash_insert (alpha_literal_hash, info->string, (PTR) info);
if (errmsg)
as_bad (errmsg);
}
info->segment = now_seg;
info->sequence = insn->sequence[i];
strcpy (info->string, buffer);
- errmsg = hash_insert (alpha_literal_hash, info->string, (PTR)info);
+ errmsg = hash_insert (alpha_literal_hash, info->string, (PTR) info);
if (errmsg)
as_bad (errmsg);
}
#endif
default:
- if ((int)fixup->reloc < 0)
+ if ((int) fixup->reloc < 0)
{
if (operand->flags & AXP_OPERAND_NOOVERFLOW)
fixP->fx_no_overflow = 1;
than one insn in an insn structure. */
static void
-assemble_tokens_to_insn(opname, tok, ntok, insn)
+assemble_tokens_to_insn (opname, tok, ntok, insn)
const char *opname;
const expressionS *tok;
int ntok;
as_bad (_("inappropriate arguments for opcode `%s'"), opname);
else
as_bad (_("opcode `%s' not supported for target %s"), opname,
- alpha_target_name);
+ alpha_target_name);
}
else
as_bad (_("unknown opcode `%s'"), opname);
}
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, opname);
+ (int) reloc_exp->X_add_number, opname);
ntok--;
}
#endif
else
as_bad (_("unknown opcode `%s'"), opname);
}
-
\f
/* Some instruction sets indexed by lg(size) */
static const char * const sextX_op[] = { "sextb", "sextw", "sextl", NULL };
expressionS addend;
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, "ldgp");
+ (int) reloc_exp->X_add_number, "ldgp");
ntok--;
}
#endif
{
if (range_signed_16 (offset))
{
- return offset;
+ return offset;
}
}
}
assemble_tokens_to_insn ("ldq", newtok, 3, &insn);
- assert (explicit_reloc == (const expressionS *)0);
+ assert (explicit_reloc == (const expressionS *) 0);
assert (insn.nfixups == 1);
insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL;
#endif /* OBJ_ECOFF */
/* XXX: Disable this .got minimizing optimization so that we can get
better instruction offset knowledge in the compiler. This happens
very infrequently anyway. */
- if (1 || (!range_signed_32 (addend)
- && (alpha_noat_on || targreg == AXP_REG_AT)))
+ if (1
+ || (!range_signed_32 (addend)
+ && (alpha_noat_on || targreg == AXP_REG_AT)))
{
newtok[1] = *exp;
addend = 0;
/* Find symbol or symbol pointer in link section. */
- assert (explicit_reloc == (const expressionS *)0);
+ assert (explicit_reloc == (const expressionS *) 0);
if (exp->X_add_symbol == alpha_evax_proc.symbol)
{
if (range_signed_16 (addend))
}
#endif /* OBJ_EVAX */
- emit_insn(&insn);
+ emit_insn (&insn);
#ifndef OBJ_EVAX
emit_lituse = 1;
break;
case O_constant:
- assert (explicit_reloc == (const expressionS *)0);
+ assert (explicit_reloc == (const expressionS *) 0);
break;
case O_subtract:
/* Assume that this difference expression will be resolved to an
absolute value and that that value will fit in 16 bits. */
- assert (explicit_reloc == (const expressionS *)0);
+ assert (explicit_reloc == (const expressionS *) 0);
set_tok_reg (newtok[0], targreg);
newtok[1] = *exp;
set_tok_preg (newtok[2], basereg);
const PTR opname;
{
int basereg;
- const expressionS *reloc = (const expressionS *)0;
+ const expressionS *reloc = (const expressionS *) 0;
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
const struct alpha_reloc_op_tag *r;
- reloc = &tok[ntok-1];
+ reloc = &tok[ntok - 1];
r = ALPHA_RELOC_TABLE (reloc->X_op);
switch (reloc->X_op)
{
default:
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc->X_add_number, (const char *)opname);
+ (int) reloc->X_add_number, (const char *) opname);
- reloc = (const expressionS *)0;
+ reloc = (const expressionS *) 0;
ntok--;
break;
case O_lituse_base:
if (ntok != 4
|| tok[0].X_op != O_register
- || !is_ir_num(tok[0].X_add_number)
+ || !is_ir_num (tok[0].X_add_number)
|| tok[1].X_op != O_constant
|| tok[2].X_op != O_pregister
- || !is_ir_num(tok[2].X_add_number))
+ || !is_ir_num (tok[2].X_add_number))
{
as_bad (_("bad instruction format for lda !%s!%ld"), r->name,
(long) reloc->X_add_number);
- reloc = (const expressionS *)0;
+ reloc = (const expressionS *) 0;
ntok--;
break;
}
expressionS newtok[3];
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, "ldah");
+ (int) reloc_exp->X_add_number, "ldah");
ntok--;
}
#endif
struct alpha_insn insn;
#ifdef RELOC_OP_P
- const expressionS *reloc = (const expressionS *)0;
+ const expressionS *reloc = (const expressionS *) 0;
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
const struct alpha_reloc_op_tag *r;
- reloc = &tok[ntok-1];
+ reloc = &tok[ntok - 1];
switch (reloc->X_op)
{
case O_lituse_base:
break;
case O_literal:
- if (strcmp ((const char *)opname, "ldq") == 0)
+ if (strcmp ((const char *) opname, "ldq") == 0)
{
emit_lda (tok, ntok, opname);
return;
ntok--;
r = ALPHA_RELOC_TABLE (reloc->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc->X_add_number, (const char *)opname);
+ (int) reloc->X_add_number, (const char *) opname);
}
}
#endif
basereg = tok[2].X_add_number;
lituse = load_expression (tok[0].X_add_number, &tok[1], &basereg,
- &newtok[1], (const expressionS *)0);
+ &newtok[1], (const expressionS *) 0);
newtok[0] = tok[0];
set_tok_preg (newtok[2], basereg);
- assemble_tokens_to_insn ((const char *)opname, newtok, 3, &insn);
+ assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn);
#ifdef RELOC_OP_P
if (reloc)
struct alpha_insn insn;
#ifdef RELOC_OP_P
- const expressionS *reloc = (const expressionS *)0;
+ const expressionS *reloc = (const expressionS *) 0;
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
reloc = &tok[--ntok];
if (reloc->X_op != O_lituse_base)
{
- const struct alpha_reloc_op_tag *r = &alpha_reloc_op[ reloc->X_md ];
+ const struct alpha_reloc_op_tag *r = &alpha_reloc_op[reloc->X_md];
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc->X_add_number, (const char *)opname);
+ (int) reloc->X_add_number, (const char *) opname);
}
}
#endif
else
basereg = tok[2].X_add_number;
- if (tok[1].X_op != O_constant || !range_signed_16(tok[1].X_add_number))
+ if (tok[1].X_op != O_constant || !range_signed_16 (tok[1].X_add_number))
{
if (alpha_noat_on)
as_bad (_("macro requires $at register while noat in effect"));
lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, &newtok[1],
- (const expressionS *)0);
+ (const expressionS *) 0);
}
else
{
newtok[0] = tok[0];
set_tok_preg (newtok[2], basereg);
- assemble_tokens_to_insn ((const char *)opname, newtok, 3, &insn);
+ assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn);
#ifdef RELOC_OP_P
if (reloc)
const PTR vlgsize;
{
if (alpha_target & AXP_OPCODE_BWX)
- emit_ir_load (tok, ntok, ldXu_op[(long)vlgsize]);
+ emit_ir_load (tok, ntok, ldXu_op[(long) vlgsize]);
else
{
expressionS newtok[3];
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r
= ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, "ldbu/ldwu");
+ (int) reloc_exp->X_add_number, "ldbu/ldwu");
ntok--;
}
#endif
set_tok_reg (newtok[1], AXP_REG_AT);
newtok[2] = newtok[0];
- assemble_tokens (extXl_op[(long)vlgsize], newtok, 3, 1);
+ assemble_tokens (extXl_op[(long) vlgsize], newtok, 3, 1);
}
}
const PTR vlgsize;
{
emit_ldXu (tok, ntok, vlgsize);
- assemble_tokens (sextX_op[(long)vlgsize], tok, 1, 1);
+ assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1);
}
/* Load an integral value from an unaligned address as an unsigned
int ntok;
const PTR vlgsize;
{
- long lgsize = (long)vlgsize;
+ long lgsize = (long) vlgsize;
expressionS newtok[3];
if (alpha_noat_on)
/* emit "ldq_u $t10, size-1($at)" */
set_tok_reg (newtok[0], AXP_REG_T10);
- set_tok_const (newtok[1], (1<<lgsize)-1);
+ set_tok_const (newtok[1], (1 << lgsize) - 1);
assemble_tokens ("ldq_u", newtok, 3, 1);
/* emit "extXl $t9, $at, $t9" */
const PTR vlgsize;
{
emit_uldXu (tok, ntok, vlgsize);
- assemble_tokens (sextX_op[(long)vlgsize], tok, 1, 1);
+ assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1);
}
/* Implement the ldil macro. */
expressionS newtok[2];
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, "ldil");
+ (int) reloc_exp->X_add_number, "ldil");
ntok--;
}
#endif
int ntok;
const PTR vlgsize;
{
- int lgsize = (int) (long)vlgsize;
+ int lgsize = (int) (long) vlgsize;
if (alpha_target & AXP_OPCODE_BWX)
emit_loadstore (tok, ntok, stX_op[lgsize]);
expressionS newtok[3];
if (alpha_noat_on)
- as_bad(_("macro requires $at register while noat in effect"));
+ as_bad (_("macro requires $at register while noat in effect"));
/* emit "lda $at, exp" */
int ntok;
const PTR vlgsize;
{
- int lgsize = (int) (long)vlgsize;
+ int lgsize = (int) (long) vlgsize;
expressionS newtok[3];
/* emit "lda $at, exp" */
/* emit "ldq_u $10, size-1($at)" */
set_tok_reg (newtok[0], AXP_REG_T10);
- set_tok_const (newtok[1], (1 << lgsize)-1);
+ set_tok_const (newtok[1], (1 << lgsize) - 1);
assemble_tokens ("ldq_u", newtok, 3, 1);
/* emit "insXl src, $at, $t11" */
/* emit "stq_u $t10, size-1($at)" */
set_tok_reg (newtok[0], AXP_REG_T10);
- set_tok_const (newtok[1], (1 << lgsize)-1);
+ set_tok_const (newtok[1], (1 << lgsize) - 1);
assemble_tokens ("stq_u", newtok, 3, 1);
}
int ntok;
const PTR vlgsize;
{
- long lgsize = (long)vlgsize;
+ long lgsize = (long) vlgsize;
if (alpha_target & AXP_OPCODE_BWX)
assemble_tokens (sextX_op[lgsize], tok, ntok, 0);
expressionS newtok[3];
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r
= ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, "setxt");
+ (int) reloc_exp->X_add_number, "setxt");
ntok--;
}
#endif
expressionS newtok[3];
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, (char char *)symname);
+ (int) reloc_exp->X_add_number, (char char *) symname);
ntok--;
}
#endif
{
set_tok_reg (newtok[0], xr);
set_tok_reg (newtok[1], AXP_REG_R16);
- assemble_tokens ("mov", newtok, 2, 1);
+ assemble_tokens ("mov", newtok, 2, 1);
}
if (yr != AXP_REG_R16 && yr != AXP_REG_R17)
}
}
- sym = symbol_find_or_make ((const char *)symname);
+ sym = symbol_find_or_make ((const char *) symname);
set_tok_reg (newtok[0], AXP_REG_AT);
set_tok_sym (newtok[1], sym, 0);
expressionS newtok[3];
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, (const char *)symname);
+ (int) reloc_exp->X_add_number, (const char *) symname);
ntok--;
}
#endif
else
rr = regno (tok[2].X_add_number);
- sym = symbol_find_or_make ((const char *)symname);
+ sym = symbol_find_or_make ((const char *) symname);
/* Move the operands into the right place */
if (yr == AXP_REG_T10 && xr == AXP_REG_T11)
{
set_tok_reg (newtok[0], xr);
set_tok_reg (newtok[1], AXP_REG_T10);
- assemble_tokens ("mov", newtok, 2, 1);
+ assemble_tokens ("mov", newtok, 2, 1);
}
if (yr != AXP_REG_T10 && yr != AXP_REG_T11)
int r, tokidx = 0, lituse = 0;
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, opname);
+ (int) reloc_exp->X_add_number, opname);
ntok--;
}
#endif
{
int basereg = alpha_gp_register;
lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL,
- (const expressionS *)0);
+ (const expressionS *) 0);
}
#endif
int ntok;
const PTR vopname;
{
- const char *opname = (const char *)vopname;
+ const char *opname = (const char *) vopname;
expressionS newtok[3];
int r, tokidx = 0;
#ifdef RELOC_OP_P
- if (ntok && USER_RELOC_P (tok[ntok-1].X_op))
+ if (ntok && USER_RELOC_P (tok[ntok - 1].X_op))
{
- const expressionS *reloc_exp = &tok[ntok-1];
+ const expressionS *reloc_exp = &tok[ntok - 1];
const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op);
as_bad (_("Cannot use !%s!%d with %s"), r->name,
- (int)reloc_exp->X_add_number, opname);
+ (int) reloc_exp->X_add_number, opname);
ntok--;
}
#endif
if (tokidx < ntok)
newtok[2] = tok[tokidx];
else
- set_tok_const (newtok[2], strcmp(opname, "ret") == 0);
+ set_tok_const (newtok[2], strcmp (opname, "ret") == 0);
assemble_tokens (opname, newtok, 3, 0);
}
(expressionS *) xmalloc (sizeof (expressionS));
symbol_get_obj (sym)->size->X_op = O_subtract;
symbol_get_obj (sym)->size->X_add_symbol
- = symbol_new ("L0\001", now_seg, frag_now_fix (), frag_now);
+ = symbol_new ("L0\001", now_seg, frag_now_fix (), frag_now);
symbol_get_obj (sym)->size->X_op_symbol = sym;
symbol_get_obj (sym)->size->X_add_number = 0;
}
if (ECOFF_DEBUGGING)
{
if (fp)
- ecoff_directive_fmask (0);
+ ecoff_directive_fmask (0);
else
- ecoff_directive_mask (0);
+ ecoff_directive_mask (0);
}
else
discard_rest_of_line ();
switch (arg)
{
- case 0: /* No PV required. */
- S_SET_OTHER (sym, STO_ALPHA_NOPV
- | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
- break;
- case 1: /* Std GP load. */
- S_SET_OTHER (sym, STO_ALPHA_STD_GPLOAD
- | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
- break;
- case 2: /* Non-std use of PV. */
- break;
-
- default:
- as_bad (_("Invalid argument %d to .prologue."), arg);
- break;
+ case 0: /* No PV required. */
+ S_SET_OTHER (sym, STO_ALPHA_NOPV
+ | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
+ break;
+ case 1: /* Std GP load. */
+ S_SET_OTHER (sym, STO_ALPHA_STD_GPLOAD
+ | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
+ break;
+ case 2: /* Non-std use of PV. */
+ break;
+
+ default:
+ as_bad (_("Invalid argument %d to .prologue."), arg);
+ break;
}
}
-static char * first_file_directive;
+static char *first_file_directive;
static void
s_alpha_file (ignore)
/* If we've been undecided about mdebug, make up our minds in favour. */
if (alpha_flag_mdebug < 0)
{
- segT sec = subseg_new(".mdebug", 0);
- bfd_set_section_flags(stdoutput, sec, SEC_HAS_CONTENTS|SEC_READONLY);
- bfd_set_section_alignment(stdoutput, sec, 3);
+ segT sec = subseg_new (".mdebug", 0);
+ bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY);
+ bfd_set_section_alignment (stdoutput, sec, 3);
ecoff_read_begin_hook ();
if (first_file_directive)
{
char *save_ilp = input_line_pointer;
- input_line_pointer = first_file_directive;
+ input_line_pointer = first_file_directive;
ecoff_directive_file (0);
input_line_pointer = save_ilp;
free (first_file_directive);
{
int temp;
#define EVAX_SECTION_COUNT 5
- static char *section_name[EVAX_SECTION_COUNT+1] =
+ static char *section_name[EVAX_SECTION_COUNT + 1] =
{ "NULL", ".rdata", ".comm", ".link", ".ctors", ".dtors" };
if ((secid <= 0) || (secid > EVAX_SECTION_COUNT))
name = input_line_pointer;
name_end = get_symbol_end ();
- if (strncmp(name, "stack", 5) == 0)
+ if (strncmp (name, "stack", 5) == 0)
{
alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_STACK;
}
- else if (strncmp(name, "reg", 3) == 0)
+ else if (strncmp (name, "reg", 3) == 0)
{
alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_REGISTER;
}
- else if (strncmp(name, "null", 4) == 0)
+ else if (strncmp (name, "null", 4) == 0)
{
alpha_evax_proc.pdsckind = PDSC_S_K_KIND_NULL;
}
seginfo->literal_pool_size += 16;
*p = alpha_evax_proc.pdsckind
- | ((alpha_evax_proc.framereg == 29) ? PDSC_S_M_BASE_REG_IS_FP : 0);
- *(p+1) = PDSC_S_M_NATIVE
- | PDSC_S_M_NO_JACKET;
+ | ((alpha_evax_proc.framereg == 29) ? PDSC_S_M_BASE_REG_IS_FP : 0);
+ *(p + 1) = PDSC_S_M_NATIVE | PDSC_S_M_NO_JACKET;
switch (alpha_evax_proc.pdsckind)
{
- case PDSC_S_K_KIND_NULL:
- *(p+2) = 0;
- *(p+3) = 0;
- break;
- case PDSC_S_K_KIND_FP_REGISTER:
- *(p+2) = alpha_evax_proc.fp_save;
- *(p+3) = alpha_evax_proc.ra_save;
- break;
- case PDSC_S_K_KIND_FP_STACK:
- md_number_to_chars (p+2, (valueT)alpha_evax_proc.rsa_offset, 2);
- break;
- default: /* impossible */
- break;
+ case PDSC_S_K_KIND_NULL:
+ *(p + 2) = 0;
+ *(p + 3) = 0;
+ break;
+ case PDSC_S_K_KIND_FP_REGISTER:
+ *(p + 2) = alpha_evax_proc.fp_save;
+ *(p + 3) = alpha_evax_proc.ra_save;
+ break;
+ case PDSC_S_K_KIND_FP_STACK:
+ md_number_to_chars (p + 2, (valueT) alpha_evax_proc.rsa_offset, 2);
+ break;
+ default: /* impossible */
+ break;
}
- *(p+4) = 0;
- *(p+5) = alpha_evax_proc.type & 0x0f;
+ *(p + 4) = 0;
+ *(p + 5) = alpha_evax_proc.type & 0x0f;
/* Signature offset. */
- md_number_to_chars (p+6, (valueT)0, 2);
+ md_number_to_chars (p + 6, (valueT) 0, 2);
- fix_new_exp (frag_now, p-frag_now->fr_literal+8, 8, &exp, 0, BFD_RELOC_64);
+ fix_new_exp (frag_now, p - frag_now->fr_literal+8, 8, &exp, 0, BFD_RELOC_64);
if (alpha_evax_proc.pdsckind == PDSC_S_K_KIND_NULL)
return;
seginfo->literal_pool_size += 8;
/* pdesc+16: Size. */
- md_number_to_chars (p, (valueT)alpha_evax_proc.framesize, 4);
+ md_number_to_chars (p, (valueT) alpha_evax_proc.framesize, 4);
- md_number_to_chars (p+4, (valueT)0, 2);
+ md_number_to_chars (p + 4, (valueT) 0, 2);
/* Entry length. */
- md_number_to_chars (p+6, alpha_evax_proc.prologue, 2);
+ md_number_to_chars (p + 6, alpha_evax_proc.prologue, 2);
if (alpha_evax_proc.pdsckind == PDSC_S_K_KIND_FP_REGISTER)
return;
/* pdesc+24: register masks. */
md_number_to_chars (p, alpha_evax_proc.imask, 4);
- md_number_to_chars (p+4, alpha_evax_proc.fmask, 4);
+ md_number_to_chars (p + 4, alpha_evax_proc.fmask, 4);
return;
}
p = frag_more (8);
seginfo->literal_pool_size += 8;
- fix_new_exp (frag_now, p-frag_now->fr_literal, 8, &exp, 0, BFD_RELOC_64);
+ fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &exp, 0, BFD_RELOC_64);
return;
}
else
{
alpha_evax_proc.imask = val;
- (void)get_absolute_expression ();
+ (void) get_absolute_expression ();
}
demand_empty_rest_of_line ();
switch (e.X_op)
{
case O_constant:
- e.X_add_symbol = section_symbol(absolute_section);
+ e.X_add_symbol = section_symbol (absolute_section);
e.X_op = O_symbol;
/* FALLTHRU */
case O_symbol:
p = frag_more (4);
memset (p, 0, 4);
- fix_new_exp (frag_now, p-frag_now->fr_literal, 4,
+ fix_new_exp (frag_now, p - frag_now->fr_literal, 4,
&e, 0, BFD_RELOC_GPREL32);
}
ch = get_symbol_end ();
for (p = cpu_types; p->name; ++p)
- if (strcmp(name, p->name) == 0)
+ if (strcmp (name, p->name) == 0)
{
- alpha_target_name = p->name, alpha_target = p->flags;
+ alpha_target_name = p->name, alpha_target = p->flags;
goto found;
}
- as_warn("Unknown CPU identifier `%s'", name);
+ as_warn ("Unknown CPU identifier `%s'", name);
found:
*input_line_pointer = ch;
demand_empty_rest_of_line ();
}
-
\f
-
#ifdef DEBUG1
/* print token expression with alpha specific extension. */
static void
-alpha_print_token(f, exp)
- FILE *f;
- const expressionS *exp;
+alpha_print_token (f, exp)
+ FILE *f;
+ const expressionS *exp;
{
switch (exp->X_op)
{
- case O_cpregister:
- putc (',', f);
- /* FALLTHRU */
- case O_pregister:
- putc ('(', f);
- {
- expressionS nexp = *exp;
- nexp.X_op = O_register;
- print_expr (f, &nexp);
- }
- putc (')', f);
- break;
- default:
- print_expr (f, exp);
- break;
+ case O_cpregister:
+ putc (',', f);
+ /* FALLTHRU */
+ case O_pregister:
+ putc ('(', f);
+ {
+ expressionS nexp = *exp;
+ nexp.X_op = O_register;
+ print_expr (f, &nexp);
+ }
+ putc (')', f);
+ break;
+ default:
+ print_expr (f, exp);
+ break;
}
return;
}
\f
/* The target specific pseudo-ops which we support. */
-const pseudo_typeS md_pseudo_table[] =
-{
+const pseudo_typeS md_pseudo_table[] = {
#ifdef OBJ_ECOFF
{"comm", s_alpha_comm, 0}, /* osf1 compiler does this */
{"rdata", s_alpha_rdata, 0},
{NULL, 0, 0},
};
-
\f
/* Build a BFD section with its flags set appropriately for the .lita,
.lit8, or .lit4 sections. */
assert (alpha_gp_value == 0);
/* Get minus-one in whatever width... */
- alpha_gp_value = 0; alpha_gp_value--;
+ alpha_gp_value = 0;
+ alpha_gp_value--;
/* Select the smallest VMA of these existing sections. */
maybe_set_gp (alpha_lita_section);
/* This is called from HANDLE_ALIGN in write.c. Fill in the contents
of an rs_align_code fragment. */
-void
+void
alpha_handle_align (fragp)
fragS *fragp;
{
static char const unop[4] = { 0x00, 0x00, 0xe0, 0x2f };
static char const nopunop[8] = {
- 0x1f, 0x04, 0xff, 0x47,
- 0x00, 0x00, 0xe0, 0x2f
+ 0x1f, 0x04, 0xff, 0x47,
+ 0x00, 0x00, 0xe0, 0x2f
};
int bytes, fix;