summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-07-17 21:37:02 +0000
committerNick Clifton <nickc@redhat.com>2000-07-17 21:37:02 +0000
commit4900c239ced02ad5f09bd542c27af517d27926a5 (patch)
tree62a41dd4320979b6eb73f05f89fde53b605fd827 /gas
parentc04523900bd4708ce1a6073ee34a21f97068b9fa (diff)
downloadbinutils-redhat-4900c239ced02ad5f09bd542c27af517d27926a5.tar.gz
Fix formatting.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog1
-rw-r--r--gas/config/tc-m68hc11.c170
-rw-r--r--gas/config/tc-mn10200.c245
-rw-r--r--gas/config/tc-mn10300.c341
-rw-r--r--gas/config/tc-pj.c127
-rw-r--r--gas/config/tc-tic80.c412
6 files changed, 652 insertions, 644 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index de4f4f2628..c15d543858 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -5,6 +5,7 @@
* config/tc-mn10300.c: Likewise.
* config/tc-pj.c: Fix formatting.=0A=
* config/tc-tic80.c: Fix formatting.=0A=
+ * config/tc-m68hc11.c: Fix formatting.
2000-07-17 Frank Ch. Eigler <fche@redhat.com>
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index 83ec55e1a0..0504b39d2d 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -58,15 +58,16 @@ const char FLT_CHARS[] = "dD";
size expressions. This version only supports two kinds. */
/* The fields are:
- How far Forward this mode will reach:
- How far Backward this mode will reach:
- How many bytes this mode will add to the size of the frag
- Which mode to go to if the offset won't fit in this one */
-
-relax_typeS md_relax_table[] = {
- {1, 1, 0, 0}, /* First entries aren't used */
- {1, 1, 0, 0}, /* For no good reason except */
- {1, 1, 0, 0}, /* that the VAX doesn't either */
+ How far Forward this mode will reach.
+ How far Backward this mode will reach.
+ How many bytes this mode will add to the size of the frag.
+ Which mode to go to if the offset won't fit in this one. */
+
+relax_typeS md_relax_table[] =
+{
+ {1, 1, 0, 0}, /* First entries aren't used. */
+ {1, 1, 0, 0}, /* For no good reason except. */
+ {1, 1, 0, 0}, /* that the VAX doesn't either. */
{1, 1, 0, 0},
/* Relax for bcc <L>.
@@ -147,36 +148,30 @@ typedef struct alias
}
alias;
-static alias alias_opcodes[] = {
+static alias alias_opcodes[] =
+{
{"cpd", "cmpd"},
{"cpx", "cmpx"},
{"cpy", "cmpy"},
{0, 0}
};
-/* local functions */
-static register_id reg_name_search PARAMS ((char *name));
-static register_id register_name PARAMS (());
-static int check_range PARAMS ((long num, int mode));
-
+/* Local functions. */
+static register_id reg_name_search PARAMS ((char *));
+static register_id register_name PARAMS ((void));
+static int check_range PARAMS ((long, int));
static void print_opcode_list PARAMS ((void));
-
static void get_default_target PARAMS ((void));
-static void print_insn_format PARAMS ((char *name));
-static int get_operand PARAMS ((operand * op, int first, long opmode));
-static void fixup8 PARAMS ((expressionS * oper, int mode, int opmode));
-static void fixup16 PARAMS ((expressionS * oper, int mode, int opmode));
+static void print_insn_format PARAMS ((char *));
+static int get_operand PARAMS ((operand *, int, long));
+static void fixup8 PARAMS ((expressionS *, int, int));
+static void fixup16 PARAMS ((expressionS *, int, int));
static struct m68hc11_opcode *find_opcode
-PARAMS (
- (struct m68hc11_opcode_def * opc, operand operands[],
- int *nb_operands));
+ PARAMS ((struct m68hc11_opcode_def *, operand *, int *));
static void build_jump_insn
-PARAMS (
- (struct m68hc11_opcode * opcode, operand operands[], int nb_operands,
- int optimize));
-
-static void build_insn PARAMS ((struct m68hc11_opcode * opcode,
- operand operands[], int nb_operands));
+ PARAMS ((struct m68hc11_opcode *, operand *, int, int));
+static void build_insn
+ PARAMS ((struct m68hc11_opcode *, operand *, int));
/* Controls whether relative branches can be turned into long branches.
When the relative offset is too large, the insn are changed:
@@ -186,7 +181,7 @@ static void build_insn PARAMS ((struct m68hc11_opcode * opcode,
jmp L
dbcc -> db!cc +3
jmp L
-
+
Setting the flag forbidds this. */
static short flag_fixed_branchs = 0;
@@ -234,7 +229,8 @@ static struct m68hc11_opcode *m68hc11_sorted_opcodes;
pseudo-op name without dot
function to call to execute this pseudo-op
Integer arg to pass to the function. */
-const pseudo_typeS md_pseudo_table[] = {
+const pseudo_typeS md_pseudo_table[] =
+{
/* The following pseudo-ops are supported for MRI compatibility. */
{"fcb", cons, 1},
{"fdb", cons, 2},
@@ -245,13 +241,13 @@ const pseudo_typeS md_pseudo_table[] = {
{0, 0, 0}
};
-
/* Options and initialization. */
CONST char *md_shortopts = "Sm:";
-struct option md_longopts[] = {
+struct option md_longopts[] =
+{
#define OPTION_FORCE_LONG_BRANCH (OPTION_MD_BASE)
{"force-long-branchs", no_argument, NULL, OPTION_FORCE_LONG_BRANCH},
@@ -303,7 +299,6 @@ m68hc11_mach ()
return 0;
}
-
void
md_show_usage (stream)
FILE *stream;
@@ -436,14 +431,13 @@ md_undefined_symbol (name)
return 0;
}
-/* Equal to MAX_PRECISION in atof-ieee.c */
+/* Equal to MAX_PRECISION in atof-ieee.c. */
#define MAX_LITTLENUMS 6
/* Turn a string in input_line_pointer into a floating point constant
of type TYPE, and store the appropriate bytes in *LITP. The number
of LITTLENUMS emitted is stored in *SIZEP. An error message is
returned, or NULL on OK. */
-
char *
md_atof (type, litP, sizeP)
char type;
@@ -507,7 +501,6 @@ md_section_align (seg, addr)
return ((addr + (1 << align) - 1) & (-1 << align));
}
-
static int
cmp_opcode (op1, op2)
struct m68hc11_opcode *op1;
@@ -620,7 +613,6 @@ void
m68hc11_init_after_args ()
{
}
-
/* Builtin help. */
@@ -747,10 +739,8 @@ print_opcode_list ()
int example = flag_print_opcodes == 2;
if (example)
- {
- printf (_("# Example of `%s' instructions\n\t.sect .text\n_start:\n"),
- default_cpu);
- }
+ printf (_("# Example of `%s' instructions\n\t.sect .text\n_start:\n"),
+ default_cpu);
opcodes = m68hc11_sorted_opcodes;
@@ -783,7 +773,6 @@ print_opcode_list ()
printf ("\n");
}
-
/* Print the instruction format. This operation is called when some
instruction is not correct. Instruction format is printed as an
error message. */
@@ -816,7 +805,6 @@ print_insn_format (name)
}
while (strcmp (opcode->name, name) == 0);
}
-
/* Analysis of 68HC11 and 68HC12 operands. */
@@ -856,7 +844,7 @@ skip_whites (p)
return p;
}
-/* register_name() checks the string at input_line_pointer
+/* Check the string at input_line_pointer
to see if it is a valid register name. */
static register_id
register_name ()
@@ -874,7 +862,7 @@ register_name ()
if (c)
*p++ = 0;
- /* look to see if it's in the register table. */
+ /* Look to see if it's in the register table. */
reg_number = reg_name_search (input_line_pointer);
if (reg_number != REG_NONE)
{
@@ -890,8 +878,7 @@ register_name ()
return reg_number;
}
-/* get_operands parses a string of operands and returns
- an array of expressions.
+/* Parse a string of operands and return an array of expressions.
Operand mode[0] mode[1] exp[0] exp[1]
#n M6811_OP_IMM16 - O_*
@@ -905,10 +892,7 @@ register_name ()
n,r+ M6812_POST_INC " "
A,r B,r D,r M6811_OP_REG M6812_OP_REG O_register O_register
[D,r] M6811_OP_IDX_2 M6812_OP_REG O_register O_register
- [n,r] M6811_OP_IDX_1 M6812_OP_REG O_constant O_register
-
-*/
-
+ [n,r] M6811_OP_IDX_1 M6812_OP_REG O_constant O_register */
static int
get_operand (oper, which, opmode)
operand *oper;
@@ -942,7 +926,7 @@ get_operand (oper, which, opmode)
if (!(opmode & (M6811_OP_IMM8 | M6811_OP_IMM16 | M6811_OP_BITMASK)))
{
as_bad (_("Immediate operand is not allowed for operand %d."),
- which);
+ which);
return -1;
}
@@ -1115,7 +1099,7 @@ get_operand (oper, which, opmode)
input_line_pointer = p;
reg = register_name ();
- /* Backtrack... */
+ /* Backtrack. */
if (which == 0 && opmode & M6812_OP_IDX_P2
&& reg != REG_X && reg != REG_Y
&& reg != REG_PC && reg != REG_SP)
@@ -1185,9 +1169,7 @@ get_operand (oper, which, opmode)
/* If the mode is not known until now, this is either a label
or an indirect address. */
if (mode == M6811_OP_NONE)
- {
- mode = M6811_OP_IND16 | M6811_OP_JUMP_REL;
- }
+ mode = M6811_OP_IND16 | M6811_OP_JUMP_REL;
p = input_line_pointer;
while (*p == ' ' || *p == '\t')
@@ -1209,15 +1191,11 @@ check_range (num, mode)
{
/* Auto increment and decrement are ok for [-8..8] without 0. */
if (mode & M6812_AUTO_INC_DEC)
- {
- return (num != 0 && num <= 8 && num >= -8);
- }
+ return (num != 0 && num <= 8 && num >= -8);
/* The 68HC12 supports 5, 9 and 16-bits offsets. */
if (mode & (M6812_INDEXED_IND | M6812_INDEXED | M6812_OP_IDX))
- {
- mode = M6811_OP_IND16;
- }
+ mode = M6811_OP_IND16;
if (mode & M6812_OP_JUMP_REL16)
mode = M6811_OP_IND16;
@@ -1255,7 +1233,6 @@ check_range (num, mode)
return 0;
}
}
-
/* Gas fixup generation. */
@@ -1342,7 +1319,7 @@ fixup16 (oper, mode, opmode)
if (!check_range (oper->X_add_number, mode))
{
as_bad (_("Operand out of 16-bit range: `%ld'."),
- oper->X_add_number);
+ oper->X_add_number);
}
number_to_chars_bigendian (f, oper->X_add_number & 0x0FFFF, 2);
}
@@ -1365,7 +1342,6 @@ fixup16 (oper, mode, opmode)
as_fatal (_("Operand `%x' not recognized in fixup16."), oper->X_op);
}
}
-
/* 68HC11 and 68HC12 code generation. */
@@ -1389,11 +1365,11 @@ convert_branch (code)
/* Start a new insn that contains at least 'size' bytes. Record the
line information of that insn in the dwarf2 debug sections. */
-static char*
+static char *
m68hc11_new_insn (size)
int size;
{
- char* f;
+ char *f;
f = frag_more (size);
@@ -1401,7 +1377,7 @@ m68hc11_new_insn (size)
if (debug_type == DEBUG_DWARF2)
{
bfd_vma addr;
-
+
dwarf2_where (&debug_line);
addr = frag_now->fr_address + frag_now_fix () - size;
dwarf2_gen_line_info (addr, &debug_line);
@@ -1666,7 +1642,7 @@ build_indexed_byte (op, format, move_insn)
if (!check_range (val, mode))
{
as_bad (_("Increment/decrement value is out of range: `%ld'."),
- val);
+ val);
}
if (mode & (M6812_POST_INC | M6812_PRE_INC))
byte |= (val - 1) & 0x07;
@@ -1772,9 +1748,10 @@ build_indexed_byte (op, format, move_insn)
}
f = frag_more (1);
number_to_chars_bigendian (f, byte, 1);
- /*
- fix_new_exp (frag_now, f - frag_now->fr_literal, 2,
- &op->exp, false, BFD_RELOC_16); */
+#if 0
+ fix_new_exp (frag_now, f - frag_now->fr_literal, 2,
+ &op->exp, false, BFD_RELOC_16);
+#endif
frag_var (rs_machine_dependent, 2, 2,
ENCODE_RELAX (STATE_INDEXED_OFFSET, STATE_UNDF),
op->exp.X_add_symbol, val, f);
@@ -1988,7 +1965,6 @@ build_insn (opcode, operands, nb_operands)
fixup16 (&operands[1].exp, M6811_OP_IND16, operands[1].mode);
}
}
-
/* Opcode identification and operand analysis. */
@@ -2144,7 +2120,6 @@ find (opc, operands, nb_operands)
return opcode;
}
-
/* Find the real opcode and its associated operands. We use a progressive
approach here. On entry, 'opc' points to the first opcode in the
table that matches the opcode name in the source line. We try to
@@ -2175,9 +2150,7 @@ find_opcode (opc, operands, nb_operands)
result = get_operand (&operands[i], i, opc->format);
if (result <= 0)
- {
- return 0;
- }
+ return 0;
/* Special case where the bitmask of the bclr/brclr
instructions is not introduced by #.
@@ -2194,21 +2167,19 @@ find_opcode (opc, operands, nb_operands)
{
opcode = find (opc, operands, i);
if (opcode)
- {
- return opcode;
- }
+ return opcode;
}
if (*input_line_pointer == ',')
input_line_pointer++;
}
+
return 0;
}
#define M6812_XBCC_MARKER (M6812_OP_TBCC_MARKER \
| M6812_OP_DBCC_MARKER \
| M6812_OP_IBCC_MARKER)
-
/* Gas line assembler entry point. */
@@ -2231,7 +2202,7 @@ md_assemble (str)
int branch_optimize = 0;
int alias_id = -1;
- /* Drop leading whitespace */
+ /* Drop leading whitespace. */
while (*str == ' ')
str++;
@@ -2343,7 +2314,7 @@ md_assemble (str)
if (alias_id >= 0)
{
char *f = m68hc11_new_insn (m68hc12_alias[alias_id].size);
-
+
number_to_chars_bigendian (f, m68hc12_alias[alias_id].code1, 1);
if (m68hc12_alias[alias_id].size > 1)
number_to_chars_bigendian (f + 1, m68hc12_alias[alias_id].code2, 1);
@@ -2378,10 +2349,8 @@ md_assemble (str)
else
build_insn (opcode, operands, nb_operands);
}
-
/* Relocation, relaxation and frag conversions. */
-
long
md_pcrel_from_section (fixp, sec)
fixS *fixp;
@@ -2390,7 +2359,7 @@ md_pcrel_from_section (fixp, sec)
int adjust;
if (fixp->fx_addsy != (symbolS *) NULL
&& (!S_IS_DEFINED (fixp->fx_addsy)
- || (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
+ || (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
return 0;
adjust = fixp->fx_pcrel_adjust;
@@ -2480,7 +2449,7 @@ md_convert_frag (abfd, sec, fragP)
case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD):
/* Invert branch. */
fragP->fr_opcode[0] ^= 1;
- fragP->fr_opcode[1] = 3; /* Branch offset */
+ fragP->fr_opcode[1] = 3; /* Branch offset. */
buffer_address[0] = M6811_JMP;
fix_new (fragP, fragP->fr_fix + 1, 2,
fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_16);
@@ -2597,8 +2566,8 @@ md_estimate_size_before_relax (fragP, segment)
}
else
{
- fragP->fr_opcode[0] ^= 1; /* Reverse sense of branch. */
- fragP->fr_opcode[1] = 3; /* Skip next jmp insn (3 bytes) */
+ fragP->fr_opcode[0] ^= 1; /* Reverse sense of branch. */
+ fragP->fr_opcode[1] = 3; /* Skip next jmp insn (3 bytes). */
/* Don't use fr_opcode[2] because this may be
in a different frag. */
@@ -2643,7 +2612,7 @@ md_estimate_size_before_relax (fragP, segment)
}
else
{
- fragP->fr_opcode[0] ^= 0x20; /* Reverse sense of branch. */
+ fragP->fr_opcode[0] ^= 0x20; /* Reverse sense of branch. */
fragP->fr_opcode[1] = 3; /* Skip next jmp insn (3 bytes). */
/* Don't use fr_opcode[2] because this may be
@@ -2751,16 +2720,20 @@ md_apply_fix (fixp, valuep)
case BFD_RELOC_M68HC11_HI8:
value = value >> 8;
- /* Fall through */
+ /* Fall through. */
case BFD_RELOC_M68HC11_LO8:
case BFD_RELOC_8:
- /*bfd_putb8 ((bfd_vma) value, (unsigned char *) where); */
+#if 0
+ bfd_putb8 ((bfd_vma) value, (unsigned char *) where);
+#endif
((bfd_byte *) where)[0] = (bfd_byte) value;
break;
case BFD_RELOC_8_PCREL:
- /*bfd_putb8 ((bfd_vma) value, (unsigned char *) where); */
+#if 0
+ bfd_putb8 ((bfd_vma) value, (unsigned char *) where);
+#endif
((bfd_byte *) where)[0] = (bfd_byte) value;
if (value < -128 || value > 127)
@@ -2786,6 +2759,7 @@ md_apply_fix (fixp, valuep)
as_fatal (_("Line %d: unknown relocation type: 0x%x."),
fixp->fx_line, fixp->fx_r_type);
}
+
return 0;
}
@@ -2801,12 +2775,12 @@ m68hc11_end_of_source ()
segT saved_seg;
subsegT saved_subseg;
segT debug_info;
- char* p;
+ char *p;
long total_size = 0;
-
+
if (debug_type != DEBUG_DWARF2)
return;
-
+
dwarf2_finish ();
saved_seg = now_seg;
@@ -2817,7 +2791,7 @@ m68hc11_end_of_source ()
subseg_set (debug_info, 0);
p = frag_more (10);
total_size = 12;
-
+
# define STUFF(val,size) md_number_to_chars (p, val, size); p += size;
STUFF (total_size, 4); /* Length of compilation unit. */
STUFF (2, 2); /* Dwarf version */
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 264f7bf001..5d4bb60458 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <ctype.h>
#include "as.h"
-#include "subsegs.h"
+#include "subsegs.h"
#include "opcode/mn10200.h"
/* Structure to hold information about predefined registers. */
@@ -31,46 +31,47 @@ struct reg_name
int value;
};
-/* Generic assembler global variables which must be defined by all targets. */
+/* Generic assembler global variables which must be defined by all
+ targets. */
-/* Characters which always start a comment. */
+/* Characters which always start a comment. */
const char comment_chars[] = "#";
/* Characters which start a comment at the beginning of a line. */
const char line_comment_chars[] = ";#";
-/* Characters which may be used to separate multiple commands on a
+/* Characters which may be used to separate multiple commands on a
single line. */
const char line_separator_chars[] = ";";
-/* Characters which are used to indicate an exponent in a floating
+/* Characters which are used to indicate an exponent in a floating
point number. */
const char EXP_CHARS[] = "eE";
-/* Characters which mean that a number is a floating point constant,
+/* Characters which mean that a number is a floating point constant,
as in 0d1.0. */
const char FLT_CHARS[] = "dD";
-
const relax_typeS md_relax_table[] = {
- /* bCC relaxing */
+ /* bCC relaxing */
{0x81, -0x7e, 2, 1},
{0x8004, -0x7ffb, 5, 2},
{0x800006, -0x7ffff9, 7, 0},
- /* bCCx relaxing */
+ /* bCCx relaxing */
{0x81, -0x7e, 3, 4},
{0x8004, -0x7ffb, 6, 5},
{0x800006, -0x7ffff9, 8, 0},
- /* jsr relaxing */
+ /* jsr relaxing */
{0x8004, -0x7ffb, 3, 7},
{0x800006, -0x7ffff9, 5, 0},
- /* jmp relaxing */
+ /* jmp relaxing */
{0x81, -0x7e, 2, 9},
{0x8004, -0x7ffb, 3, 10},
{0x800006, -0x7ffff9, 5, 0},
};
-/* local functions */
+
+/* Local functions. */
static void mn10200_insert_operand PARAMS ((unsigned long *, unsigned long *,
const struct mn10200_operand *,
offsetT, char *, unsigned,
@@ -83,8 +84,7 @@ static boolean data_register_name PARAMS ((expressionS *expressionP));
static boolean address_register_name PARAMS ((expressionS *expressionP));
static boolean other_register_name PARAMS ((expressionS *expressionP));
-
-/* fixups */
+/* Fixups. */
#define MAX_INSN_FIXUPS (5)
struct mn10200_fixup
{
@@ -99,7 +99,7 @@ const char *md_shortopts = "";
struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
/* The target specific pseudo-ops which we support. */
const pseudo_typeS md_pseudo_table[] =
@@ -110,7 +110,7 @@ const pseudo_typeS md_pseudo_table[] =
/* Opcode hash table. */
static struct hash_control *mn10200_hash;
-/* This table is sorted. Suitable for searching by a binary search. */
+/* This table is sorted. Suitable for searching by a binary search. */
static const struct reg_name data_registers[] =
{
{ "d0", 0 },
@@ -118,7 +118,8 @@ static const struct reg_name data_registers[] =
{ "d2", 2 },
{ "d3", 3 },
};
-#define DATA_REG_NAME_CNT (sizeof(data_registers) / sizeof(struct reg_name))
+#define DATA_REG_NAME_CNT \
+ (sizeof (data_registers) / sizeof (struct reg_name))
static const struct reg_name address_registers[] =
{
@@ -127,18 +128,20 @@ static const struct reg_name address_registers[] =
{ "a2", 2 },
{ "a3", 3 },
};
-#define ADDRESS_REG_NAME_CNT (sizeof(address_registers) / sizeof(struct reg_name))
+#define ADDRESS_REG_NAME_CNT \
+ (sizeof (address_registers) / sizeof (struct reg_name))
static const struct reg_name other_registers[] =
{
{ "mdr", 0 },
{ "psw", 0 },
};
-#define OTHER_REG_NAME_CNT (sizeof(other_registers) / sizeof(struct reg_name))
+#define OTHER_REG_NAME_CNT \
+ (sizeof (other_registers) / 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
- number from the array on success, or -1 on failure. */
+ number from the array on success, or -1 on failure. */
static int
reg_name_search (regs, regcount, name)
@@ -160,14 +163,13 @@ reg_name_search (regs, regcount, name)
high = middle - 1;
else if (cmp > 0)
low = middle + 1;
- else
- return regs[middle].value;
+ else
+ return regs[middle].value;
}
while (low <= high);
return -1;
}
-
/* Summary of register_name().
*
* in: Input_line_pointer points to 1st char of operand.
@@ -178,6 +180,7 @@ reg_name_search (regs, regcount, name)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
data_register_name (expressionP)
expressionS *expressionP;
@@ -187,29 +190,34 @@ data_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
@@ -224,6 +232,7 @@ data_register_name (expressionP)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
address_register_name (expressionP)
expressionS *expressionP;
@@ -233,29 +242,34 @@ address_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
@@ -270,6 +284,7 @@ address_register_name (expressionP)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
other_register_name (expressionP)
expressionS *expressionP;
@@ -279,40 +294,45 @@ other_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
void
md_show_usage (stream)
- FILE *stream;
+ FILE *stream;
{
- fprintf(stream, _("MN10200 options:\n\
+ fprintf (stream, _("MN10200 options:\n\
none yet\n"));
-}
+}
int
md_parse_option (c, arg)
@@ -324,16 +344,16 @@ md_parse_option (c, arg)
symbolS *
md_undefined_symbol (name)
- char *name;
+ char *name;
{
return 0;
}
char *
md_atof (type, litp, sizep)
- int type;
- char *litp;
- int *sizep;
+ int type;
+ char *litp;
+ int *sizep;
{
int prec;
LITTLENUM_TYPE words[4];
@@ -354,7 +374,7 @@ md_atof (type, litp, sizep)
*sizep = 0;
return _("bad call to md_atof");
}
-
+
t = atof_ieee (input_line_pointer, type, words);
if (t)
input_line_pointer = t;
@@ -370,12 +390,11 @@ md_atof (type, litp, sizep)
return NULL;
}
-
void
md_convert_frag (abfd, sec, fragP)
- bfd *abfd;
- asection *sec;
- fragS *fragP;
+ bfd *abfd;
+ asection *sec;
+ fragS *fragP;
{
static unsigned long label_count = 0;
char buf[40];
@@ -737,7 +756,7 @@ md_begin ()
char *prev_name = "";
register const struct mn10200_opcode *op;
- mn10200_hash = hash_new();
+ mn10200_hash = hash_new ();
/* Insert unique names into hash table. The MN10200 instruction set
has many identical opcode names that have different opcodes based
@@ -747,7 +766,7 @@ md_begin ()
op = mn10200_opcodes;
while (op->name)
{
- if (strcmp (prev_name, op->name))
+ if (strcmp (prev_name, op->name))
{
prev_name = (char *) op->name;
hash_insert (mn10200_hash, op->name, (char *) op);
@@ -762,7 +781,7 @@ md_begin ()
}
void
-md_assemble (str)
+md_assemble (str)
char *str;
{
char *s;
@@ -776,13 +795,13 @@ md_assemble (str)
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && !isspace (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
- /* find the first opcode with the proper name */
- opcode = (struct mn10200_opcode *)hash_find (mn10200_hash, str);
+ /* Find the first opcode with the proper name. */
+ opcode = (struct mn10200_opcode *) hash_find (mn10200_hash, str);
if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
@@ -795,7 +814,7 @@ md_assemble (str)
input_line_pointer = str;
- for(;;)
+ for (;;)
{
const char *errmsg = NULL;
int op_idx;
@@ -833,7 +852,7 @@ md_assemble (str)
if (operand->flags & MN10200_OPERAND_RELAX)
relaxable = 1;
- /* Gather the operand. */
+ /* Gather the operand. */
hold = input_line_pointer;
input_line_pointer = str;
@@ -926,7 +945,7 @@ md_assemble (str)
expression (&ex);
}
- switch (ex.X_op)
+ switch (ex.X_op)
{
case O_illegal:
errmsg = _("illegal operand");
@@ -936,13 +955,13 @@ md_assemble (str)
goto error;
case O_register:
if ((operand->flags
- & (MN10200_OPERAND_DREG | MN10200_OPERAND_AREG)) == 0)
+ & (MN10200_OPERAND_DREG | MN10200_OPERAND_AREG)) == 0)
{
input_line_pointer = hold;
str = hold;
goto error;
}
-
+
if (opcode->format == FMT_2 || opcode->format == FMT_5)
extra_shift = 8;
else if (opcode->format == FMT_3 || opcode->format == FMT_6
@@ -950,7 +969,7 @@ md_assemble (str)
extra_shift = 16;
else
extra_shift = 0;
-
+
mn10200_insert_operand (&insn, &extension, operand,
ex.X_add_number, (char *) NULL,
0, extra_shift);
@@ -963,7 +982,7 @@ md_assemble (str)
then promote it (ie this opcode does not match). */
if (operand->flags
& (MN10200_OPERAND_PROMOTE | MN10200_OPERAND_RELAX)
- && ! check_operand (insn, operand, ex.X_add_number))
+ && !check_operand (insn, operand, ex.X_add_number))
{
input_line_pointer = hold;
str = hold;
@@ -1010,20 +1029,20 @@ keep_going:
error:
if (match == 0)
- {
+ {
next_opcode = opcode + 1;
- if (!strcmp(next_opcode->name, opcode->name))
+ if (!strcmp (next_opcode->name, opcode->name))
{
opcode = next_opcode;
continue;
}
-
+
as_bad ("%s", errmsg);
return;
- }
+ }
break;
}
-
+
while (isspace (*str))
++str;
@@ -1044,14 +1063,14 @@ keep_going:
size = 5;
else
abort ();
-
+
/* Write out the instruction. */
if (relaxable && fc > 0)
{
int type;
- /* bCC */
+ /* bCC */
if (size == 2 && opcode->opcode != 0xfc0000)
{
/* Handle bra specially. Basically treat it like jmp so
@@ -1061,18 +1080,18 @@ keep_going:
It is also important to not treat it like other bCC
instructions since the long forms of bra is different
from other bCC instructions. */
- if (opcode->opcode == 0xea00)
- type = 8;
+ if (opcode->opcode == 0xea00)
+ type = 8;
else
type = 0;
}
- /* jsr */
+ /* jsr */
else if (size == 3 && opcode->opcode == 0xfd0000)
type = 6;
- /* jmp */
+ /* jmp */
else if (size == 3 && opcode->opcode == 0xfc0000)
type = 8;
- /* bCCx */
+ /* bCCx */
else
type = 3;
@@ -1130,25 +1149,27 @@ keep_going:
int offset;
fixS *fixP;
- reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
+ reloc_howto = bfd_reloc_type_lookup (stdoutput,
+ fixups[i].reloc);
if (!reloc_howto)
- abort();
-
+ abort ();
+
size = bfd_get_reloc_size (reloc_howto);
if (size < 1 || size > 4)
- abort();
+ abort ();
offset = 4 - size;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
size,
- &fixups[i].exp,
+ &fixups[i].exp,
reloc_howto->pc_relative,
fixups[i].reloc);
- /* PC-relative offsets are from the first byte of the next
- instruction, not from the start of the current instruction. */
+ /* PC-relative offsets are from the first byte of the
+ next instruction, not from the start of the current
+ instruction. */
if (reloc_howto->pc_relative)
fixP->fx_offset += size;
}
@@ -1167,7 +1188,6 @@ keep_going:
/* Is the reloc pc-relative? */
pcrel = (operand->flags & MN10200_OPERAND_PCREL) != 0;
-
/* Choose a proper BFD relocation type. */
if (pcrel)
{
@@ -1192,7 +1212,8 @@ keep_going:
abort ();
}
- /* Convert the size of the reloc into what fix_new_exp wants. */
+ /* Convert the size of the reloc into what fix_new_exp
+ wants. */
reloc_size = reloc_size / 8;
if (reloc_size == 8)
reloc_size = 0;
@@ -1205,8 +1226,9 @@ keep_going:
reloc_size, &fixups[i].exp, pcrel,
((bfd_reloc_code_real_type) reloc));
- /* PC-relative offsets are from the first byte of the next
- instruction, not from the start of the current instruction. */
+ /* PC-relative offsets are from the first byte of the
+ next instruction, not from the start of the current
+ instruction. */
if (pcrel)
fixP->fx_offset += size;
}
@@ -1214,10 +1236,9 @@ keep_going:
}
}
+/* If while processing a fixup, a reloc really needs to be created
+ Then it is done here. */
-/* if while processing a fixup, a reloc really needs to be created */
-/* then it is done here */
-
arelent *
tc_gen_reloc (seg, fixp)
asection *seg;
@@ -1230,8 +1251,8 @@ tc_gen_reloc (seg, fixp)
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
- _("reloc %d not supported by object file format"),
- (int)fixp->fx_r_type);
+ _("reloc %d not supported by object file format"),
+ (int) fixp->fx_r_type);
return NULL;
}
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -1249,7 +1270,7 @@ tc_gen_reloc (seg, fixp)
reloc->addend = (S_GET_VALUE (fixp->fx_addsy)
- S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset);
}
- else
+ else
{
reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
@@ -1286,7 +1307,7 @@ md_estimate_size_before_relax (fragp, seg)
}
return 2;
}
-}
+}
long
md_pcrel_from (fixp)
@@ -1294,7 +1315,7 @@ md_pcrel_from (fixp)
{
return fixp->fx_frag->fr_address;
#if 0
- if (fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy))
+ if (fixp->fx_addsy != (symbolS *) NULL && !S_IS_DEFINED (fixp->fx_addsy))
{
/* The symbol is undefined. Let the linker figure it out. */
return 0;
@@ -1340,14 +1361,13 @@ mn10200_insert_operand (insnp, extensionp, operand, val, file, line, shift)
min = - (1 << (operand->bits - 1));
}
else
- {
- max = (1 << operand->bits) - 1;
- min = 0;
- }
+ {
+ max = (1 << operand->bits) - 1;
+ min = 0;
+ }
test = val;
-
if (test < (offsetT) min || test > (offsetT) max)
{
const char *err =
@@ -1397,14 +1417,13 @@ check_operand (insn, operand, val)
min = - (1 << (operand->bits - 1));
}
else
- {
- max = (1 << operand->bits) - 1;
- min = 0;
- }
+ {
+ max = (1 << operand->bits) - 1;
+ min = 0;
+ }
test = val;
-
if (test < (offsetT) min || test > (offsetT) max)
return 0;
else
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 9cbaf19b08..b701634b55 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <ctype.h>
#include "as.h"
-#include "subsegs.h"
+#include "subsegs.h"
#include "opcode/mn10300.h"
#include "dwarf2dbg.h"
@@ -34,54 +34,54 @@ struct reg_name
struct dwarf2_line_info debug_line;
-/* Generic assembler global variables which must be defined by all targets. */
+/* Generic assembler global variables which must be defined by all
+ targets. */
-/* Characters which always start a comment. */
+/* Characters which always start a comment. */
const char comment_chars[] = "#";
/* Characters which start a comment at the beginning of a line. */
const char line_comment_chars[] = ";#";
-/* Characters which may be used to separate multiple commands on a
+/* Characters which may be used to separate multiple commands on a
single line. */
const char line_separator_chars[] = ";";
-/* Characters which are used to indicate an exponent in a floating
+/* Characters which are used to indicate an exponent in a floating
point number. */
const char EXP_CHARS[] = "eE";
-/* Characters which mean that a number is a floating point constant,
+/* Characters which mean that a number is a floating point constant,
as in 0d1.0. */
const char FLT_CHARS[] = "dD";
-
const relax_typeS md_relax_table[] = {
- /* bCC relaxing */
+ /* bCC relaxing */
{0x7f, -0x80, 2, 1},
{0x7fff, -0x8000, 5, 2},
{0x7fffffff, -0x80000000, 7, 0},
- /* bCC relaxing (uncommon cases) */
+ /* bCC relaxing (uncommon cases) */
{0x7f, -0x80, 3, 4},
{0x7fff, -0x8000, 6, 5},
{0x7fffffff, -0x80000000, 8, 0},
- /* call relaxing */
+ /* call relaxing */
{0x7fff, -0x8000, 5, 7},
{0x7fffffff, -0x80000000, 7, 0},
- /* calls relaxing */
+ /* calls relaxing */
{0x7fff, -0x8000, 4, 9},
{0x7fffffff, -0x80000000, 6, 0},
- /* jmp relaxing */
+ /* jmp relaxing */
{0x7f, -0x80, 2, 11},
{0x7fff, -0x8000, 3, 12},
{0x7fffffff, -0x80000000, 5, 0},
};
-/* local functions */
+/* Local functions. */
static void mn10300_insert_operand PARAMS ((unsigned long *, unsigned long *,
const struct mn10300_operand *,
offsetT, char *, unsigned,
@@ -97,7 +97,7 @@ static void set_arch_mach PARAMS ((int));
static int current_machine;
-/* fixups */
+/* Fixups. */
#define MAX_INSN_FIXUPS (5)
struct mn10300_fixup
{
@@ -116,7 +116,7 @@ const char *md_shortopts = "";
struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
/* The target specific pseudo-ops which we support. */
const pseudo_typeS md_pseudo_table[] =
@@ -135,7 +135,7 @@ const pseudo_typeS md_pseudo_table[] =
/* Opcode hash table. */
static struct hash_control *mn10300_hash;
-/* This table is sorted. Suitable for searching by a binary search. */
+/* This table is sorted. Suitable for searching by a binary search. */
static const struct reg_name data_registers[] =
{
{ "d0", 0 },
@@ -143,7 +143,8 @@ static const struct reg_name data_registers[] =
{ "d2", 2 },
{ "d3", 3 },
};
-#define DATA_REG_NAME_CNT (sizeof(data_registers) / sizeof(struct reg_name))
+#define DATA_REG_NAME_CNT \
+ (sizeof (data_registers) / sizeof (struct reg_name))
static const struct reg_name address_registers[] =
{
@@ -152,7 +153,9 @@ static const struct reg_name address_registers[] =
{ "a2", 2 },
{ "a3", 3 },
};
-#define ADDRESS_REG_NAME_CNT (sizeof(address_registers) / sizeof(struct reg_name))
+
+#define ADDRESS_REG_NAME_CNT \
+ (sizeof (address_registers) / sizeof (struct reg_name))
static const struct reg_name r_registers[] =
{
@@ -197,7 +200,9 @@ static const struct reg_name r_registers[] =
{ "r8", 8 },
{ "r9", 9 },
};
-#define R_REG_NAME_CNT (sizeof(r_registers) / sizeof(struct reg_name))
+
+#define R_REG_NAME_CNT \
+ (sizeof (r_registers) / sizeof (struct reg_name))
static const struct reg_name xr_registers[] =
{
@@ -223,8 +228,9 @@ static const struct reg_name xr_registers[] =
{ "xr8", 8 },
{ "xr9", 9 },
};
-#define XR_REG_NAME_CNT (sizeof(xr_registers) / sizeof(struct reg_name))
+#define XR_REG_NAME_CNT \
+ (sizeof (xr_registers) / sizeof (struct reg_name))
static const struct reg_name other_registers[] =
{
@@ -232,11 +238,13 @@ static const struct reg_name other_registers[] =
{ "psw", 0 },
{ "sp", 0 },
};
-#define OTHER_REG_NAME_CNT (sizeof(other_registers) / sizeof(struct reg_name))
+
+#define OTHER_REG_NAME_CNT \
+ (sizeof (other_registers) / 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
- number from the array on success, or -1 on failure. */
+ number from the array on success, or -1 on failure. */
static int
reg_name_search (regs, regcount, name)
@@ -258,14 +266,13 @@ reg_name_search (regs, regcount, name)
high = middle - 1;
else if (cmp > 0)
low = middle + 1;
- else
- return regs[middle].value;
+ else
+ return regs[middle].value;
}
while (low <= high);
return -1;
}
-
/* Summary of register_name().
*
* in: Input_line_pointer points to 1st char of operand.
@@ -276,6 +283,7 @@ reg_name_search (regs, regcount, name)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
r_register_name (expressionP)
expressionS *expressionP;
@@ -285,29 +293,34 @@ r_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (r_registers, R_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
@@ -322,6 +335,7 @@ r_register_name (expressionP)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
xr_register_name (expressionP)
expressionS *expressionP;
@@ -331,29 +345,34 @@ xr_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (xr_registers, XR_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
@@ -368,6 +387,7 @@ xr_register_name (expressionP)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
data_register_name (expressionP)
expressionS *expressionP;
@@ -377,29 +397,34 @@ data_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
@@ -414,6 +439,7 @@ data_register_name (expressionP)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
address_register_name (expressionP)
expressionS *expressionP;
@@ -423,29 +449,35 @@ address_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
+
return false;
}
}
@@ -460,6 +492,7 @@ address_register_name (expressionP)
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state.
*/
+
static boolean
other_register_name (expressionP)
expressionS *expressionP;
@@ -469,40 +502,45 @@ other_register_name (expressionP)
char *start;
char c;
- /* Find the spelling of the operand */
+ /* Find the spelling of the operand. */
start = name = input_line_pointer;
c = get_symbol_end ();
reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name);
- /* look to see if it's in the register table */
- if (reg_number >= 0)
+ /* Look to see if it's in the register table. */
+ if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
- /* make the rest nice */
+ /* Make the rest nice. */
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
- *input_line_pointer = c; /* put back the delimiting char */
+
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
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 */
+ /* Reset the line as if we had not done anything. */
+ /* Put back the delimiting char. */
+ *input_line_pointer = c;
+
+ /* Reset input_line pointer. */
+ input_line_pointer = start;
return false;
}
}
void
md_show_usage (stream)
- FILE *stream;
+ FILE *stream;
{
- fprintf(stream, _("MN10300 options:\n\
+ fprintf (stream, _("MN10300 options:\n\
none yet\n"));
-}
+}
int
md_parse_option (c, arg)
@@ -514,16 +552,16 @@ md_parse_option (c, arg)
symbolS *
md_undefined_symbol (name)
- char *name;
+ char *name;
{
return 0;
}
char *
md_atof (type, litp, sizep)
- int type;
- char *litp;
- int *sizep;
+ int type;
+ char *litp;
+ int *sizep;
{
int prec;
LITTLENUM_TYPE words[4];
@@ -544,7 +582,7 @@ md_atof (type, litp, sizep)
*sizep = 0;
return "bad call to md_atof";
}
-
+
t = atof_ieee (input_line_pointer, type, words);
if (t)
input_line_pointer = t;
@@ -560,12 +598,11 @@ md_atof (type, litp, sizep)
return NULL;
}
-
void
md_convert_frag (abfd, sec, fragP)
- bfd *abfd;
- asection *sec;
- fragS *fragP;
+ bfd *abfd;
+ asection *sec;
+ fragS *fragP;
{
static unsigned long label_count = 0;
char buf[40];
@@ -863,7 +900,7 @@ md_begin ()
char *prev_name = "";
register const struct mn10300_opcode *op;
- mn10300_hash = hash_new();
+ mn10300_hash = hash_new ();
/* Insert unique names into hash table. The MN10300 instruction set
has many identical opcode names that have different opcodes based
@@ -873,7 +910,7 @@ md_begin ()
op = mn10300_opcodes;
while (op->name)
{
- if (strcmp (prev_name, op->name))
+ if (strcmp (prev_name, op->name))
{
prev_name = (char *) op->name;
hash_insert (mn10300_hash, op->name, (char *) op);
@@ -894,7 +931,7 @@ md_begin ()
}
void
-md_assemble (str)
+md_assemble (str)
char *str;
{
char *s;
@@ -908,13 +945,13 @@ md_assemble (str)
int match;
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && !isspace (*s); s++)
;
if (*s != '\0')
*s++ = '\0';
- /* find the first opcode with the proper name */
- opcode = (struct mn10300_opcode *)hash_find (mn10300_hash, str);
+ /* Find the first opcode with the proper name. */
+ opcode = (struct mn10300_opcode *) hash_find (mn10300_hash, str);
if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
@@ -927,14 +964,13 @@ md_assemble (str)
input_line_pointer = str;
- for(;;)
+ for (;;)
{
const char *errmsg;
int op_idx;
char *hold;
int extra_shift = 0;
-
errmsg = _("Invalid opcode/operands");
/* Reset the array of register operands. */
@@ -977,7 +1013,7 @@ md_assemble (str)
if (operand->flags & MN10300_OPERAND_RELAX)
relaxable = 1;
- /* Gather the operand. */
+ /* Gather the operand. */
hold = input_line_pointer;
input_line_pointer = str;
@@ -1172,10 +1208,10 @@ md_assemble (str)
/* Eat the '['. */
input_line_pointer++;
-
+
/* We used to reject a null register list here; however,
- we accept it now so the compiler can emit "call" instructions
- for all calls to named functions.
+ we accept it now so the compiler can emit "call"
+ instructions for all calls to named functions.
The linker can then fill in the appropriate bits for the
register list and stack size or change the instruction
@@ -1294,7 +1330,7 @@ md_assemble (str)
expression (&ex);
}
- switch (ex.X_op)
+ switch (ex.X_op)
{
case O_illegal:
errmsg = _("illegal operand");
@@ -1315,7 +1351,7 @@ md_assemble (str)
str = hold;
goto error;
}
-
+
if (opcode->format == FMT_D1 || opcode->format == FMT_S1)
extra_shift = 8;
else if (opcode->format == FMT_D2
@@ -1331,12 +1367,11 @@ md_assemble (str)
extra_shift = 8;
else
extra_shift = 0;
-
+
mn10300_insert_operand (&insn, &extension, operand,
ex.X_add_number, (char *) NULL,
0, extra_shift);
-
/* And note the register number in the register array. */
mn10300_reg_operands[op_idx - 1] = ex.X_add_number;
break;
@@ -1348,7 +1383,7 @@ md_assemble (str)
then promote it (ie this opcode does not match). */
if (operand->flags
& (MN10300_OPERAND_PROMOTE | MN10300_OPERAND_RELAX)
- && ! check_operand (insn, operand, ex.X_add_number))
+ && !check_operand (insn, operand, ex.X_add_number))
{
input_line_pointer = hold;
str = hold;
@@ -1424,20 +1459,20 @@ keep_going:
error:
if (match == 0)
- {
+ {
next_opcode = opcode + 1;
- if (!strcmp(next_opcode->name, opcode->name))
+ if (!strcmp (next_opcode->name, opcode->name))
{
opcode = next_opcode;
continue;
}
-
+
as_bad ("%s", errmsg);
return;
- }
+ }
break;
}
-
+
while (isspace (*str))
++str;
@@ -1486,7 +1521,7 @@ keep_going:
{
int type;
- /* bCC */
+ /* bCC */
if (size == 2)
{
/* Handle bra specially. Basically treat it like jmp so
@@ -1501,16 +1536,16 @@ keep_going:
else
type = 0;
}
- /* call */
+ /* call */
else if (size == 5)
- type = 6;
- /* calls */
+ type = 6;
+ /* calls */
else if (size == 4)
type = 8;
- /* jmp */
+ /* jmp */
else if (size == 3 && opcode->opcode == 0xcc0000)
type = 10;
- /* bCC (uncommon cases) */
+ /* bCC (uncommon cases) */
else
type = 3;
@@ -1518,7 +1553,7 @@ keep_going:
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)fixups[0].opindex);
-
+
/* This is pretty hokey. We basically just care about the
opcode, so we have to write out the first word big endian.
@@ -1619,29 +1654,33 @@ keep_going:
else if (opcode->format == FMT_D4)
{
unsigned long temp = ((insn & 0xffff) << 16) | (extension & 0xffff);
+
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, temp, 4);
}
else if (opcode->format == FMT_D5)
{
- unsigned long temp = ((insn & 0xffff) << 16)
- | ((extension >> 8) & 0xffff);
+ unsigned long temp = (((insn & 0xffff) << 16)
+ | ((extension >> 8) & 0xffff));
+
number_to_chars_bigendian (f, (insn >> 16) & 0xffff, 2);
number_to_chars_littleendian (f + 2, temp, 4);
number_to_chars_bigendian (f + 6, extension & 0xff, 1);
}
else if (opcode->format == FMT_D8)
{
- unsigned long temp = ((insn & 0xff) << 16) | (extension & 0xffff);
- number_to_chars_bigendian (f, (insn >> 8) & 0xffffff, 3);
- number_to_chars_bigendian (f + 3, (temp & 0xff), 1);
- number_to_chars_littleendian (f + 4, temp >> 8, 2);
+ unsigned long temp = ((insn & 0xff) << 16) | (extension & 0xffff);
+
+ number_to_chars_bigendian (f, (insn >> 8) & 0xffffff, 3);
+ number_to_chars_bigendian (f + 3, (temp & 0xff), 1);
+ number_to_chars_littleendian (f + 4, temp >> 8, 2);
}
else if (opcode->format == FMT_D9)
{
- unsigned long temp = ((insn & 0xff) << 24) | (extension & 0xffffff);
- number_to_chars_bigendian (f, (insn >> 8) & 0xffffff, 3);
- number_to_chars_littleendian (f + 3, temp, 4);
+ unsigned long temp = ((insn & 0xff) << 24) | (extension & 0xffffff);
+
+ number_to_chars_bigendian (f, (insn >> 8) & 0xffffff, 3);
+ number_to_chars_littleendian (f + 3, temp, 4);
}
/* Create any fixups. */
@@ -1657,15 +1696,16 @@ keep_going:
int offset;
fixS *fixP;
- reloc_howto = bfd_reloc_type_lookup (stdoutput, fixups[i].reloc);
+ reloc_howto = bfd_reloc_type_lookup (stdoutput,
+ fixups[i].reloc);
if (!reloc_howto)
- abort();
-
+ abort ();
+
size = bfd_get_reloc_size (reloc_howto);
if (size < 1 || size > 4)
- abort();
+ abort ();
offset = 4 - size;
fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset,
@@ -1692,7 +1732,7 @@ keep_going:
pcrel = (operand->flags & MN10300_OPERAND_PCREL) != 0;
/* Gross. This disgusting hack is to make sure we
- get the right offset for the 16/32 bit reloc in
+ get the right offset for the 16/32 bit reloc in
"call" instructions. Basically they're a pain
because the reloc isn't at the end of the instruction. */
if ((size == 5 || size == 7)
@@ -1707,7 +1747,7 @@ keep_going:
|| ((insn >> 16) & 0xffff) == 0xfe01
|| ((insn >> 16) & 0xffff) == 0xfe02))
size -= 1;
-
+
offset = size - reloc_size / 8;
/* Choose a proper BFD relocation type. */
@@ -1769,10 +1809,9 @@ keep_going:
}
}
+/* If while processing a fixup, a reloc really needs to be created
+ then it is done here. */
-/* if while processing a fixup, a reloc really needs to be created */
-/* then it is done here */
-
arelent *
tc_gen_reloc (seg, fixp)
asection *seg;
@@ -1785,15 +1824,15 @@ tc_gen_reloc (seg, fixp)
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
- _("reloc %d not supported by object file format"),
- (int)fixp->fx_r_type);
+ _("reloc %d not supported by object file format"),
+ (int) fixp->fx_r_type);
return NULL;
}
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (fixp->fx_addsy && fixp->fx_subsy)
{
-
+
if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy))
|| S_GET_SEGMENT (fixp->fx_addsy) == undefined_section)
{
@@ -1806,9 +1845,9 @@ tc_gen_reloc (seg, fixp)
reloc->addend = (S_GET_VALUE (fixp->fx_addsy)
- S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset);
}
- else
+ else
{
- reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof( asymbol *));
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->addend = fixp->fx_offset;
}
@@ -1857,7 +1896,7 @@ md_estimate_size_before_relax (fragp, seg)
else
return 2;
}
-}
+}
long
md_pcrel_from (fixp)
@@ -1865,7 +1904,7 @@ md_pcrel_from (fixp)
{
return fixp->fx_frag->fr_address;
#if 0
- if (fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy))
+ if (fixp->fx_addsy != (symbolS *) NULL && !S_IS_DEFINED (fixp->fx_addsy))
{
/* The symbol is undefined. Let the linker figure it out. */
return 0;
@@ -1917,26 +1956,25 @@ mn10300_insert_operand (insnp, extensionp, operand, val, file, line, shift)
min = - (1 << (bits - 1));
}
else
- {
- max = (1 << bits) - 1;
- min = 0;
- }
+ {
+ max = (1 << bits) - 1;
+ min = 0;
+ }
test = val;
-
if (test < (offsetT) min || test > (offsetT) max)
- {
- const char *err =
- _("operand out of range (%s not between %ld and %ld)");
- char buf[100];
-
- sprint_value (buf, test);
- if (file == (char *) NULL)
- as_warn (err, buf, min, max);
- else
- as_warn_where (file, line, err, buf, min, max);
- }
+ {
+ const char *err =
+ _("operand out of range (%s not between %ld and %ld)");
+ char buf[100];
+
+ sprint_value (buf, test);
+ if (file == (char *) NULL)
+ as_warn (err, buf, min, max);
+ else
+ as_warn_where (file, line, err, buf, min, max);
+ }
}
if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
@@ -1996,14 +2034,13 @@ check_operand (insn, operand, val)
min = - (1 << (bits - 1));
}
else
- {
- max = (1 << bits) - 1;
- min = 0;
- }
+ {
+ max = (1 << bits) - 1;
+ min = 0;
+ }
test = val;
-
if (test < (offsetT) min || test > (offsetT) max)
return 0;
else
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index 4f803095b2..1a70b0372d 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -19,12 +19,11 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Contributed by Steve Chamberlain of Transmeta, sac@pobox.com */
+/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
#include "as.h"
#include "opcode/pj.h"
-
extern const pj_opc_info_t pj_opc_info[512];
const char comment_chars[] = "!/";
@@ -33,7 +32,6 @@ const char line_comment_chars[] = "/!#";
static int pending_reloc;
static struct hash_control *opcode_hash_control;
-
static void
little (ignore)
@@ -49,14 +47,12 @@ big (ignore)
target_big_endian = 1;
}
-
const pseudo_typeS md_pseudo_table[] = {
{"ml", little, 0},
{"mb", big, 0},
{0, 0, 0}
};
-
const char FLT_CHARS[] = "rRsSfFdDxXpP";
const char EXP_CHARS[] = "eE";
@@ -67,7 +63,7 @@ md_operand (op)
if (strncmp (input_line_pointer, "%hi16", 5) == 0)
{
if (pending_reloc)
- as_bad (_ ("confusing relocation expressions"));
+ as_bad (_("confusing relocation expressions"));
pending_reloc = BFD_RELOC_PJ_CODE_HI16;
input_line_pointer += 5;
expression (op);
@@ -75,14 +71,14 @@ md_operand (op)
if (strncmp (input_line_pointer, "%lo16", 5) == 0)
{
if (pending_reloc)
- as_bad (_ ("confusing relocation expressions"));
+ as_bad (_("confusing relocation expressions"));
pending_reloc = BFD_RELOC_PJ_CODE_LO16;
input_line_pointer += 5;
expression (op);
}
}
-/* Parse an expression and then restore the input line pointer. */
+/* Parse an expression and then restore the input line pointer. */
static char *
parse_exp_save_ilp (s, op)
@@ -108,23 +104,22 @@ pj_cons_fix_new_pj (frag, where, nbytes, exp)
int nbytes;
expressionS *exp;
{
- static int rv[5][2] =
+ static int rv[5][2] =
{ { 0, 0 },
{ BFD_RELOC_8, BFD_RELOC_8 },
{ BFD_RELOC_PJ_CODE_DIR16, BFD_RELOC_16 },
{ 0, 0 },
{ BFD_RELOC_PJ_CODE_DIR32, BFD_RELOC_32 }};
- fix_new_exp (frag, where, nbytes, exp, 0,
+ fix_new_exp (frag, where, nbytes, exp, 0,
pending_reloc ? pending_reloc
- : rv [nbytes][(now_seg->flags & SEC_CODE) ? 0 : 1]);
+ : rv[nbytes][(now_seg->flags & SEC_CODE) ? 0 : 1]);
pending_reloc = 0;
}
-
/* Turn a reloc description character from the pj-opc.h table into
- code which BFD can handle. */
+ code which BFD can handle. */
static int
c_to_r (x)
@@ -151,39 +146,36 @@ c_to_r (x)
return 0;
}
-
-
-
/* Handler for the ipush fake opcode,
- turns ipush <foo> into sipush lo16<foo>, sethi hi16<foo>. */
+ turns ipush <foo> into sipush lo16<foo>, sethi hi16<foo>. */
static void
ipush_code (opcode, str)
- pj_opc_info_t *opcode ATTRIBUTE_UNUSED;
+ pj_opc_info_t *opcode ATTRIBUTE_UNUSED;
char *str;
{
int mod = 0;
char *b = frag_more (6);
expressionS arg;
+
b[0] = 0x11;
b[3] = 0xed;
parse_exp_save_ilp (str + 1, &arg, &mod);
if (mod)
- as_bad (_ ("can't have relocation for ipush"));
-
+ as_bad (_("can't have relocation for ipush"));
- fix_new_exp (frag_now, b - frag_now->fr_literal + 1, 2,
- &arg, 0, BFD_RELOC_PJ_CODE_DIR16);
+ fix_new_exp (frag_now, b - frag_now->fr_literal + 1, 2,
+ &arg, 0, BFD_RELOC_PJ_CODE_DIR16);
fix_new_exp (frag_now, b - frag_now->fr_literal + 4, 2,
- &arg, 0, BFD_RELOC_PJ_CODE_HI16);
+ &arg, 0, BFD_RELOC_PJ_CODE_HI16);
}
/* Insert names into the opcode table which are really mini macros,
- not opcodes. The fakeness is inidicated with an opcode of -1. */
+ not opcodes. The fakeness is inidicated with an opcode of -1. */
static void
- fake_opcode (name, func) const char *
- name;
+fake_opcode (name, func)
+ const char *name;
void (*func) ();
{
pj_opc_info_t *fake = (pj_opc_info_t *) xmalloc (sizeof (pj_opc_info_t));
@@ -194,22 +186,21 @@ static void
hash_insert (opcode_hash_control, name, (char *) fake);
}
-
/* Enter another entry into the opcode hash table so the same opcode
- can have another name. */
+ can have another name. */
+
static void
- alias (new, old) const char *
- new;
+alias (new, old)
+ const char *new;
const char *old;
{
hash_insert (opcode_hash_control, new,
(char *) hash_find (opcode_hash_control, old));
}
-
/* This function is called once, at assembler startup time. It sets
up the hash table with all the opcodes in it, and also initializes
- some aliases for compatibility with other assemblers. */
+ some aliases for compatibility with other assemblers. */
void
md_begin ()
@@ -217,14 +208,14 @@ md_begin ()
const pj_opc_info_t *opcode;
opcode_hash_control = hash_new ();
- /* Insert names into hash table */
+ /* Insert names into hash table. */
for (opcode = pj_opc_info; opcode->name; opcode++)
hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
- /* Insert the only fake opcode. */
+ /* Insert the only fake opcode. */
fake_opcode ("ipush", ipush_code);
- /* Add some aliases for opcode names. */
+ /* Add some aliases for opcode names. */
alias ("ifeq_s", "ifeq");
alias ("ifne_s", "ifne");
alias ("if_icmpge_s", "if_icmpge");
@@ -236,10 +227,9 @@ md_begin ()
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
}
-/* This is the guts of the machine-dependent assembler. STR points to a
- machine dependent instruction. This function is supposed to emit
- the frags/bytes it assembles to.
- */
+/* This is the guts of the machine-dependent assembler. STR points to
+ a machine dependent instruction. This function is supposed to emit
+ the frags/bytes it assembles to. */
void
md_assemble (str)
@@ -248,7 +238,9 @@ md_assemble (str)
unsigned char *op_start;
unsigned char *op_end;
- // pj_operan_info operand[3];
+#if 0
+ pj_operan_info operand[3];
+#endif
pj_opc_info_t *opcode;
char *output;
int idx = 0;
@@ -256,37 +248,35 @@ md_assemble (str)
int nlen = 0;
- /* Drop leading whitespace */
+ /* Drop leading whitespace. */
while (*str == ' ')
str++;
- /* find the op code end */
+ /* Find the op code end. */
for (op_start = op_end = (unsigned char *) (str);
*op_end && !is_end_of_line[*op_end] && *op_end != ' ';
- op_end++)
+ op_end++)
nlen++;
pend = *op_end;
*op_end = 0;
if (nlen == 0)
- {
- as_bad (_ ("can't find opcode "));
- }
+ as_bad (_("can't find opcode "));
opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
{
- as_bad (_ ("unknown opcode %s"), op_start);
+ as_bad (_("unknown opcode %s"), op_start);
return;
}
if (opcode->opcode == -1)
{
- /* It's a fake opcode.. dig out the args and pretend that was
- what we were passed */
+ /* It's a fake opcode. Dig out the args and pretend that was
+ what we were passed. */
((void (*)()) opcode->name) (opcode, op_end);
}
else
@@ -311,11 +301,11 @@ md_assemble (str)
op_end = parse_exp_save_ilp (op_end, &arg);
- fix_new_exp (frag_now,
+ fix_new_exp (frag_now,
output - frag_now->fr_literal + idx,
ASIZE (opcode->arg[an]),
&arg,
- PCREL (opcode->arg[an]),
+ PCREL (opcode->arg[an]),
pending_reloc ? pending_reloc : c_to_r (opcode->arg[an]));
idx += ASIZE (opcode->arg[an]);
@@ -335,10 +325,11 @@ md_assemble (str)
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK.
- */
+/* Turn a string in input_line_pointer into a floating point constant
+ of type type, and store the appropriate bytes in *LITP. The number
+ of LITTLENUMS emitted is stored in *SIZEP . An error message is
+ returned, or NULL on OK. */
+
char *
md_atof (type, litP, sizeP)
int type;
@@ -362,7 +353,7 @@ md_atof (type, litP, sizeP)
default:
*sizeP = 0;
- return _ ("bad call to md_atof");
+ return _("bad call to md_atof");
}
t = atof_ieee (input_line_pointer, type, words);
@@ -391,7 +382,6 @@ md_atof (type, litP, sizeP)
return NULL;
}
-
CONST char *md_shortopts = "";
struct option md_longopts[] = {
@@ -408,7 +398,7 @@ size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (c, arg)
int c;
- char *arg ATTRIBUTE_UNUSED;
+ char *arg ATTRIBUTE_UNUSED;
{
switch (c)
{
@@ -428,17 +418,14 @@ void
md_show_usage (stream)
FILE *stream;
{
- fprintf (stream, _ ("\
+ fprintf (stream, _("\
PJ options:\n\
-little generate little endian code\n\
-big generate big endian code\n"));
}
-
-
/* Apply a fixup to the object file. */
-
int
md_apply_fix (fixP, valp)
fixS *fixP;
@@ -449,7 +436,6 @@ md_apply_fix (fixP, valp)
long max, min;
int shift;
-
/* adjust_reloc_syms won't convert a reloc against a weak symbol
into a reloc against a section, but bfd_install_relocation will
screw up if the symbol is defined, so we have to adjust val here
@@ -469,7 +455,7 @@ md_apply_fix (fixP, valp)
case BFD_RELOC_PJ_CODE_REL16:
if (val < -0x8000 || val >= 0x7fff)
- as_bad_where (fixP->fx_file, fixP->fx_line, _ ("pcrel too far"));
+ as_bad_where (fixP->fx_file, fixP->fx_line, _("pcrel too far"));
buf[0] |= (val >> 8) & 0xff;
buf[1] = val & 0xff;
break;
@@ -510,7 +496,7 @@ md_apply_fix (fixP, valp)
*buf++ = val >> 8;
*buf++ = val >> 0;
}
- else
+ else
{
*buf++ = val >> 0;
*buf++ = val >> 8;
@@ -532,19 +518,18 @@ md_apply_fix (fixP, valp)
}
break;
-
default:
abort ();
}
if (max != 0 && (val < min || val > max))
- as_bad_where (fixP->fx_file, fixP->fx_line, _ ("offset out of range"));
+ as_bad_where (fixP->fx_file, fixP->fx_line, _("offset out of range"));
return 0;
}
/* Put number into target byte order. Always put values in an
- executable section into big endian order. */
+ executable section into big endian order. */
void
md_number_to_chars (ptr, use, nbytes)
@@ -558,10 +543,8 @@ md_number_to_chars (ptr, use, nbytes)
number_to_chars_littleendian (ptr, use, nbytes);
}
-
-
/* Translate internal representation of relocation info to BFD target
- format. */
+ format. */
arelent *
tc_gen_reloc (section, fixp)
@@ -583,7 +566,7 @@ tc_gen_reloc (section, fixp)
if (rel->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
- _ ("Cannot represent relocation type %s"),
+ _("Cannot represent relocation type %s"),
bfd_get_reloc_code_name (r_type));
/* Set howto to a garbage value so that we can keep going. */
rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c
index f31dba32f9..ce8e416618 100644
--- a/gas/config/tc-tic80.c
+++ b/gas/config/tc-tic80.c
@@ -22,14 +22,15 @@
#include "opcode/tic80.h"
#define internal_error(what) \
- as_fatal(_("internal error:%s:%d: %s\n"),__FILE__,__LINE__,what)
-#define internal_error_a(what,arg) \
- as_fatal(_("internal error:%s:%d: %s %d\n"),__FILE__,__LINE__,what,arg)
+ as_fatal(_("internal error:%s:%d: %s\n"), __FILE__, __LINE__, what)
+#define internal_error_a(what,arg) \
+ as_fatal(_("internal error:%s:%d: %s %d\n"), __FILE__, __LINE__, what, arg)
-/* Generic assembler global variables which must be defined by all targets. */
+/* Generic assembler global variables which must be defined by all
+ targets. */
-/* Characters which always start a comment. */
+/* Characters which always start a comment. */
const char comment_chars[] = ";";
/* Characters which start a comment at the beginning of a line. */
@@ -37,14 +38,14 @@ const char line_comment_chars[] = ";*#";
/* Characters which may be used to separate multiple commands on a single
line. The semicolon is such a character by default and should not be
- explicitly listed. */
+ explicitly listed. */
const char line_separator_chars[] = "";
-/* Characters which are used to indicate an exponent in a floating
+/* Characters which are used to indicate an exponent in a floating
point number. */
const char EXP_CHARS[] = "eE";
-/* Characters which mean that a number is a floating point constant,
+/* Characters which mean that a number is a floating point constant,
as in 0f1.0. */
const char FLT_CHARS[] = "fF";
@@ -53,17 +54,17 @@ const char FLT_CHARS[] = "fF";
pseudo-op name without dot
function to call to execute this pseudo-op
- integer arg to pass to the function */
+ integer arg to pass to the function */
extern void obj_coff_section ();
const pseudo_typeS md_pseudo_table[] =
{
- { "align", s_align_bytes, 4 }, /* Do byte alignment, default is a 4 byte boundary */
- { "word", cons, 4 }, /* FIXME: Should this be machine independent? */
+ { "align", s_align_bytes, 4 }, /* Do byte alignment, default is a 4 byte boundary */
+ { "word", cons, 4 }, /* FIXME: Should this be machine independent? */
{ "bss", s_lcomm_bytes, 1 },
- { "sect", obj_coff_section, 0}, /* For compatibility with TI tools */
- { "section", obj_coff_section, 0}, /* Standard COFF .section pseudo-op */
+ { "sect", obj_coff_section, 0}, /* For compatibility with TI tools */
+ { "section", obj_coff_section, 0}, /* Standard COFF .section pseudo-op */
{ NULL, NULL, 0 }
};
@@ -75,12 +76,12 @@ static void build_insn PARAMS ((struct tic80_opcode *, expressionS *));
static int get_operands PARAMS ((expressionS exp[]));
static int const_overflow PARAMS ((unsigned long num, int bits, int flags));
-/* Replace short PC relative instructions with long form when necessary. Currently
- this is off by default or when given the -no-relax option. Turning it on by using
- the -relax option forces all PC relative instructions to use the long form, which
- is why it is currently not the default. */
+/* Replace short PC relative instructions with long form when
+ necessary. Currently this is off by default or when given the
+ -no-relax option. Turning it on by using the -relax option forces
+ all PC relative instructions to use the long form, which is why it
+ is currently not the default. */
static int tic80_relax = 0;
-
int
md_estimate_size_before_relax (fragP, segment_type)
@@ -93,7 +94,6 @@ md_estimate_size_before_relax (fragP, segment_type)
/* We have no need to default values of symbols. */
-/* ARGSUSED */
symbolS *
md_undefined_symbol (name)
char *name;
@@ -101,10 +101,10 @@ md_undefined_symbol (name)
return 0;
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK.
- */
+/* Turn a string in input_line_pointer into a floating point constant
+ of type TYPE, and store the appropriate bytes in *LITP. The number
+ of LITTLENUMS emitted is stored in *SIZEP. An error message is
+ returned, or NULL on OK. */
#define MAX_LITTLENUMS 4
@@ -119,7 +119,7 @@ md_atof (type, litP, sizeP)
LITTLENUM_TYPE *wordP;
char *t;
char *atof_ieee ();
-
+
switch (type)
{
case 'f':
@@ -146,9 +146,9 @@ md_atof (type, litP, sizeP)
{
input_line_pointer = t;
}
-
+
*sizeP = prec * sizeof (LITTLENUM_TYPE);
-
+
for (wordP = words; prec--;)
{
md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
@@ -158,7 +158,7 @@ md_atof (type, litP, sizeP)
}
/* Check to see if the constant value in NUM will fit in a field of
- width BITS if it has flags FLAGS. */
+ width BITS if it has flags FLAGS. */
static int
const_overflow (num, bits, flags)
@@ -169,12 +169,12 @@ const_overflow (num, bits, flags)
long min, max;
int retval = 0;
- /* Only need to check fields less than 32 bits wide */
+ /* Only need to check fields less than 32 bits wide. */
if (bits < 32)
if (flags & TIC80_OPERAND_SIGNED)
{
- max = (1 << (bits - 1)) - 1;
- min = - (1 << (bits - 1));
+ max = (1 << (bits - 1)) - 1;
+ min = - (1 << (bits - 1));
retval = ((long) num > max) || ((long) num < min);
}
else
@@ -186,19 +186,17 @@ const_overflow (num, bits, flags)
return (retval);
}
-/* get_operands() parses a string of operands and fills in a passed array of
- expressions in EXP.
+/* get_operands () parses a string of operands and fills in a passed
+ array of expressions in EXP.
Note that we use O_absent expressions to record additional information
about the previous non-O_absent expression, such as ":m" or ":s"
modifiers or register numbers enclosed in parens like "(r10)".
- Returns the number of expressions that were placed in EXP.
-
- */
+ Returns the number of expressions that were placed in EXP. */
static int
-get_operands (exp)
+get_operands (exp)
expressionS exp[];
{
char *p = input_line_pointer;
@@ -207,37 +205,33 @@ get_operands (exp)
int sflag = 0;
int parens = 0;
- while (*p)
+ while (*p)
{
- /* Skip leading whitespace */
- while (*p == ' ' || *p == '\t' || *p == ',')
- {
- p++;
- }
+ /* Skip leading whitespace. */
+ while (*p == ' ' || *p == '\t' || *p == ',')
+ p++;
+
+ /* Check to see if we have any operands left to parse. */
+ if (*p == 0 || *p == '\n' || *p == '\r')
+ break;
- /* Check to see if we have any operands left to parse */
- if (*p == 0 || *p == '\n' || *p == '\r')
- {
- break;
- }
-
/* Notice scaling or direct memory operand modifiers and save them in
- an O_absent expression after the expression that they modify. */
+ an O_absent expression after the expression that they modify. */
- if (*p == ':')
+ if (*p == ':')
{
p++;
exp[numexp].X_op = O_absent;
- if (*p == 'm')
+ if (*p == 'm')
{
p++;
- /* This is a ":m" modifier */
+ /* This is a ":m" modifier. */
exp[numexp].X_add_number = TIC80_OPERAND_M_SI | TIC80_OPERAND_M_LI;
}
else if (*p == 's')
{
p++;
- /* This is a ":s" modifier */
+ /* This is a ":s" modifier. */
exp[numexp].X_add_number = TIC80_OPERAND_SCALED;
}
else
@@ -250,34 +244,32 @@ get_operands (exp)
/* Handle leading '(' on operands that use them, by recording that we
have entered a paren nesting level and then continuing. We complain
- about multiple nesting. */
+ about multiple nesting. */
if (*p == '(')
{
if (++parens != 1)
- {
- as_bad (_("paren nesting"));
- }
+ as_bad (_("paren nesting"));
+
p++;
continue;
}
/* Handle trailing ')' on operands that use them, by reducing the
nesting level and then continuing. We complain if there were too
- many closures. */
+ many closures. */
- if (*p == ')')
+ if (*p == ')')
{
- /* Record that we have left a paren group and continue */
+ /* Record that we have left a paren group and continue. */
if (--parens < 0)
- {
- as_bad (_("mismatched parenthesis"));
- }
+ as_bad (_("mismatched parenthesis"));
+
p++;
continue;
}
- /* Begin operand parsing at the current scan point. */
+ /* Begin operand parsing at the current scan point. */
input_line_pointer = p;
expression (&exp[numexp]);
@@ -301,7 +293,7 @@ get_operands (exp)
exp[numexp++].X_add_number = TIC80_OPERAND_PARENS;
}
- /* Mark the end of the valid operands with an illegal expression. */
+ /* Mark the end of the valid operands with an illegal expression. */
exp[numexp].X_op = O_illegal;
return (numexp);
@@ -332,19 +324,19 @@ find_opcode (opcode, myops)
const struct tic80_opcode *end; /* Pointer to end of opcode table */
/* First parse all the operands so we only have to do it once. There may
- be more expressions generated than there are operands. */
+ be more expressions generated than there are operands. */
numexp = get_operands (myops);
/* For each opcode with the same name, try to match it against the parsed
- operands. */
+ operands. */
end = tic80_opcodes + tic80_num_opcodes;
- while (!match && (opc < end) && (strcmp (opc -> name, opcode -> name) == 0))
+ while (!match && (opc < end) && (strcmp (opc->name, opcode->name) == 0))
{
/* Start off assuming a match. If we find a mismatch, then this is
reset and the operand/expr matching loop terminates with match
- equal to zero, which allows us to try the next opcode. */
+ equal to zero, which allows us to try the next opcode. */
match = 1;
@@ -362,21 +354,21 @@ find_opcode (opcode, myops)
/* The O_absent expressions apply to the same operand as the most
recent non O_absent expression. So only increment the operand
index when the current expression is not one of these special
- expressions. */
+ expressions. */
if (X_op != O_absent)
{
opi++;
}
- flags = tic80_operands[opc -> operands[opi]].flags;
- bits = tic80_operands[opc -> operands[opi]].bits;
+ flags = tic80_operands[opc->operands[opi]].flags;
+ bits = tic80_operands[opc->operands[opi]].bits;
switch (X_op)
{
case O_register:
- /* Also check that registers that are supposed to be even actually
- are even. */
+ /* Also check that registers that are supposed to be
+ even actually are even. */
if (((flags & TIC80_OPERAND_GPR) != (num & TIC80_OPERAND_GPR)) ||
((flags & TIC80_OPERAND_FPA) != (num & TIC80_OPERAND_FPA)) ||
((flags & TIC80_OPERAND_CR) != (num & TIC80_OPERAND_CR)) ||
@@ -389,7 +381,8 @@ find_opcode (opcode, myops)
case O_constant:
if ((flags & TIC80_OPERAND_ENDMASK) && (num == 32))
{
- /* Endmask values of 0 and 32 give identical results */
+ /* Endmask values of 0 and 32 give identical
+ results. */
num = 0;
}
if ((flags & (TIC80_OPERAND_FPA | TIC80_OPERAND_GPR)) ||
@@ -399,35 +392,43 @@ find_opcode (opcode, myops)
}
break;
case O_symbol:
- if ((bits < 32) && (flags & TIC80_OPERAND_PCREL) && !tic80_relax)
+ if ((bits < 32) && (flags & TIC80_OPERAND_PCREL)
+ && !tic80_relax)
{
- /* The default is to prefer the short form of PC relative relocations.
- This is the only form that the TI assembler supports.
- If the -relax option is given, we never use the short forms.
- FIXME: Should be able to choose "best-fit". */
+ /* The default is to prefer the short form of PC
+ relative relocations. This is the only form that
+ the TI assembler supports. If the -relax option
+ is given, we never use the short forms.
+ FIXME: Should be able to choose "best-fit". */
}
- else if ((bits == 32) /* && (flags & TIC80_OPERAND_BASEREL) */)
+ else if ((bits == 32)
+#if 0
+ && (flags & TIC80_OPERAND_BASEREL)
+#endif
+ )
{
- /* The default is to prefer the long form of base relative relocations.
- This is the only form that the TI assembler supports.
- If the -no-relax option is given, we always use the long form of
+ /* The default is to prefer the long form of base
+ relative relocations. This is the only form that
+ the TI assembler supports. If the -no-relax
+ option is given, we always use the long form of
PC relative relocations.
- FIXME: Should be able to choose "best-fit". */
+ FIXME: Should be able to choose "best-fit". */
}
else
{
/* Symbols that don't match one of the above cases are
- rejected as an operand. */
+ rejected as an operand. */
match = 0;
}
break;
case O_absent:
- /* If this is an O_absent expression, then it may be an expression that
- supplies additional information about the operand, such as ":m" or
- ":s" modifiers. Check to see that the operand matches this requirement. */
- if (!((num & TIC80_OPERAND_M_SI) && (flags & TIC80_OPERAND_M_SI) ||
- (num & TIC80_OPERAND_M_LI) && (flags & TIC80_OPERAND_M_LI) ||
- (num & TIC80_OPERAND_SCALED) && (flags & TIC80_OPERAND_SCALED)))
+ /* If this is an O_absent expression, then it may be an
+ expression that supplies additional information about
+ the operand, such as ":m" or ":s" modifiers. Check to
+ see that the operand matches this requirement. */
+ if (!((num & TIC80_OPERAND_M_SI) && (flags & TIC80_OPERAND_M_SI)
+ || (num & TIC80_OPERAND_M_LI) && (flags & TIC80_OPERAND_M_LI)
+ || (num & TIC80_OPERAND_SCALED) && (flags & TIC80_OPERAND_SCALED)))
{
match = 0;
}
@@ -468,96 +469,94 @@ find_opcode (opcode, myops)
}
}
if (!match)
- {
- opc++;
- }
- }
+ opc++;
+ }
return (match ? opc : NULL);
#if 0
-
/* Now search the opcode table table for one with operands that
- matches what we've got. */
+ matches what we've got. */
while (!match)
{
match = 1;
- for (i = 0; opcode -> operands[i]; i++)
+ for (i = 0; opcode->operands[i]; i++)
{
int flags = tic80_operands[opcode->operands[i]].flags;
int X_op = myops[i].X_op;
int num = myops[i].X_add_number;
- if (X_op == 0)
+ if (X_op == 0)
{
match = 0;
break;
}
-
- if (flags & (TIC80_OPERAND_GPR | TIC80_OPERAND_FPA | TIC80_OPERAND_CR))
+
+ if (flags
+ & (TIC80_OPERAND_GPR | TIC80_OPERAND_FPA | TIC80_OPERAND_CR))
{
if ((X_op != O_register) ||
((flags & TIC80_OPERAND_GPR) != (num & TIC80_OPERAND_GPR)) ||
((flags & TIC80_OPERAND_FPA) != (num & TIC80_OPERAND_FPA)) ||
((flags & TIC80_OPERAND_CR) != (num & TIC80_OPERAND_CR)))
{
- match=0;
+ match = 0;
break;
- }
+ }
}
-
+
if (((flags & TIC80_OPERAND_MINUS) && ((X_op != O_absent) || (num != TIC80_OPERAND_MINUS))) ||
((flags & TIC80_OPERAND_PLUS) && ((X_op != O_absent) || (num != TIC80_OPERAND_PLUS))) ||
((flags & TIC80_OPERAND_ATMINUS) && ((X_op != O_absent) || (num != TIC80_OPERAND_ATMINUS))) ||
((flags & TIC80_OPERAND_ATPAR) && ((X_op != O_absent) || (num != TIC80_OPERAND_ATPAR))) ||
- ((flags & TIC80_OPERAND_ATSIGN) && ((X_op != O_absent) || (num != TIC80_OPERAND_ATSIGN))))
+ ((flags & TIC80_OPERAND_ATSIGN) && ((X_op != O_absent) || (num != TIC80_OPERAND_ATSIGN))))
{
- match=0;
+ match = 0;
break;
- }
+ }
}
- /* we're only done if the operands matched so far AND there
- are no more to check */
- if (match && myops[i].X_op==0)
+ /* We're only done if the operands matched so far AND there
+ are no more to check. */
+ if (match && myops[i].X_op == 0)
break;
else
match = 0;
- next_opcode = opcode+1;
- if (next_opcode->opcode == 0)
+ next_opcode = opcode + 1;
+ if (next_opcode->opcode == 0)
break;
- if (strcmp(next_opcode->name, opcode->name))
+ if (strcmp (next_opcode->name, opcode->name))
break;
opcode = next_opcode;
}
- if (!match)
+ if (!match)
{
as_bad (_("bad opcode or operands"));
return (0);
}
- /* Check that all registers that are required to be even are. */
- /* Also, if any operands were marked as registers, but were really symbols */
- /* fix that here. */
- for (i=0; opcode->operands[i]; i++)
+ /* Check that all registers that are required to be even are.
+ Also, if any operands were marked as registers, but were really
+ symbols, fix that here. */
+ for (i = 0; opcode->operands[i]; i++)
{
- if ((tic80_operands[opcode->operands[i]].flags & TIC80_OPERAND_EVEN) &&
- (myops[i].X_add_number & 1))
+ if ((tic80_operands[opcode->operands[i]].flags & TIC80_OPERAND_EVEN)
+ && (myops[i].X_add_number & 1))
as_fatal (_("Register number must be EVEN"));
if (myops[i].X_op == O_register)
{
- if (!(tic80_operands[opcode->operands[i]].flags & TIC80_OPERAND_REG))
+ if (!(tic80_operands[opcode->operands[i]].flags & TIC80_OPERAND_REG))
{
myops[i].X_op = O_symbol;
- myops[i].X_add_symbol = symbol_find_or_make ((char *)myops[i].X_op_symbol);
+ myops[i].X_add_symbol =
+ symbol_find_or_make ((char *) myops[i].X_op_symbol);
myops[i].X_add_number = 0;
myops[i].X_op_symbol = NULL;
}
}
}
-
#endif
}
@@ -566,10 +565,10 @@ find_opcode (opcode, myops)
Note that the opcode word and extended word may be written to different
frags, with the opcode at the end of one frag and the extension at the
- beginning of the next. */
+ beginning of the next. */
static void
-build_insn (opcode, opers)
+build_insn (opcode, opers)
struct tic80_opcode *opcode;
expressionS *opers;
{
@@ -581,17 +580,17 @@ build_insn (opcode, opers)
char *fx = NULL; /* Pointer to frag location for insn[1] */
fragS *fxfrag; /* Frag containing location fx */
- /* Start with the raw opcode bits from the opcode table. */
- insn[0] = opcode -> opcode;
+ /* Start with the raw opcode bits from the opcode table. */
+ insn[0] = opcode->opcode;
/* We are going to insert at least one 32 bit opcode so get the
- frag now. */
+ frag now. */
f = frag_more (4);
ffrag = frag_now;
/* For each operand expression, insert the appropriate bits into the
- instruction . */
+ instruction. */
for (expi = 0, opi = -1; opers[expi].X_op != O_illegal; expi++)
{
int bits, shift, flags, X_op, num;
@@ -602,16 +601,16 @@ build_insn (opcode, opers)
/* The O_absent expressions apply to the same operand as the most
recent non O_absent expression. So only increment the operand
index when the current expression is not one of these special
- expressions. */
+ expressions. */
if (X_op != O_absent)
{
opi++;
}
- flags = tic80_operands[opcode -> operands[opi]].flags;
- bits = tic80_operands[opcode -> operands[opi]].bits;
- shift = tic80_operands[opcode -> operands[opi]].shift;
+ flags = tic80_operands[opcode->operands[opi]].flags;
+ bits = tic80_operands[opcode->operands[opi]].bits;
+ shift = tic80_operands[opcode->operands[opi]].shift;
switch (X_op)
{
@@ -622,15 +621,16 @@ build_insn (opcode, opers)
case O_constant:
if ((flags & TIC80_OPERAND_ENDMASK) && (num == 32))
{
- /* Endmask values of 0 and 32 give identical results */
+ /* Endmask values of 0 and 32 give identical results. */
num = 0;
}
else if ((flags & TIC80_OPERAND_BITNUM))
{
- /* BITNUM values are stored in one's complement form */
+ /* BITNUM values are stored in one's complement form. */
num = (~num & 0x1F);
}
- /* Mask off upper bits, just it case it is signed and is negative */
+ /* Mask off upper bits, just it case it is signed and is
+ negative. */
if (bits < 32)
{
num &= (1 << bits) - 1;
@@ -652,18 +652,18 @@ build_insn (opcode, opers)
if (flags & TIC80_OPERAND_PCREL)
{
fix_new_exp (fxfrag,
- fx - (fxfrag -> fr_literal),
+ fx - (fxfrag->fr_literal),
4,
- &opers[expi],
+ &opers[expi],
1,
R_MPPCR);
}
else
{
fix_new_exp (fxfrag,
- fx - (fxfrag -> fr_literal),
+ fx - (fxfrag->fr_literal),
4,
- &opers[expi],
+ &opers[expi],
0,
R_RELLONGX);
}
@@ -671,8 +671,8 @@ build_insn (opcode, opers)
else if (flags & TIC80_OPERAND_PCREL)
{
fix_new_exp (ffrag,
- f - (ffrag -> fr_literal),
- 4, /* FIXME! how is this used? */
+ f - (ffrag->fr_literal),
+ 4, /* FIXME! how is this used? */
&opers[expi],
1,
R_MPPCR15W);
@@ -683,26 +683,33 @@ build_insn (opcode, opers)
}
break;
case O_absent:
- /* Each O_absent expression can indicate exactly one possible modifier. */
- if ((num & TIC80_OPERAND_M_SI) && (flags & TIC80_OPERAND_M_SI))
+ /* Each O_absent expression can indicate exactly one
+ possible modifier. */
+ if ((num & TIC80_OPERAND_M_SI)
+ && (flags & TIC80_OPERAND_M_SI))
{
insn[0] = insn[0] | (1 << 17);
}
- else if ((num & TIC80_OPERAND_M_LI) && (flags & TIC80_OPERAND_M_LI))
+ else if ((num & TIC80_OPERAND_M_LI)
+ && (flags & TIC80_OPERAND_M_LI))
{
insn[0] = insn[0] | (1 << 15);
}
- else if ((num & TIC80_OPERAND_SCALED) && (flags & TIC80_OPERAND_SCALED))
+ else if ((num & TIC80_OPERAND_SCALED)
+ && (flags & TIC80_OPERAND_SCALED))
{
insn[0] = insn[0] | (1 << 11);
}
- else if ((num & TIC80_OPERAND_PARENS) && (flags & TIC80_OPERAND_PARENS))
+ else if ((num & TIC80_OPERAND_PARENS)
+ && (flags & TIC80_OPERAND_PARENS))
{
- /* No code to generate, just accept and discard this expression */
+ /* No code to generate, just accept and discard this
+ expression. */
}
else
{
- internal_error_a (_("unhandled operand modifier"), opers[expi].X_add_number);
+ internal_error_a (_("unhandled operand modifier"),
+ opers[expi].X_add_number);
}
break;
case O_big:
@@ -712,7 +719,7 @@ build_insn (opcode, opers)
int precision = 2;
long exponent_bits = 8L;
LITTLENUM_TYPE words[2];
- /* Value is still in generic_floating_point_number */
+ /* Value is still in generic_floating_point_number. */
gen_to_words (words, precision, exponent_bits);
insn[1] = (words[0] << 16) | words[1];
}
@@ -774,24 +781,22 @@ md_assemble (str)
expressionS myops[16];
unsigned long insn;
- /* Ensure there is something there to assemble. */
+ /* Ensure there is something there to assemble. */
assert (str);
- /* Drop any leading whitespace. */
+ /* Drop any leading whitespace. */
while (isspace (*str))
- {
- str++;
- }
+ str++;
/* Isolate the mnemonic from the rest of the string by finding the first
whitespace character and zapping it to a null byte. */
- for (scan = str; *scan != '\000' && !isspace (*scan); scan++) {;}
+ for (scan = str; *scan != '\000' && !isspace (*scan); scan++)
+ ;
+
if (*scan != '\000')
- {
- *scan++ = '\000';
- }
+ *scan++ = '\000';
- /* Try to find this mnemonic in the hash table */
+ /* Try to find this mnemonic in the hash table. */
if ((opcode = (struct tic80_opcode *) hash_find (tic80_hash, str)) == NULL)
{
as_bad (_("Invalid mnemonic: '%s'"), str);
@@ -800,18 +805,14 @@ md_assemble (str)
str = scan;
while (isspace (*scan))
- {
- scan++;
- }
+ scan++;
input_line_save = input_line_pointer;
input_line_pointer = str;
opcode = find_opcode (opcode, myops);
if (opcode == NULL)
- {
- as_bad (_("Invalid operands: '%s'"), input_line_save);
- }
+ as_bad (_("Invalid operands: '%s'"), input_line_save);
input_line_pointer = input_line_save;
build_insn (opcode, myops);
@@ -831,12 +832,12 @@ md_begin ()
register const struct tic80_opcode *op;
register const struct tic80_opcode *op_end;
const struct predefined_symbol *pdsp;
- extern int coff_flags; /* Defined in obj-coff.c */
+ extern int coff_flags; /* Defined in obj-coff.c */
/* Set F_AR32WR in coff_flags, which will end up in the file header
- f_flags field. */
+ f_flags field. */
- coff_flags |= F_AR32WR; /* TIc80 is 32 bit little endian */
+ coff_flags |= F_AR32WR; /* TIc80 is 32 bit little endian. */
/* Insert unique names into hash table. The TIc80 instruction set
has many identical opcode names that have different opcodes based
@@ -847,23 +848,25 @@ md_begin ()
op_end = tic80_opcodes + tic80_num_opcodes;
for (op = tic80_opcodes; op < op_end; op++)
{
- if (strcmp (prev_name, op -> name) != 0)
+ if (strcmp (prev_name, op->name) != 0)
{
- prev_name = (char *) op -> name;
- hash_insert (tic80_hash, op -> name, (char *) op);
+ prev_name = (char *) op->name;
+ hash_insert (tic80_hash, op->name, (char *) op);
}
}
- /* Insert the predefined symbols into the symbol table. We use symbol_create
- rather than symbol_new so that these symbols don't end up in the object
- files' symbol table. Note that the values of the predefined symbols include
- some upper bits that distinguish the type of the symbol (register, bitnum,
- condition code, etc) and these bits must be masked away before actually
- inserting the values into the instruction stream. For registers we put
- these bits in the symbol table since we use them later and there is no
- question that they aren't part of the register number. For constants we
- can't do that since the constant can be any value, so they are masked off
- before putting them into the symbol table. */
+ /* Insert the predefined symbols into the symbol table. We use
+ symbol_create rather than symbol_new so that these symbols don't
+ end up in the object files' symbol table. Note that the values
+ of the predefined symbols include some upper bits that
+ distinguish the type of the symbol (register, bitnum, condition
+ code, etc) and these bits must be masked away before actually
+ inserting the values into the instruction stream. For registers
+ we put these bits in the symbol table since we use them later and
+ there is no question that they aren't part of the register
+ number. For constants we can't do that since the constant can be
+ any value, so they are masked off before putting them into the
+ symbol table. */
pdsp = NULL;
while ((pdsp = tic80_next_predefined_symbol (pdsp)) != NULL)
@@ -894,15 +897,13 @@ md_begin ()
&zero_address_frag));
}
}
-
-
-/* The assembler adds md_shortopts to the string passed to getopt. */
+/* The assembler adds md_shortopts to the string passed to getopt. */
CONST char *md_shortopts = "";
/* The assembler adds md_longopts to the machine independent long options
- that are passed to getopt. */
+ that are passed to getopt. */
struct option md_longopts[] = {
@@ -915,11 +916,11 @@ struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
/* The md_parse_option function will be called whenever getopt returns an
unrecognized code, presumably indicating a special code value which
- appears in md_longopts for machine specific command line options. */
+ appears in md_longopts for machine specific command line options. */
int
md_parse_option (c, arg)
@@ -942,7 +943,7 @@ md_parse_option (c, arg)
/* The md_show_usage function will be called whenever a usage message is
printed. It should print a description of the machine specific options
- found in md_longopts. */
+ found in md_longopts. */
void
md_show_usage (stream)
@@ -953,22 +954,20 @@ TIc80 options:\n\
-relax alter PC relative branch instructions to use long form when needed\n\
-no-relax always use short PC relative branch instructions, error on overflow\n");
}
-
/* Attempt to simplify or even eliminate a fixup. The return value is
ignored; perhaps it was once meaningful, but now it is historical.
- To indicate that a fixup has been eliminated, set fixP->fx_done.
- */
+ To indicate that a fixup has been eliminated, set fixP->fx_done. */
void
md_apply_fix (fixP, val)
fixS *fixP;
long val;
{
- char *dest = fixP -> fx_frag -> fr_literal + fixP -> fx_where;
+ char *dest = fixP->fx_frag->fr_literal + fixP->fx_where;
int overflow;
- switch (fixP -> fx_r_type)
+ switch (fixP->fx_r_type)
{
case R_RELLONGX:
md_number_to_chars (dest, (valueT) val, 4);
@@ -982,7 +981,7 @@ md_apply_fix (fixP, val)
overflow = (val < -65536L) || (val > 65532L);
if (overflow)
{
- as_bad_where (fixP -> fx_file, fixP -> fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("PC offset 0x%lx outside range 0x%lx-0x%lx"),
val, -65536L, 65532L);
}
@@ -995,14 +994,14 @@ md_apply_fix (fixP, val)
}
break;
case R_ABS:
- md_number_to_chars (dest, (valueT) val, fixP -> fx_size);
+ md_number_to_chars (dest, (valueT) val, fixP->fx_size);
break;
default:
- internal_error_a (_("unhandled relocation type in fixup"), fixP -> fx_r_type);
+ internal_error_a (_("unhandled relocation type in fixup"),
+ fixP->fx_r_type);
break;
}
}
-
/* Functions concerning relocs. */
@@ -1010,17 +1009,16 @@ md_apply_fix (fixP, val)
given a PC relative reloc.
For the TIc80, this is the address of the 32 bit opcode containing
- the PC relative field. */
+ the PC relative field. */
long
md_pcrel_from (fixP)
fixS *fixP;
{
- return (fixP -> fx_frag -> fr_address + fixP -> fx_where) ;
+ return (fixP->fx_frag->fr_address + fixP->fx_where);
}
-/*
- * Called after relax() is finished.
+/* Called after relax() is finished.
* In: Address of frag.
* fr_type == rs_machine_dependent.
* fr_subtype is what the address relaxed to.
@@ -1038,9 +1036,7 @@ md_convert_frag (headers, seg, fragP)
internal_error (_("md_convert_frag() not implemented yet"));
abort ();
}
-
-/*ARGSUSED*/
void
tc_coff_symbol_emit_hook (ignore)
symbolS *ignore;
@@ -1053,9 +1049,7 @@ short
tc_coff_fix2rtype (fixP)
fixS *fixP;
{
- return (fixP -> fx_r_type);
+ return (fixP->fx_r_type);
}
-#endif /* OBJ_COFF */
-
-/* end of tc-tic80.c */
+#endif /* OBJ_COFF */