[PATCH][IRA] Analysis of register usage of functions for usage by IRA.

Tom de Vries Tom_deVries@mentor.com
Mon Jan 13 16:16:00 GMT 2014


On 10-01-14 12:39, Richard Earnshaw wrote:
>>> >>Consequently, you'll need to add a patch for AArch64 which has two
>>> >>registers clobbered by PLT-based calls.
>>> >>
>> >
>> >Thanks for pointing that out. That's r16 and r17, right? I can propose the hook
>> >for AArch64, once we all agree on how the hook should look.
>> >
> Yes; and thanks!

Hi Richard,

I'm posting this patch that implements the TARGET_FN_OTHER_HARD_REG_USAGE hook 
for aarch64. It uses the conservative hook format for now.

I've build gcc and cc1 with the patch, and observed the impact on this code snippet:
...
static int
bar (int x)
{
   return x + 3;
}

int
foo (int y)
{
   return y + bar (y);
}
...

AFAICT, that looks as expected:
...
$ gcc fuse-caller-save.c -mno-lra -fno-use-caller-save -O2 -S -o- > 1
$ gcc fuse-caller-save.c -mno-lra -fuse-caller-save -O2 -S -o- > 2
$ diff -u 1 2
--- 1	2014-01-13 16:51:24.000000000 +0100
+++ 2	2014-01-13 16:51:19.000000000 +0100
@@ -11,14 +11,12 @@
  	.global	foo
  	.type	foo, %function
  foo:
-	stp	x29, x30, [sp, -32]!
+	stp	x29, x30, [sp, -16]!
+	mov	w1, w0
  	add	x29, sp, 0
-	str	x19, [sp,16]
-	mov	w19, w0
  	bl	bar
-	add	w0, w0, w19
-	ldr	x19, [sp,16]
-	ldp	x29, x30, [sp], 32
+	ldp	x29, x30, [sp], 16
+	add	w0, w0, w1
  	ret
  	.size	foo, .-foo
  	.section	.text.startup,"ax",%progbits
...

Btw, the results are the same for -mno-lra and -mlra. I'm just using the 
-mno-lra version here because the -mlra version of -fuse-caller-save is still in 
review ( http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00586.html ).

Thanks,
- Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fuse-caller-save-aarch64-hook.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140113/c32cee8c/attachment.bin>


More information about the Gcc-patches mailing list