[PATCH: ARM] Replace define_constants with define_c_enum for unspec/unspec_volatile in backend
Richard Earnshaw
rearnsha@arm.com
Wed Mar 30 14:44:00 GMT 2011
On Tue, 2011-01-18 at 16:56 +0000, Yufeng Zhang wrote:
> This patch replaces define_constants in the ARM backend with
> define_c_enum for defining the available indexes for the
> unspecs/unspecvs expressions. This improves the readability of the
> intermediate dumps for machine-specific operations. For instance, given
> the following c code:
>
> int foo (char* s);
> extern char hello[];
>
> void test(int x)
> {
> int y = x + 4;
> foo(hello);
> }
>
> If compiled with -c -fpic, the diff of the -fdump-rtl-expand dump
> between pre-patch and post-patch is:
>
> @@ -24,10 +24,10 @@
> (const:SI (unspec:SI [
> (const:SI (plus:SI (unspec:SI [
> (const_int 0 [0])
> - ] 21)
> + ] UNSPEC_PIC_LABEL)
> (const_int 8 [0x8])))
> - ] 24))
> - ] 3)) test.c:43 -1
> + ] UNSPEC_GOTSYM_OFF))
> + ] UNSPEC_PIC_SYM)) test.c:43 -1
> (nil))
>
> (insn 10 9 11 2 (set (reg:SI 137)
> @@ -35,7 +35,7 @@
> (reg:SI 137)
> (const_int 8 [0x8])
> (const_int 0 [0])
> - ] 4)) test.c:43 -1
> + ] UNSPEC_PIC_BASE)) test.c:43 -1
> (nil))
>
> (insn 11 10 5 2 (use (reg:SI 137)) test.c:43 -1
>
> Having the indexes defined by define_c_enum, GCC will use the
> enumerators' names rather than some magic numbers when printing out
> unspec/unspec_volatile expressions.
>
> The patch does not change the code generation. The post-patch test
> result is the same as the pre-patch result (tested on qemu for armv7-a
> and arm-eabi).
>
> OK for the trunk?
>
> Cheers,
> Yufeng
>
>
> 2011-01-18 Yufeng Zhang <yufeng.zhang@arm.com>
>
> * config/arm/arm.md (define_constants for unspec): Replace with
> define_c_enum.
> (define_constants for unspecv): Replace with define_c_enum.
> * config/arm/neon.md (define_constants for unspec): Replace with
> define_c_enum.
OK.
R.
More information about the Gcc-patches
mailing list