aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2000-09-20 21:12:43 +0000
committerKazu Hirata <kazu@codesourcery.com>2000-09-20 21:12:43 +0000
commita75214e5d442529a6eb46a5e988076e3a1c2a47d (patch)
treeaed3afe22251bb0714c50b269d7b0d03fb0de102 /gas
parenta4d24084f10f88c0b8417bb2dab720a456345d87 (diff)
downloadgdb-a75214e5d442529a6eb46a5e988076e3a1c2a47d.zip
gdb-a75214e5d442529a6eb46a5e988076e3a1c2a47d.tar.gz
gdb-a75214e5d442529a6eb46a5e988076e3a1c2a47d.tar.bz2
2000-09-20 Kazu Hirata <kazu@hxi.com>
* config/tc-mcore.c: Fix formatting. * config/tc-mcore.h: Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-mcore.c564
-rw-r--r--gas/config/tc-mcore.h13
3 files changed, 289 insertions, 292 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 6d11c7e..7c89c0e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,6 +1,8 @@
2000-09-20 Kazu Hirata <kazu@hxi.com>
- * config/tc-tahoe.c: Fix formatting.
+ * config/tc-mcore.c: Fix formatting.
+ * config/tc-mcore.h: Likewise.
+ * config/tc-tahoe.c: Likewise.
* config/tc-tahoe.h: Likewise.
2000-09-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 0284c00..88be220 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -116,19 +116,19 @@ cpu_type cpu = M340;
/* Initialize the relax table. */
const relax_typeS md_relax_table[] =
{
-{ 1, 1, 0, 0 }, /* 0: unused */
-{ 1, 1, 0, 0 }, /* 1: unused */
-{ 1, 1, 0, 0 }, /* 2: unused */
-{ 1, 1, 0, 0 }, /* 3: unused */
-{ 1, 1, 0, 0 }, /* 4: unused */
+{ 1, 1, 0, 0 }, /* 0: unused */
+{ 1, 1, 0, 0 }, /* 1: unused */
+{ 1, 1, 0, 0 }, /* 2: unused */
+{ 1, 1, 0, 0 }, /* 3: unused */
+{ 1, 1, 0, 0 }, /* 4: unused */
{ 2048, -2046, C12_LEN, C(COND_JUMP, COND32) }, /* 5: C(COND_JUMP, COND12) */
{ 0, 0, C32_LEN, 0 }, /* 6: C(COND_JUMP, COND32) */
-{ 1, 1, 0, 0 }, /* 7: unused */
-{ 1, 1, 0, 0 }, /* 8: unused */
+{ 1, 1, 0, 0 }, /* 7: unused */
+{ 1, 1, 0, 0 }, /* 8: unused */
{ 2048, -2046, U12_LEN, C(UNCD_JUMP, UNCD32) }, /* 9: C(UNCD_JUMP, UNCD12) */
{ 0, 0, U32_LEN, 0 }, /*10: C(UNCD_JUMP, UNCD32) */
-{ 1, 1, 0, 0 }, /*11: unused */
-{ 0, 0, 0, 0 } /*12: unused */
+{ 1, 1, 0, 0 }, /*11: unused */
+{ 0, 0, 0, 0 } /*12: unused */
};
/* Literal pool data structures. */
@@ -216,7 +216,7 @@ const pseudo_typeS md_pseudo_table[] =
{ "section.s", mcore_s_section, 0 },
{ "sect", mcore_s_section, 0 },
{ "sect.s", mcore_s_section, 0 },
-
+
{ 0, 0, 0 }
};
@@ -228,7 +228,6 @@ mcore_s_literals (ignore)
demand_empty_rest_of_line ();
}
-
static void
mcore_cons (nbytes)
int nbytes;
@@ -237,21 +236,21 @@ mcore_cons (nbytes)
{
char * ptr = input_line_pointer;
int commas = 1;
-
+
/* Count the number of commas on the line. */
while (! is_end_of_line [(unsigned char) * ptr])
commas += * ptr ++ == ',';
-
+
poolspan += nbytes * commas;
}
-
+
cons (nbytes);
/* In theory we ought to call check_literals (2,0) here in case
we need to dump the literal table. We cannot do this however,
as the directives that we are intercepting may be being used
to build a switch table, and we must not interfere with its
- contents. Instead we cross our fingers and pray... */
+ contents. Instead we cross our fingers and pray... */
}
static void
@@ -266,7 +265,7 @@ mcore_float_cons (float_type)
#ifdef REPEAT_CONS_EXPRESSIONS
#error REPEAT_CONS_EXPRESSIONS not handled
#endif
-
+
/* Count the number of commas on the line. */
while (! is_end_of_line [(unsigned char) * ptr])
commas += * ptr ++ == ',';
@@ -278,7 +277,7 @@ mcore_float_cons (float_type)
}
float_cons (float_type);
-
+
/* See the comment in mcore_cons () about calling check_literals.
It is unlikely that a switch table will be constructed using
floating point values, but it is still likely that an indexed
@@ -293,7 +292,7 @@ mcore_stringer (append_zero)
if (now_seg == text_section)
{
char * ptr = input_line_pointer;
-
+
/* In theory we should compute how many bytes are going to
be occupied by the string(s) and add this to the poolspan.
To keep things simple however, we just add the number of
@@ -306,7 +305,7 @@ mcore_stringer (append_zero)
poolspan += ptr - input_line_pointer;
}
-
+
stringer (append_zero);
/* We call check_literals here in case a large number of strings are
@@ -328,11 +327,11 @@ mcore_fill (unused)
int repeat;
repeat = atoi (str);
-
+
/* Look to see if a size has been specified. */
while (*str != '\n' && *str != 0 && *str != ',')
++ str;
-
+
if (* str == ',')
{
size = atoi (str + 1);
@@ -345,7 +344,7 @@ mcore_fill (unused)
poolspan += size * repeat;
}
-
+
s_fill (unused);
check_literals (2, 0);
@@ -358,7 +357,7 @@ mcore_s_text (ignore)
int ignore;
{
dump_literals (0);
-
+
#ifdef OBJ_ELF
obj_elf_text (ignore);
#else
@@ -371,7 +370,7 @@ mcore_s_data (ignore)
int ignore;
{
dump_literals (0);
-
+
#ifdef OBJ_ELF
obj_elf_data (ignore);
#else
@@ -413,7 +412,7 @@ mcore_s_bss (needs_align)
int needs_align;
{
dump_literals (0);
-
+
s_lcomm_bytes (needs_align);
}
@@ -423,7 +422,7 @@ mcore_s_comm (needs_align)
int needs_align;
{
dump_literals (0);
-
+
obj_elf_common (needs_align);
}
#endif
@@ -470,7 +469,7 @@ log2 (val)
log ++;
val >>= 1;
}
-
+
return log;
}
@@ -483,7 +482,7 @@ parse_reg (s, reg)
/* Strip leading whitespace. */
while (isspace (* s))
++ s;
-
+
if (tolower (s[0]) == 'r')
{
if (s[1] == '1' && s[2] >= '0' && s[2] <= '5')
@@ -491,7 +490,7 @@ parse_reg (s, reg)
*reg = 10 + s[2] - '0';
return s + 3;
}
-
+
if (s[1] >= '0' && s[1] <= '9')
{
*reg = s[1] - '0';
@@ -505,7 +504,7 @@ parse_reg (s, reg)
* reg = 0;
return s + 2;
}
-
+
as_bad (_("register expected, but saw '%.6s'"), s);
return s;
}
@@ -543,7 +542,7 @@ parse_creg (s, reg)
/* Strip leading whitespace. */
while (isspace (* s))
++s;
-
+
if ((tolower (s[0]) == 'c' && tolower (s[1]) == 'r'))
{
if (s[2] == '3' && s[3] >= '0' && s[3] <= '1')
@@ -551,47 +550,47 @@ parse_creg (s, reg)
*reg = 30 + s[3] - '0';
return s + 4;
}
-
+
if (s[2] == '2' && s[3] >= '0' && s[3] <= '9')
{
*reg = 20 + s[3] - '0';
return s + 4;
}
-
+
if (s[2] == '1' && s[3] >= '0' && s[3] <= '9')
{
*reg = 10 + s[3] - '0';
return s + 4;
}
-
+
if (s[2] >= '0' && s[2] <= '9')
{
*reg = s[2] - '0';
return s + 3;
}
}
-
+
/* Look at alternate creg names before giving error. */
for (i = 0; cregs[i].name[0] != '\0'; i++)
{
char buf [10];
int length;
int j;
-
+
length = strlen (cregs[i].name);
-
+
for (j = 0; j < length; j++)
buf[j] = tolower (s[j]);
-
+
if (strncmp (cregs[i].name, buf, length) == 0)
{
*reg = cregs[i].crnum;
return s + length;
}
}
-
+
as_bad (_("control register expected, but saw '%.6s'"), s);
-
+
return s;
}
@@ -614,24 +613,24 @@ parse_psrmod (s, reg)
{ "ee", 4 },
{ "af", 8 } /* Really 0 and non-combinable. */
};
-
+
for (i = 0; i < 2; i++)
buf[i] = isascii (s[i]) ? tolower (s[i]) : 0;
-
+
for (i = sizeof (psrmods) / sizeof (psrmods[0]); i--;)
{
if (! strncmp (psrmods[i].name, buf, 2))
{
* reg = psrmods[i].value;
-
+
return s + 2;
}
}
-
+
as_bad (_("bad/missing psr specifier"));
-
+
* reg = 0;
-
+
return s;
}
@@ -646,18 +645,18 @@ parse_exp (s, e)
/* Skip whitespace. */
while (isspace (* s))
++ s;
-
+
save = input_line_pointer;
input_line_pointer = s;
expression (e);
-
+
if (e->X_op == O_absent)
as_bad (_("missing operand"));
-
+
new = input_line_pointer;
input_line_pointer = save;
-
+
return new;
}
@@ -689,7 +688,7 @@ dump_literals (isforce)
int i;
struct literal * p;
symbolS * brarsym;
-
+
if (poolsize == 0)
return;
@@ -698,13 +697,13 @@ dump_literals (isforce)
{
char * output;
char brarname[8];
-
+
make_name (brarname, POOL_END_LABEL, poolnumber);
-
+
brarsym = symbol_make (brarname);
-
+
symbol_table_insert (brarsym);
-
+
output = frag_var (rs_machine_dependent,
md_relax_table[C (UNCD_JUMP, UNCD32)].rlx_length,
md_relax_table[C (UNCD_JUMP, UNCD12)].rlx_length,
@@ -712,20 +711,20 @@ dump_literals (isforce)
output[0] = INST_BYTE0 (MCORE_INST_BR); /* br .+xxx */
output[1] = INST_BYTE1 (MCORE_INST_BR);
}
-
+
/* Make sure that the section is sufficiently aligned and that
the literal table is aligned within it. */
record_alignment (now_seg, 2);
frag_align (2, 0, 0);
-
+
colon (S_GET_NAME (poolsym));
-
+
for (i = 0, p = litpool; i < poolsize; i++, p++)
emit_expr (& p->e, 4);
-
+
if (isforce)
colon (S_GET_NAME (brarsym));
-
+
poolsize = 0;
}
@@ -735,19 +734,19 @@ check_literals (kind, offset)
int offset;
{
poolspan += offset;
-
+
/* SPANCLOSE and SPANEXIT are smaller numbers than SPANPANIC.
SPANPANIC means that we must dump now.
kind == 0 is any old instruction.
kind > 0 means we just had a control transfer instruction.
kind == 1 means within a function
kind == 2 means we just left a function
-
+
The dump_literals (1) call inserts a branch around the table, so
we first look to see if its a situation where we won't have to
insert a branch (e.g., the previous instruction was an unconditional
branch).
-
+
SPANPANIC is the point where we must dump a single-entry pool.
it accounts for alignments and an inserted branch.
the 'poolsize*2' accounts for the scenario where we do:
@@ -757,7 +756,7 @@ check_literals (kind, offset)
so we must consider the poolsize into this equation.
This is slightly over-cautious, but guarantees that we won't
panic because a relocation is too distant. */
-
+
if (poolspan > SPANCLOSE && kind > 0)
dump_literals (0);
else if (poolspan > SPANEXIT && kind > 1)
@@ -781,7 +780,7 @@ enter_literal (e, ispcrel)
have to allow for the branch (2 bytes) and the alignment
(2 bytes before the first insn referencing the pool and
2 bytes before the pool itself) == 6 bytes, rounds up
- to 2 entries. */
+ to 2 entries. */
dump_literals (1);
}
@@ -790,13 +789,13 @@ enter_literal (e, ispcrel)
/* Create new literal pool. */
if (++ poolnumber > 0xFFFF)
as_fatal (_("more than 65K literal pools"));
-
+
make_name (poolname, POOL_START_LABEL, poolnumber);
poolsym = symbol_make (poolname);
symbol_table_insert (poolsym);
poolspan = 0;
}
-
+
/* Search pool for value so we don't have duplicates. */
for (p = litpool, i = 0; i < poolsize; i++, p++)
{
@@ -813,10 +812,10 @@ enter_literal (e, ispcrel)
p->refcnt = 1;
p->ispcrel = ispcrel;
p->e = * e;
-
+
poolsize ++;
- return i;
+ return i;
}
/* Parse a literal specification. -- either new or old syntax.
@@ -831,15 +830,15 @@ parse_rt (s, outputp, ispcrel, ep)
{
expressionS e;
int n;
-
+
if (ep)
/* Indicate nothing there. */
ep->X_op = O_absent;
-
+
if (*s == '[')
{
s = parse_exp (s + 1, & e);
-
+
if (*s == ']')
s++;
else
@@ -848,9 +847,9 @@ parse_rt (s, outputp, ispcrel, ep)
else
{
s = parse_exp (s, & e);
-
+
n = enter_literal (& e, ispcrel);
-
+
if (ep)
*ep = e;
@@ -859,7 +858,7 @@ parse_rt (s, outputp, ispcrel, ep)
e.X_add_symbol = poolsym;
e.X_add_number = n << 2;
}
-
+
* outputp = frag_more (2);
fix_new_exp (frag_now, (*outputp) - frag_now->fr_literal, 2, & e, 1,
@@ -877,9 +876,9 @@ parse_imm (s, val, min, max)
{
char * new;
expressionS e;
-
+
new = parse_exp (s, & e);
-
+
if (e.X_op == O_absent)
; /* An error message has already been emitted. */
else if (e.X_op != O_constant)
@@ -889,7 +888,7 @@ parse_imm (s, val, min, max)
min, max, e.X_add_number);
* val = e.X_add_number;
-
+
return new;
}
@@ -903,49 +902,49 @@ parse_mem (s, reg, off, siz)
char * new;
* off = 0;
-
+
while (isspace (* s))
++ s;
-
+
if (* s == '(')
{
s = parse_reg (s + 1, reg);
while (isspace (* s))
++ s;
-
+
if (* s == ',')
{
s = parse_imm (s + 1, off, 0, 63);
-
+
if (siz > 1)
{
if (siz > 2)
{
if (* off & 0x3)
as_bad (_("operand must be a multiple of 4"));
-
+
* off >>= 2;
}
else
{
if (* off & 0x1)
as_bad (_("operand must be a multiple of 2"));
-
+
* off >>= 1;
}
}
}
-
+
while (isspace (* s))
++ s;
-
+
if (* s == ')')
s ++;
}
else
as_bad (_("base register expected"));
-
+
return s;
}
@@ -981,9 +980,9 @@ md_assemble (str)
name[nlen] = op_start[nlen];
nlen++;
}
-
+
name [nlen] = 0;
-
+
if (nlen == 0)
{
as_bad (_("can't find opcode "));
@@ -996,34 +995,34 @@ md_assemble (str)
as_bad (_("unknown opcode \"%s\""), name);
return;
}
-
+
inst = opcode->inst;
isize = 2;
-
+
switch (opcode->opclass)
{
case O0:
output = frag_more (2);
break;
-
+
case OT:
op_end = parse_imm (op_end + 1, & reg, 0, 3);
inst |= reg;
output = frag_more (2);
break;
-
+
case O1:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
output = frag_more (2);
break;
-
+
case JMP:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
output = frag_more (2);
/* In a sifilter mode, we emit this insn 2 times,
- fixes problem of an interrupt during a jmp.. */
+ fixes problem of an interrupt during a jmp.. */
if (sifilter_mode)
{
output[0] = INST_BYTE0 (inst);
@@ -1031,16 +1030,16 @@ md_assemble (str)
output = frag_more (2);
}
break;
-
+
case JSR:
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg == 15)
as_bad (_("invalid register: r15 illegal"));
-
+
inst |= reg;
output = frag_more (2);
-
+
if (sifilter_mode)
{
/* Replace with: bsr .+2 ; addi r15,6; jmp rx ; jmp rx */
@@ -1063,21 +1062,21 @@ md_assemble (str)
output = frag_more (2); /* 2nd emitted in fallthru */
}
break;
-
+
case OC:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (*op_end == ',')
{
op_end = parse_creg (op_end + 1, & reg);
inst |= reg << 4;
}
-
+
output = frag_more (2);
break;
@@ -1087,15 +1086,15 @@ md_assemble (str)
as_bad (_("M340 specific opcode used when assembling for M210"));
break;
}
- /* drop through... */
+ /* drop through... */
case O2:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_reg (op_end + 1, & reg);
@@ -1103,37 +1102,37 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case X1: /* Handle both syntax-> xtrb- r1,rx OR xtrb- rx */
op_end = parse_reg (op_end + 1, & reg);
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',') /* xtrb- r1,rx */
{
if (reg != 1)
as_bad (_("destination register must be r1"));
-
+
op_end = parse_reg (op_end + 1, & reg);
}
-
+
inst |= reg;
output = frag_more (2);
break;
-
+
case O1R1: /* div- rx,r1 */
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_reg (op_end + 1, & reg);
@@ -1142,18 +1141,18 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case OI:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 32);
@@ -1161,18 +1160,18 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case OB:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 0, 31);
@@ -1180,22 +1179,22 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case OB2: /* like OB, but arg is 2^n instead of n */
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 1 << 31);
- /* Further restrict the immediate to a power of two. */
+ /* Further restrict the immediate to a power of two. */
if ((reg & (reg - 1)) == 0)
reg = log2 (reg);
else
@@ -1207,20 +1206,20 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
- case OBRa: /* Specific for bgeni: imm of 0->6 translate to movi. */
+
+ case OBRa: /* Specific for bgeni: imm of 0->6 translate to movi. */
case OBRb:
case OBRc:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 0, 31);
@@ -1236,22 +1235,22 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case OBR2: /* like OBR, but arg is 2^n instead of n */
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 1 << 31);
-
+
/* Further restrict the immediate to a power of two. */
if ((reg & (reg - 1)) == 0)
reg = log2 (reg);
@@ -1260,44 +1259,44 @@ md_assemble (str)
reg = 0;
as_bad (_("immediate is not a power of two"));
}
-
- /* Immediate values of 0 -> 6 translate to movi. */
+
+ /* Immediate values of 0 -> 6 translate to movi. */
if (reg <= 6)
{
inst = (inst & 0xF) | MCORE_INST_BGENI_ALT;
reg = 0x1 << reg;
as_warn (_("translating mgeni to movi"));
}
-
+
inst |= reg << 4;
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case OMa: /* Specific for bmaski: imm 1->7 translate to movi. */
case OMb:
case OMc:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 32);
-
- /* Immediate values of 1 -> 7 translate to movi. */
+
+ /* Immediate values of 1 -> 7 translate to movi. */
if (reg <= 7)
{
inst = (inst & 0xF) | MCORE_INST_BMASKI_ALT;
reg = (0x1 << reg) - 1;
inst |= reg << 4;
-
+
as_warn (_("translating bmaski to movi"));
}
else
@@ -1308,18 +1307,18 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case SI:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 31);
@@ -1327,18 +1326,18 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
case I7:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 0, 0x7F);
@@ -1346,31 +1345,31 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case LS:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg << 8;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
int size;
-
+
if ((inst & 0x6000) == 0)
size = 4;
else if ((inst & 0x6000) == 0x4000)
size = 2;
else if ((inst & 0x6000) == 0x2000)
size = 1;
-
+
op_end = parse_mem (op_end + 1, & reg, & off, size);
-
+
if (off > 16)
as_bad (_("displacement too large (%d)"), off);
else
@@ -1378,22 +1377,22 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case LR:
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg == 0 || reg == 15)
as_bad (_("Invalid register: r0 and r15 illegal"));
-
+
inst |= (reg << 8);
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
/* parse_rt calls frag_more() for us. */
@@ -1406,52 +1405,52 @@ md_assemble (str)
output = frag_more (2); /* save its space */
}
break;
-
+
case LJ:
input_line_pointer = parse_rt (op_end + 1, & output, 1, 0);
/* parse_rt() calls frag_more() for us. */
op_end = input_line_pointer;
break;
-
+
case RM:
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg == 0 || reg == 15)
as_bad (_("bad starting register: r0 and r15 invalid"));
-
+
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == '-')
{
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg != 15)
as_bad (_("ending register must be r15"));
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
}
-
+
if (* op_end == ',')
{
op_end ++;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == '(')
{
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg != 0)
as_bad (_("bad base register: must be r0"));
-
+
if (* op_end == ')')
op_end ++;
}
@@ -1460,52 +1459,52 @@ md_assemble (str)
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case RQ:
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg != 4)
as_fatal (_("first register must be r4"));
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == '-')
{
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg != 7)
as_fatal (_("last register must be r7"));
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end ++;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == '(')
{
op_end = parse_reg (op_end + 1, & reg);
-
+
if (reg >= 4 && reg <= 7)
as_fatal ("base register cannot be r4, r5, r6, or r7");
-
+
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ')')
op_end ++;
}
@@ -1517,34 +1516,34 @@ md_assemble (str)
}
else
as_bad (_("reg-reg expected"));
-
+
output = frag_more (2);
break;
-
+
case BR:
input_line_pointer = parse_exp (op_end + 1, & e);
op_end = input_line_pointer;
-
+
output = frag_more (2);
-
- fix_new_exp (frag_now, output-frag_now->fr_literal,
+
+ fix_new_exp (frag_now, output-frag_now->fr_literal,
2, & e, 1, BFD_RELOC_MCORE_PCREL_IMM11BY2);
break;
-
+
case BL:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg << 4;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_exp (op_end + 1, & e);
output = frag_more (2);
-
- fix_new_exp (frag_now, output-frag_now->fr_literal,
+
+ fix_new_exp (frag_now, output-frag_now->fr_literal,
2, & e, 1, BFD_RELOC_MCORE_PCREL_IMM4BY2);
}
else
@@ -1553,18 +1552,18 @@ md_assemble (str)
output = frag_more (2);
}
break;
-
+
case JC:
input_line_pointer = parse_exp (op_end + 1, & e);
op_end = input_line_pointer;
-
+
output = frag_var (rs_machine_dependent,
md_relax_table[C (COND_JUMP, COND32)].rlx_length,
md_relax_table[C (COND_JUMP, COND12)].rlx_length,
C (COND_JUMP, 0), e.X_add_symbol, e.X_add_number, 0);
isize = C32_LEN;
break;
-
+
case JU:
input_line_pointer = parse_exp (op_end + 1, & e);
op_end = input_line_pointer;
@@ -1575,18 +1574,18 @@ md_assemble (str)
C (UNCD_JUMP, 0), e.X_add_symbol, e.X_add_number, 0);
isize = U32_LEN;
break;
-
+
case JL:
inst = MCORE_INST_JSRI; /* jsri */
input_line_pointer = parse_rt (op_end + 1, & output, 1, & e);
/* parse_rt() calls frag_more for us. */
op_end = input_line_pointer;
-
- /* Only do this if we know how to do it ... */
+
+ /* Only do this if we know how to do it ... */
if (e.X_op != O_absent && do_jsri2bsr)
{
/* Look at adding the R_PCREL_JSRIMM11BY2. */
- fix_new_exp (frag_now, output-frag_now->fr_literal,
+ fix_new_exp (frag_now, output-frag_now->fr_literal,
2, & e, 1, BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2);
}
break;
@@ -1594,66 +1593,66 @@ md_assemble (str)
case RSI: /* SI, but imm becomes 32-imm */
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 31);
-
+
reg = 32 - reg;
inst |= reg << 4;
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case DO21: /* O2, dup rd, lit must be 1 */
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
inst |= reg << 4;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 31);
-
+
if (reg != 1)
as_bad (_("second operand must be 1"));
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
-
+
case SIa:
op_end = parse_reg (op_end + 1, & reg);
inst |= reg;
-
+
/* Skip whitespace. */
while (isspace (* op_end))
++ op_end;
-
+
if (* op_end == ',')
{
op_end = parse_imm (op_end + 1, & reg, 1, 31);
if (reg == 0)
as_bad (_("zero used as immediate value"));
-
+
inst |= reg << 4;
}
else
as_bad (_("second operand missing"));
-
+
output = frag_more (2);
break;
@@ -1663,29 +1662,29 @@ md_assemble (str)
as_bad (_("M340 specific opcode used when assembling for M210"));
break;
}
-
+
op_end = parse_psrmod (op_end + 1, & reg);
-
+
/* Look for further selectors. */
while (* op_end == ',')
{
unsigned value;
-
+
op_end = parse_psrmod (op_end + 1, & value);
-
+
if (value & reg)
as_bad (_("duplicated psr bit specifier"));
-
+
reg |= value;
}
-
+
if (reg > 8)
as_bad (_("`af' must appear alone"));
-
+
inst |= (reg & 0x7);
output = frag_more (2);
break;
-
+
default:
as_bad (_("unimplemented opcode \"%s\""), name);
}
@@ -1694,13 +1693,13 @@ md_assemble (str)
while (isspace (* op_end))
op_end ++;
- /* Give warning message if the insn has more operands than required. */
+ /* Give warning message if the insn has more operands than required. */
if (strcmp (op_end, opcode->name) && strcmp (op_end, ""))
as_warn (_("ignoring operands: %s "), op_end);
-
+
output[0] = INST_BYTE0 (inst);
output[1] = INST_BYTE1 (inst);
-
+
check_literals (opcode->transfer, isize);
}
@@ -1767,14 +1766,14 @@ md_atof (type, litP, sizeP)
*sizeP = 0;
return _("Bad call to MD_NTOF()");
}
-
+
t = atof_ieee (input_line_pointer, type, words);
-
+
if (t)
input_line_pointer = t;
*sizeP = prec * sizeof (LITTLENUM_TYPE);
-
+
if (! target_big_endian)
{
for (i = prec - 1; i >= 0; i--)
@@ -1791,7 +1790,7 @@ md_atof (type, litP, sizeP)
sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
-
+
return 0;
}
@@ -1840,7 +1839,7 @@ md_parse_option (c, arg)
else
as_warn (_("unrecognised cpu type '%s'"), arg);
break;
-
+
case OPTION_EB: target_big_endian = 1; break;
case OPTION_EL: target_big_endian = 0; cpu = M340; break;
case OPTION_JSRI2BSR_ON: do_jsri2bsr = 1; break;
@@ -1899,7 +1898,7 @@ md_convert_frag (abfd, sec, fragP)
{
unsigned char * buffer;
int targ_addr = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset;
-
+
buffer = (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
targ_addr += symbol_get_frag (fragP->fr_symbol)->fr_address;
@@ -1912,29 +1911,29 @@ md_convert_frag (abfd, sec, fragP)
int next_inst = fragP->fr_fix + fragP->fr_address + 2;
unsigned char t0;
int disp = targ_addr - next_inst;
-
+
if (disp & 1)
as_bad (_("odd displacement at %x"), next_inst - 2);
-
+
disp >>= 1;
-
+
if (! target_big_endian)
{
t0 = buffer[1] & 0xF8;
-
+
md_number_to_chars (buffer, disp, 2);
-
+
buffer[1] = (buffer[1] & 0x07) | t0;
}
else
{
t0 = buffer[0] & 0xF8;
-
+
md_number_to_chars (buffer, disp, 2);
-
+
buffer[0] = (buffer[0] & 0x07) | t0;
}
-
+
fragP->fr_fix += 2;
fragP->fr_var = 0;
}
@@ -1963,7 +1962,7 @@ md_convert_frag (abfd, sec, fragP)
buffer[2] = INST_BYTE0 (MCORE_INST_JMPI); /* Build jmpi */
buffer[3] = INST_BYTE1 (MCORE_INST_JMPI);
-
+
if (needpad)
{
if (! target_big_endian)
@@ -1976,18 +1975,18 @@ md_convert_frag (abfd, sec, fragP)
buffer[1] = 4; /* branch over jmpi, pad, and ptr */
buffer[3] = 1; /* jmpi offset of 1 gets the pointer */
}
-
+
buffer[4] = 0; /* alignment/pad */
buffer[5] = 0;
buffer[6] = 0; /* space for 32 bit address */
buffer[7] = 0;
buffer[8] = 0;
buffer[9] = 0;
-
+
/* Make reloc for the long disp */
fix_new (fragP, fragP->fr_fix + 6, 4,
fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
-
+
fragP->fr_fix += C32_LEN;
}
else
@@ -1995,7 +1994,7 @@ md_convert_frag (abfd, sec, fragP)
/* See comment below about this given gas' limitations for
shrinking the fragment. '3' is the amount of code that
we inserted here, but '4' is right for the space we reserved
- for this fragment. */
+ for this fragment. */
if (! target_big_endian)
{
buffer[0] = 3; /* branch over jmpi, and ptr */
@@ -2006,12 +2005,12 @@ md_convert_frag (abfd, sec, fragP)
buffer[1] = 3; /* branch over jmpi, and ptr */
buffer[3] = 0; /* jmpi offset of 0 gets the pointer */
}
-
+
buffer[4] = 0; /* space for 32 bit address */
buffer[5] = 0;
buffer[6] = 0;
buffer[7] = 0;
-
+
/* Make reloc for the long disp. */
fix_new (fragP, fragP->fr_fix + 4, 4,
fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
@@ -2019,7 +2018,7 @@ md_convert_frag (abfd, sec, fragP)
/* Frag is actually shorter (see the other side of this ifdef)
but gas isn't prepared for that. We have to re-adjust
- the branch displacement so that it goes beyond the
+ the branch displacement so that it goes beyond the
full length of the fragment, not just what we actually
filled in. */
if (! target_big_endian)
@@ -2027,7 +2026,7 @@ md_convert_frag (abfd, sec, fragP)
else
buffer[1] = 4; /* jmpi, ptr, and the 'tail pad' */
}
-
+
fragP->fr_var = 0;
}
break;
@@ -2060,11 +2059,11 @@ md_convert_frag (abfd, sec, fragP)
buffer[5] = 0;
buffer[6] = 0;
buffer[7] = 0;
-
+
/* Make reloc for the long disp. */
fix_new (fragP, fragP->fr_fix + 4, 4,
fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
-
+
fragP->fr_fix += U32_LEN;
}
else
@@ -2077,7 +2076,7 @@ md_convert_frag (abfd, sec, fragP)
buffer[3] = 0;
buffer[4] = 0;
buffer[5] = 0;
-
+
/* Make reloc for the long disp. */
fix_new (fragP, fragP->fr_fix + 2, 4,
fragP->fr_symbol, fragP->fr_offset, 0, BFD_RELOC_32);
@@ -2105,8 +2104,8 @@ md_apply_fix3 (fixP, valp, segment)
char * file = fixP->fx_file ? fixP->fx_file : _("unknown");
const char * symname;
/* Note: use offsetT because it is signed, valueT is unsigned. */
- offsetT val = (offsetT) * valp;
-
+ offsetT val = (offsetT) * valp;
+
symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
/* Save this for the addend in the relocation record. */
fixP->fx_addnumber = val;
@@ -2127,7 +2126,7 @@ md_apply_fix3 (fixP, valp, segment)
}
else
fixP->fx_done = 1;
-
+
switch (fixP->fx_r_type)
{
case BFD_RELOC_MCORE_PCREL_IMM11BY2: /* second byte of 2 byte opcode */
@@ -2177,13 +2176,13 @@ md_apply_fix3 (fixP, valp, segment)
case BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2:
/* Conditional linker map jsri to bsr. */
- /* If its a local target and close enough, fix it.
+ /* If its a local target and close enough, fix it.
NB: >= -2k for backwards bsr; < 2k for forwards... */
if (fixP->fx_addsy == 0 && val >= -2048 && val < 2048)
{
long nval = (val / 2) & 0x7ff;
nval |= MCORE_INST_BSR;
-
+
/* REPLACE the instruction, don't just modify it. */
buf[0] = INST_BYTE0 (nval);
buf[1] = INST_BYTE1 (nval);
@@ -2197,7 +2196,7 @@ md_apply_fix3 (fixP, valp, segment)
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
break;
-
+
default:
if (fixP->fx_addsy != NULL)
{
@@ -2205,7 +2204,7 @@ md_apply_fix3 (fixP, valp, segment)
address, then it cannot be resolved until the final link. */
fixP->fx_done = 0;
}
-#ifdef OBJ_ELF
+#ifdef OBJ_ELF
else
#endif
{
@@ -2270,9 +2269,9 @@ md_estimate_size_before_relax (fragP, segment_type)
default:
abort ();
-
+
case C (COND_JUMP, UNDEF_DISP):
- /* Used to be a branch to somewhere which was unknown. */
+ /* Used to be a branch to somewhere which was unknown. */
if (fragP->fr_symbol
&& S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
{
@@ -2297,7 +2296,7 @@ md_estimate_size_before_relax (fragP, segment_type)
break;
}
-
+
return fragP->fr_var;
}
@@ -2337,7 +2336,6 @@ md_section_align (segment, size)
return size; /* Byte alignment is fine */
}
-
/* The location from which a PC relative jump should be calculated,
given a PC relative reloc. */
long
@@ -2348,18 +2346,18 @@ md_pcrel_from_section (fixp, sec)
#ifdef OBJ_ELF
/* If the symbol is undefined or defined in another section
we leave the add number alone for the linker to fix it later.
- Only account for the PC pre-bump (which is 2 bytes on the MCore). */
+ Only account for the PC pre-bump (which is 2 bytes on the MCore). */
if (fixp->fx_addsy != (symbolS *) NULL
&& (! S_IS_DEFINED (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != sec)))
-
+
{
assert (fixp->fx_size == 2); /* must be an insn */
return fixp->fx_size;
}
#endif
- /* The case where we are going to resolve things... */
+ /* The case where we are going to resolve things... */
return fixp->fx_size + fixp->fx_where + fixp->fx_frag->fr_address;
}
@@ -2377,17 +2375,17 @@ tc_gen_reloc (section, fixp)
switch (fixp->fx_r_type)
{
- /* These confuse the size/pcrel macro approach. */
+ /* These confuse the size/pcrel macro approach. */
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_MCORE_PCREL_IMM4BY2:
case BFD_RELOC_MCORE_PCREL_IMM8BY4:
case BFD_RELOC_MCORE_PCREL_IMM11BY2:
case BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2:
- case BFD_RELOC_RVA:
+ case BFD_RELOC_RVA:
code = fixp->fx_r_type;
break;
-
+
default:
switch (F (fixp->fx_size, fixp->fx_pcrel))
{
@@ -2414,13 +2412,13 @@ tc_gen_reloc (section, fixp)
rel->addend = fixp->fx_addnumber;
rel->howto = bfd_reloc_type_lookup (stdoutput, code);
-
+
if (rel->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("Cannot represent relocation type %s"),
bfd_get_reloc_code_name (code));
-
+
/* Set howto to a garbage value so that we can keep going. */
rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
assert (rel->howto != NULL);
@@ -2453,7 +2451,7 @@ mcore_fix_adjustable (fixP)
{
if (fixP->fx_addsy == NULL)
return 1;
-
+
/* We need the symbol name for the VTABLE entries. */
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h
index b0a29ab..70d4579 100644
--- a/gas/config/tc-mcore.h
+++ b/gas/config/tc-mcore.h
@@ -49,20 +49,18 @@
/* We want local label support. */
#define LOCAL_LABELS_FB 1
-
+
#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep (frag)
-
+
extern const struct relax_type md_relax_table[];
#define TC_GENERIC_RELAX_TABLE md_relax_table
#define md_end md_mcore_end
-/* Want the section information too... */
+/* Want the section information too... */
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
#define MD_APPLY_FIX3 /* We want the segment as well. */
-
-
#ifdef OBJ_COFF
#define TARGET_FORMAT (target_big_endian ? "pe-mcore-big" : "pe-mcore-little")
@@ -80,7 +78,6 @@ struct mcore_tc_sy
#endif /* OBJ_COFF */
-
#ifdef OBJ_ELF
#define TARGET_FORMAT (target_big_endian ? "elf32-mcore-big" : "elf32-mcore-little")
@@ -105,7 +102,7 @@ extern boolean mcore_fix_adjustable PARAMS ((struct fix *));
#endif
#include "write.h" /* For definition of fixS */
-
+
extern void md_begin PARAMS ((void));
extern void md_assemble PARAMS ((char *));
extern symbolS * md_undefined_symbol PARAMS ((char *));
@@ -113,7 +110,7 @@ extern void md_mcore_end PARAMS ((void));
extern char * md_atof PARAMS ((int, char *, int *));
extern int md_parse_option PARAMS ((int, char *));
extern void md_show_usage PARAMS ((FILE *));
-extern void md_create_short_jump
+extern void md_create_short_jump
PARAMS ((char *, addressT, addressT, fragS *, symbolS *));
extern void md_create_long_jump
PARAMS ((char *, addressT, addressT, fragS *, symbolS *));