AVR: Output .gnu_attribute according to AS used for vtables.

This patch emits .gnu_attribute 4 (Tag_GNU_AVR_VTABLE_AS) according
to the named address space used for C++ virtual tables.

Currently there are only two values possible:
- Val_GNU_AVR_VTABLE_NONE: The unit doesn't use vtables.
- Val_GNU_AVR_VTABLE_RAM:  There are vtables in the generic space.

The purpose of the patch is to tag object files with the vtable AS
for the case when future extensions support vtables in ASes other
than generic.

The patch has four parts:

1) Add a configure test to define HAVE_AS_AVR_GNU_ATTRIBUTE
   when Binutils support .gnu_attribute for AVR.
   The test may return true for older Binutils versions that
   effectively ignore the .gnu_attribute.

2) Set avr_uses_vtable_p when the code invokes an indirect call
   to a vtable entry.  This check is performed by the new mini
   pass avr_pass_has that traverses gimple statements.

3) avr_file_end() sets avr_uses_vtable_p when the varpool contains
   a decl that represents a vtable.

4) avr_file_end() emits .gnu_attribute 4 according to avr_uses_vtable_p.

gcc/
	* configure.ac [avr] <HAVE_AS_AVR_GNU_ATTRIBUTE>: Set
	according to gcc_GAS_CHECK_FEATURE for .gnu_attribute.
	* configure: Rebuild.
	* config.in: Rebuild.
	* config/avr/avr.h (avr_addrspace_t) <gnu_attr_val>: New field.
	* config/avr/avr.cc (avr_addrspace): Adjust initializer.
	(avr_uses_vtable_p): New global variable.
	(avr_file_end): Update avr_uses_vtable_p according to varpool,
	then output .gnu_attribute 4 according to avr_uses_vtable_p.
	* config/avr/avr-passes.cc (gimple.h): Include.
	(gimple-iterator.h): Include.
	(avr_pass_data_has): New pass data.
	(avr_pass_has): New gimple pass.
	(make_avr_pass_has): New function.
	* config/avr/avr-passes.def (avr_pass_has): Insert pass.
	* config/avr/avr-protos.h (avr_uses_vtable_p): New global var.
	(class gimple_opt_pass): Declare.
	(make_avr_pass_has): New proto.
	* config/avr/avr.md (Tag_GNU_AVR_VTABLE_AS)
	(Val_GNU_AVR_VTABLE_NONE, Val_GNU_AVR_VTABLE_RAM)
	(Val_GNU_AVR_VTABLE_FLASH, Val_GNU_AVR_VTABLE_FLASH1)
	(Val_GNU_AVR_VTABLE_FLASH2, Val_GNU_AVR_VTABLE_FLASH3)
	(Val_GNU_AVR_VTABLE_FLASH4, Val_GNU_AVR_VTABLE_FLASH5)
	(Val_GNU_AVR_VTABLE_FLASHX): Define constants.
9 files changed