* config/tc-m68k.c (HAVE_LONG_BRANCH): New macro, returns true for

m68k family cpus which support long branch addressing modes.
(m68k_ip, md_convert_frag_1, md_estimate_size_before_relax,
md_create_long_jump): Use it.
This commit is contained in:
J.T. Conklin
1997-01-20 18:47:48 +00:00
parent 84be8dcf9e
commit ffecfc8b60
2 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,10 @@
Mon Jan 20 10:39:36 1997 J.T. Conklin <jtc@beauty.cygnus.com>
* config/tc-m68k.c (HAVE_LONG_BRANCH): New macro, returns true for
m68k family cpus which support long branch addressing modes.
(m68k_ip, md_convert_frag_1, md_estimate_size_before_relax,
md_create_long_jump): Use it.
Mon Jan 20 12:42:06 1997 Ian Lance Taylor <ian@cygnus.com> Mon Jan 20 12:42:06 1997 Ian Lance Taylor <ian@cygnus.com>
* config/tc-mips.c (md_begin): Don't set interlocks for * config/tc-mips.c (md_begin): Don't set interlocks for

View File

@ -251,6 +251,9 @@ struct m68k_it
#define float_of_arch(x) ((x) & mfloat) #define float_of_arch(x) ((x) & mfloat)
#define mmu_of_arch(x) ((x) & mmmu) #define mmu_of_arch(x) ((x) & mmmu)
/* Macros for determining if cpu supports a specific addressing mode */
#define HAVE_LONG_BRANCH(x) ((x) & (m68020|m68030|m68040|m68060|cpu32))
static struct m68k_it the_ins; /* the instruction being assembled */ static struct m68k_it the_ins; /* the instruction being assembled */
#define op(ex) ((ex)->exp.X_op) #define op(ex) ((ex)->exp.X_op)
@ -2250,7 +2253,7 @@ m68k_ip (instring)
&& opP->disp.pic_reloc == pic_none && opP->disp.pic_reloc == pic_none
#endif #endif
&& S_GET_SEGMENT (adds (&opP->disp)) == now_seg && S_GET_SEGMENT (adds (&opP->disp)) == now_seg
&& cpu_of_arch (current_architecture) >= m68020 && HAVE_LONG_BRANCH(current_architecture)
&& !flag_long_jumps && !flag_long_jumps
&& !strchr ("~%&$?", s[0])) && !strchr ("~%&$?", s[0]))
{ {
@ -2385,8 +2388,8 @@ m68k_ip (instring)
break; break;
case 'L': case 'L':
long_branch: long_branch:
if (cpu_of_arch (current_architecture) < m68020) if (!HAVE_LONG_BRANCH(current_architecture))
as_warn ("Can't use long branches on 68000/68010"); as_warn ("Can't use long branches on 68000/68010/5200");
the_ins.opcode[the_ins.numo - 1] |= 0xff; the_ins.opcode[the_ins.numo - 1] |= 0xff;
add_fix ('l', &opP->disp, 1, 0); add_fix ('l', &opP->disp, 1, 0);
addword (0); addword (0);
@ -2409,7 +2412,7 @@ m68k_ip (instring)
BCC68000 for the case where opnd is absolute (it BCC68000 for the case where opnd is absolute (it
needs to use the 68000 hack since no conditional abs needs to use the 68000 hack since no conditional abs
jumps). */ jumps). */
if (((cpu_of_arch (current_architecture) < m68020) if (( !HAVE_LONG_BRANCH(current_architecture)
|| (0 == adds (&opP->disp))) || (0 == adds (&opP->disp)))
&& (the_ins.opcode[0] >= 0x6200) && (the_ins.opcode[0] >= 0x6200)
&& (the_ins.opcode[0] <= 0x6f00)) && (the_ins.opcode[0] <= 0x6f00))
@ -3770,6 +3773,7 @@ m68k_frob_label (sym)
n->next = labels; n->next = labels;
n->label = sym; n->label = sym;
as_where (&n->file, &n->line); as_where (&n->file, &n->line);
n->text = 0;
labels = n; labels = n;
current_label = n; current_label = n;
} }
@ -4073,7 +4077,7 @@ md_convert_frag_1 (fragP)
ext = 2; ext = 2;
break; break;
case TAB (ABRANCH, LONG): case TAB (ABRANCH, LONG):
if (cpu_of_arch (current_architecture) < m68020) if (!HAVE_LONG_BRANCH(current_architecture))
{ {
if (fragP->fr_opcode[0] == 0x61) if (fragP->fr_opcode[0] == 0x61)
/* BSR */ /* BSR */
@ -4284,7 +4288,7 @@ md_estimate_size_before_relax (fragP, segment)
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE); fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE);
break; break;
} }
else if ((fragP->fr_symbol == 0) || (cpu_of_arch (current_architecture) < m68020)) else if ((fragP->fr_symbol == 0) || !HAVE_LONG_BRANCH(current_architecture))
{ {
/* On 68000, or for absolute value, switch to abs long */ /* On 68000, or for absolute value, switch to abs long */
/* FIXME, we should check abs val, pick short or long */ /* FIXME, we should check abs val, pick short or long */
@ -4598,7 +4602,7 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
{ {
valueT offset; valueT offset;
if (cpu_of_arch (current_architecture) < m68020) if (!HAVE_LONG_BRANCH(current_architecture))
{ {
offset = to_addr - S_GET_VALUE (to_symbol); offset = to_addr - S_GET_VALUE (to_symbol);
md_number_to_chars (ptr, (valueT) 0x4EF9, 2); md_number_to_chars (ptr, (valueT) 0x4EF9, 2);