Patch H8/300 : Linker relaxation for ldc and stc instructions
Anil Paranjape
AnilP1@KPITCummins.com
Fri Jan 23 10:46:00 GMT 2004
Hi,
I have added linker relaxation support for following instructions ,
ldc @0xffffff00:32,ccr
stc ccr,@0xffffff00:32
ldc @0xffffff00:32,exr
stc exr,@0xffffff00:32
Above instructions will get relaxed to
ldc @0xff00:16,ccr
stc ccr,@0xff00:16
ldc @0xff00:16,exr
stc exr,@0xff00:16
ChangeLog :
2004-01-21 Anil Paranjpe <anilp1@KPITCummins.com>
* h8300.h : Pass MEMRELAX flag for O_LDC and O_STC.
Please find following patch for same,
--- h8300.h.old Fri Jan 23 16:47:19 2004
+++ h8300.h Fri Jan 23 18:09:28 2004
@@ -1434,8 +1434,8 @@ struct h8_opcode h8_opcodes[] =
{O (O_LDC, SW), AV_H8S, 2, "ldc", {{DISP32SRC, EXR | DST, E}}, {{PREFIXLDC, 0x7, 0x8, B30 | DISPREG, 0x0, 0x6, 0xB, 0x2, IGNORE, SRC | DISP32LIST, E}}},
{O (O_LDC, SW), AV_H8H, 2, "ldc", {{ABS16SRC, CCR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x0, IGNORE, SRC | ABS16LIST, E}}},
{O (O_LDC, SW), AV_H8S, 2, "ldc", {{ABS16SRC, EXR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x0, IGNORE, SRC | ABS16LIST, E}}},
- {O (O_LDC, SW), AV_H8H, 2, "ldc", {{ABS32SRC, CCR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | ABS32LIST, E}}},
- {O (O_LDC, SW), AV_H8S, 2, "ldc", {{ABS32SRC, EXR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | ABS32LIST, E}}},
+ {O (O_LDC, SW), AV_H8H, 2, "ldc", {{ABS32SRC, CCR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | MEMRELAX | ABS32LIST, E}}},
+ {O (O_LDC, SW), AV_H8S, 2, "ldc", {{ABS32SRC, EXR | DST, E}}, {{PREFIXLDC, 0x6, 0xB, 0x2, IGNORE, SRC | MEMRELAX | ABS32LIST, E}}},
{O (O_LDC, SL), AV_H8SX, 0, "ldc", {{RS32, B30 | VBR_SBR | DST, E}}, {{0x0, 0x3, B30 | VBR_SBR | DST, RS32, E}}},
@@ -1809,23 +1809,23 @@ struct h8_opcode h8_opcodes[] =
{O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, DISP32DST, E}}, {{PREFIXSTC, 0x7, 0x8, B30 | DSTDISPREG, 0, 0x6, 0xB, 0xA, IGNORE, DSTDISP32LIST, E}}},
{O (O_STC, SW), AV_H8H, 2, "stc", {{CCR | SRC, ABS16DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0x8, IGNORE, DST | ABS16LIST, E}}},
{O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, ABS16DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0x8, IGNORE, DST | ABS16LIST, E}}},
- {O (O_STC, SW), AV_H8H, 2, "stc", {{CCR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | ABS32LIST, E}}},
- {O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | ABS32LIST, E}}},
+ {O (O_STC, SW), AV_H8H, 2, "stc", {{CCR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | MEMRELAX | ABS32LIST, E}}},
+ {O (O_STC, SW), AV_H8S, 2, "stc", {{EXR | SRC, ABS32DST, E}}, {{PREFIXSTC, 0x6, 0xB, 0xA, IGNORE, DST | MEMRELAX | ABS32LIST, E}}},
{O (O_STC, SL), AV_H8SX, 0, "stc", {{B30 | VBR_SBR | SRC, RD32, E}}, {{0x0, 0x2, B30 | VBR_SBR | SRC, RD32, E}}},
Above patch is written for binutils snapshot dated 21 Jan 04.
Relaxation support is added for ELF as well as for COFF file formats.
Please find attached testcode, object dump of testcode for COFF and ELF formats.
I hope this testcode can be directly included in ld-testsuite.
Regards,
Anil Paranjpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relax-5.s
Type: application/octet-stream
Size: 977 bytes
Desc: relax-5.s
URL: <https://sourceware.org/pipermail/binutils/attachments/20040123/f26d4374/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relax-5.d
Type: application/octet-stream
Size: 1945 bytes
Desc: relax-5.d
URL: <https://sourceware.org/pipermail/binutils/attachments/20040123/f26d4374/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relax-5-coff.d
Type: application/octet-stream
Size: 1944 bytes
Desc: relax-5-coff.d
URL: <https://sourceware.org/pipermail/binutils/attachments/20040123/f26d4374/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relax-5.sh
Type: application/octet-stream
Size: 296 bytes
Desc: relax-5.sh
URL: <https://sourceware.org/pipermail/binutils/attachments/20040123/f26d4374/attachment-0003.obj>
More information about the Binutils
mailing list