* Tidy some spu code
@ 2007-09-04 4:08 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2007-09-04 4:08 UTC (permalink / raw)
To: binutils
bfd/
* elf32-spu.c (elf_howto_table): Formatting.
gas/
* config/tc-spu.c (struct spu_insn): Delete "flag". Add "reloc".
(md_assemble): Update init of insn. Use insn.reloc instead of
calculating from flag.
(get_imm): Set reloc rather than flag.
(calcop): Formatting.
Index: bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.20
diff -u -p -r1.20 elf32-spu.c
--- bfd/elf32-spu.c 3 Jul 2007 14:26:41 -0000 1.20
+++ bfd/elf32-spu.c 4 Sep 2007 02:01:43 -0000
@@ -54,7 +54,7 @@ static reloc_howto_type elf_howto_table[
HOWTO (R_SPU_ADDR18, 0, 2, 18, FALSE, 7, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_ADDR18",
FALSE, 0, 0x01ffff80, FALSE),
- HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_ADDR32",
FALSE, 0, 0xffffffff, FALSE),
HOWTO (R_SPU_REL16, 2, 2, 16, TRUE, 7, complain_overflow_bitfield,
@@ -75,16 +75,16 @@ static reloc_howto_type elf_howto_table[
HOWTO (R_SPU_ADDR16I, 0, 2, 16, FALSE, 7, complain_overflow_signed,
bfd_elf_generic_reloc, "SPU_ADDR16I",
FALSE, 0, 0x007fff80, FALSE),
- HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_REL32",
FALSE, 0, 0xffffffff, TRUE),
HOWTO (R_SPU_ADDR16X, 0, 2, 16, FALSE, 7, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_ADDR16X",
FALSE, 0, 0x007fff80, FALSE),
- HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_PPU32",
FALSE, 0, 0xffffffff, FALSE),
- HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_PPU64",
FALSE, 0, -1, FALSE),
};
Index: gas/config/tc-spu.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-spu.c,v
retrieving revision 1.7
diff -u -p -r1.7 tc-spu.c
--- gas/config/tc-spu.c 3 Jul 2007 11:01:05 -0000 1.7
+++ gas/config/tc-spu.c 4 Sep 2007 02:01:44 -0000
@@ -44,7 +44,7 @@ struct spu_insn
unsigned int opcode;
expressionS exp[MAX_RELOCS];
int reloc_arg[MAX_RELOCS];
- int flag[MAX_RELOCS];
+ bfd_reloc_code_real_type reloc[MAX_RELOCS];
enum spu_insns tag;
};
@@ -303,7 +303,7 @@ md_assemble (char *op)
insn.exp[i].X_add_number = 0;
insn.exp[i].X_op = O_illegal;
insn.reloc_arg[i] = -1;
- insn.flag[i] = 0;
+ insn.reloc[i] = BFD_RELOC_NONE;
}
insn.opcode = format->opcode;
insn.tag = (enum spu_insns) (format - spu_opcodes);
@@ -352,17 +352,13 @@ md_assemble (char *op)
if (insn.reloc_arg[i] >= 0)
{
fixS *fixP;
- bfd_reloc_code_real_type reloc = arg_encode[insn.reloc_arg[i]].reloc;
+ bfd_reloc_code_real_type reloc = insn.reloc[i];
int pcrel = 0;
- if (reloc == BFD_RELOC_SPU_PCREL9a
+ if (reloc == BFD_RELOC_SPU_PCREL9a
|| reloc == BFD_RELOC_SPU_PCREL9b
- || reloc == BFD_RELOC_SPU_PCREL16)
+ || reloc == BFD_RELOC_SPU_PCREL16)
pcrel = 1;
- if (insn.flag[i] == 1)
- reloc = BFD_RELOC_SPU_HI16;
- else if (insn.flag[i] == 2)
- reloc = BFD_RELOC_SPU_LO16;
fixP = fix_new_exp (frag_now,
thisfrag - frag_now->fr_literal,
4,
@@ -394,7 +390,7 @@ calcop (struct spu_opcode *format, const
if (arg < A_P)
param = get_reg (param, insn, arg, 1);
else if (arg > A_P)
- param = get_imm (param, insn, arg);
+ param = get_imm (param, insn, arg);
else if (arg == A_P)
{
paren++;
@@ -688,16 +684,16 @@ get_imm (const char *param, struct spu_i
insn->opcode |= (((val >> arg_encode[arg].rshift)
& ((1 << arg_encode[arg].size) - 1))
<< arg_encode[arg].pos);
- insn->reloc_arg[reloc_i] = -1;
- insn->flag[reloc_i] = 0;
}
else
{
insn->reloc_arg[reloc_i] = arg;
if (high)
- insn->flag[reloc_i] = 1;
+ insn->reloc[reloc_i] = BFD_RELOC_SPU_HI16;
else if (low)
- insn->flag[reloc_i] = 2;
+ insn->reloc[reloc_i] = BFD_RELOC_SPU_LO16;
+ else
+ insn->reloc[reloc_i] = arg_encode[arg].reloc;
}
return param;
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-04 4:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-04 4:08 Tidy some spu code Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).