Commit da6558fd by Nick Clifton Committed by Nick Clifton

Import some interworking support code from devo.

From-SVN: r22721
parent 470cdb8b
Thu Oct 1 17:57:14 1998 Nick Clifton <nickc@cygnus.com>
* config/arm/arm.c: Improve interworking support.
Thu Oct 1 18:43:35 1998 J"orn Rennecke <amylaar@cygnus.co.uk> Thu Oct 1 18:43:35 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* reload1.c (choose_reload_regs): Fix test if reload_reg_rtx[r] was * reload1.c (choose_reload_regs): Fix test if reload_reg_rtx[r] was
......
...@@ -3458,12 +3458,13 @@ static HOST_WIDE_INT ...@@ -3458,12 +3458,13 @@ static HOST_WIDE_INT
add_constant (x, mode, address_only) add_constant (x, mode, address_only)
rtx x; rtx x;
enum machine_mode mode; enum machine_mode mode;
int *address_only; int * address_only;
{ {
int i; int i;
HOST_WIDE_INT offset; HOST_WIDE_INT offset;
*address_only = 0; * address_only = 0;
if (mode == SImode && GET_CODE (x) == MEM && CONSTANT_P (XEXP (x, 0)) if (mode == SImode && GET_CODE (x) == MEM && CONSTANT_P (XEXP (x, 0))
&& CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))) && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
x = get_pool_constant (XEXP (x, 0)); x = get_pool_constant (XEXP (x, 0));
...@@ -3628,10 +3629,10 @@ find_barrier (from, max_count) ...@@ -3628,10 +3629,10 @@ find_barrier (from, max_count)
from = NEXT_INSN (from); from = NEXT_INSN (from);
} }
if (!found_barrier) if (! found_barrier)
{ {
/* We didn't find a barrier in time to /* We didn't find a barrier in time to
dump our stuff, so we'll make one */ dump our stuff, so we'll make one. */
rtx label = gen_label_rtx (); rtx label = gen_label_rtx ();
if (from) if (from)
...@@ -3639,7 +3640,7 @@ find_barrier (from, max_count) ...@@ -3639,7 +3640,7 @@ find_barrier (from, max_count)
else else
from = get_last_insn (); from = get_last_insn ();
/* Walk back to be just before any jump */ /* Walk back to be just before any jump. */
while (GET_CODE (from) == JUMP_INSN while (GET_CODE (from) == JUMP_INSN
|| GET_CODE (from) == NOTE || GET_CODE (from) == NOTE
|| GET_CODE (from) == CODE_LABEL) || GET_CODE (from) == CODE_LABEL)
...@@ -3649,7 +3650,6 @@ find_barrier (from, max_count) ...@@ -3649,7 +3650,6 @@ find_barrier (from, max_count)
JUMP_LABEL (from) = label; JUMP_LABEL (from) = label;
found_barrier = emit_barrier_after (from); found_barrier = emit_barrier_after (from);
emit_label_after (label, found_barrier); emit_label_after (label, found_barrier);
return found_barrier;
} }
return found_barrier; return found_barrier;
...@@ -3897,7 +3897,12 @@ output_call (operands) ...@@ -3897,7 +3897,12 @@ output_call (operands)
output_asm_insn ("mov%?\t%0, %|lr", operands); output_asm_insn ("mov%?\t%0, %|lr", operands);
} }
output_asm_insn ("mov%?\t%|lr, %|pc", operands); output_asm_insn ("mov%?\t%|lr, %|pc", operands);
if (TARGET_THUMB_INTERWORK)
output_asm_insn ("bx%?\t%0", operands);
else
output_asm_insn ("mov%?\t%|pc, %0", operands); output_asm_insn ("mov%?\t%|pc, %0", operands);
return ""; return "";
} }
...@@ -3945,8 +3950,18 @@ output_call_mem (operands) ...@@ -3945,8 +3950,18 @@ output_call_mem (operands)
if (eliminate_lr2ip (&operands[0])) if (eliminate_lr2ip (&operands[0]))
output_asm_insn ("mov%?\t%|ip, %|lr", operands); output_asm_insn ("mov%?\t%|ip, %|lr", operands);
if (TARGET_THUMB_INTERWORK)
{
output_asm_insn ("ldr%?\t%|ip, %0", operands);
output_asm_insn ("mov%?\t%|lr, %|pc", operands);
output_asm_insn ("bx%?\t%|ip", operands);
}
else
{
output_asm_insn ("mov%?\t%|lr, %|pc", operands); output_asm_insn ("mov%?\t%|lr, %|pc", operands);
output_asm_insn ("ldr%?\t%|pc, %0", operands); output_asm_insn ("ldr%?\t%|pc, %0", operands);
}
return ""; return "";
} }
...@@ -4815,15 +4830,29 @@ output_return_instruction (operand, really_return, reverse) ...@@ -4815,15 +4830,29 @@ output_return_instruction (operand, really_return, reverse)
strcat (instr, reg_names[13]); strcat (instr, reg_names[13]);
strcat (instr, ", "); strcat (instr, ", ");
strcat (instr, "%|"); strcat (instr, "%|");
strcat (instr, really_return ? reg_names[15] : reg_names[14]); strcat (instr, TARGET_THUMB_INTERWORK || (! really_return)
? reg_names[14] : reg_names[15] );
} }
else else
{ {
strcat (instr, "%|"); strcat (instr, "%|");
if (TARGET_THUMB_INTERWORK && really_return)
strcat (instr, reg_names[12]);
else
strcat (instr, really_return ? reg_names[15] : reg_names[14]); strcat (instr, really_return ? reg_names[15] : reg_names[14]);
} }
strcat (instr, (TARGET_APCS_32 || !really_return) ? "}" : "}^"); strcat (instr, (TARGET_APCS_32 || !really_return) ? "}" : "}^");
output_asm_insn (instr, &operand); output_asm_insn (instr, &operand);
if (TARGET_THUMB_INTERWORK && really_return)
{
strcpy (instr, "bx%?");
strcat (instr, reverse ? "%D0" : "%d0");
strcat (instr, "\t%|");
strcat (instr, frame_pointer_needed ? "lr" : "ip");
output_asm_insn (instr, & operand);
}
} }
else if (really_return) else if (really_return)
{ {
...@@ -4832,7 +4861,8 @@ output_return_instruction (operand, really_return, reverse) ...@@ -4832,7 +4861,8 @@ output_return_instruction (operand, really_return, reverse)
else else
sprintf (instr, "mov%%?%%%s0%s\t%%|pc, %%|lr", sprintf (instr, "mov%%?%%%s0%s\t%%|pc, %%|lr",
reverse ? "D" : "d", TARGET_APCS_32 ? "" : "s"); reverse ? "D" : "d", TARGET_APCS_32 ? "" : "s");
output_asm_insn (instr, &operand);
output_asm_insn (instr, & operand);
} }
return ""; return "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment