Commit 75f1d6fc by Sofiane Naci Committed by James Greenhalgh

gcc/

	* config/aarch64/aarch64.c
	(aarch64_output_mi_thunk): Refactor to generate RTL patterns.

From-SVN: r193630
parent 2adc5085
2012-11-19 Sofiane Naci <sofiane.naci@arm.com>
* config/aarch64/aarch64.c
(aarch64_output_mi_thunk): Refactor to generate RTL patterns.
2012-11-19 Mans Rullgard <mans@mansr.com> 2012-11-19 Mans Rullgard <mans@mansr.com>
PR target/55276 PR target/55276
...@@ -2335,9 +2335,10 @@ aarch64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, ...@@ -2335,9 +2335,10 @@ aarch64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
to return a pointer to an aggregate. On AArch64 a result value to return a pointer to an aggregate. On AArch64 a result value
pointer will be in x8. */ pointer will be in x8. */
int this_regno = R0_REGNUM; int this_regno = R0_REGNUM;
rtx this_rtx, temp0, temp1, addr, insn, funexp;
/* Make sure unwind info is emitted for the thunk if needed. */ reload_completed = 1;
final_start_function (emit_barrier (), file, 1); emit_note (NOTE_INSN_PROLOGUE_END);
if (vcall_offset == 0) if (vcall_offset == 0)
aarch64_add_constant (file, this_regno, IP1_REGNUM, delta); aarch64_add_constant (file, this_regno, IP1_REGNUM, delta);
...@@ -2345,37 +2346,55 @@ aarch64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, ...@@ -2345,37 +2346,55 @@ aarch64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
{ {
gcc_assert ((vcall_offset & 0x7) == 0); gcc_assert ((vcall_offset & 0x7) == 0);
if (delta == 0) this_rtx = gen_rtx_REG (Pmode, this_regno);
asm_fprintf (file, "\tldr\t%r, [%r]\n", IP0_REGNUM, this_regno); temp0 = gen_rtx_REG (Pmode, IP0_REGNUM);
else if (delta >= -256 && delta < 256) temp1 = gen_rtx_REG (Pmode, IP1_REGNUM);
asm_fprintf (file, "\tldr\t%r, [%r,%wd]!\n", IP0_REGNUM, this_regno,
delta);
else
{
aarch64_add_constant (file, this_regno, IP1_REGNUM, delta);
asm_fprintf (file, "\tldr\t%r, [%r]\n", IP0_REGNUM, this_regno); addr = this_rtx;
if (delta != 0)
{
if (delta >= -256 && delta < 256)
addr = gen_rtx_PRE_MODIFY (Pmode, this_rtx,
plus_constant (Pmode, this_rtx, delta));
else
aarch64_add_constant (file, this_regno, IP1_REGNUM, delta);
} }
aarch64_emit_move (temp0, gen_rtx_MEM (Pmode, addr));
if (vcall_offset >= -256 && vcall_offset < 32768) if (vcall_offset >= -256 && vcall_offset < 32768)
asm_fprintf (file, "\tldr\t%r, [%r,%wd]\n", IP1_REGNUM, IP0_REGNUM, addr = plus_constant (Pmode, temp0, vcall_offset);
vcall_offset);
else else
{ {
aarch64_build_constant (file, IP1_REGNUM, vcall_offset); aarch64_build_constant (file, IP1_REGNUM, vcall_offset);
asm_fprintf (file, "\tldr\t%r, [%r,%r]\n", IP1_REGNUM, IP0_REGNUM, addr = gen_rtx_PLUS (Pmode, temp0, temp1);
IP1_REGNUM);
} }
asm_fprintf (file, "\tadd\t%r, %r, %r\n", this_regno, this_regno, aarch64_emit_move (temp1, gen_rtx_MEM (Pmode,addr));
IP1_REGNUM); emit_insn (gen_add2_insn (this_rtx, temp1));
} }
output_asm_insn ("b\t%a0", &XEXP (DECL_RTL (function), 0)); /* Generate a tail call to the target function. */
if (!TREE_USED (function))
{
assemble_external (function);
TREE_USED (function) = 1;
}
funexp = XEXP (DECL_RTL (function), 0);
funexp = gen_rtx_MEM (FUNCTION_MODE, funexp);
insn = emit_call_insn (gen_sibcall (funexp, const0_rtx, NULL_RTX));
SIBLING_CALL_P (insn) = 1;
insn = get_insns ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1);
final_end_function (); final_end_function ();
/* Stop pretending to be a post-reload pass. */
reload_completed = 0;
} }
static int static int
aarch64_tls_operand_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED) aarch64_tls_operand_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
{ {
......
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