The draft technical report of the ISO/IEC JTC1 S22 WG14 N1275
standards committee, Programming Languages - C - Extensions to
support embedded processors, specifies a syntax for embedded
processors to specify alternate address spaces. You can configure a
GCC port to support section 5.1 of the draft report to add support for
address spaces other than the default address space. These address
spaces are new keywords that are similar to the
const type attributes.
Pointers to named address spaces can have a different size than pointers to the generic address space.
For example, the SPU port uses the
__ea address space to refer
to memory in the host processor, rather than memory local to the SPU
processor. Access to memory in the
__ea address space involves
issuing DMA operations to move data between the host processor and the
local processor memory address space. Pointers in the
address space are either 32 bits or 64 bits based on the
-mea32 or -mea64 switches (native SPU pointers are
always 32 bits).
Internally, address spaces are represented as a small integer in the range 0 to 15 with address space 0 being reserved for the generic address space.
A list of
ADDR_SPACE_KEYWORDmacros to define each named address keyword. The
ADDR_SPACE_KEYWORDmacro takes two arguments, the keyword string and the number of the named address space. For example, the SPU port uses the following to declare
__eaas the keyword for named address space #1:#define ADDR_SPACE_EA 1 #define TARGET_ADDR_SPACE_KEYWORDS ADDR_SPACE_KEYWORD ("__ea", ADDR_SPACE_EA)
Define this to return the machine mode to use for pointers to address_space if the target supports named address spaces. The default version of this hook returns
ptr_modefor the generic address space only.
Define this to return the machine mode to use for addresses in address_space if the target supports named address spaces. The default version of this hook returns
Pmodefor the generic address space only.
Define this to return nonzero if the port can handle pointers with machine mode mode to address space as. This target hook is the same as the
TARGET_VALID_POINTER_MODEtarget hook, except that it includes explicit named address space support. The default version of this hook returns true for the modes returned by either the
TARGET_ADDR_SPACE_ADDRESS_MODEtarget hooks for the given address space.
Define this to return true if exp is a valid address for mode mode in the named address space as. The strict parameter says whether strict addressing is in effect after reload has finished. This target hook is the same as the
TARGET_LEGITIMATE_ADDRESS_Ptarget hook, except that it includes explicit named address space support.
Define this to modify an invalid address x to be a valid address with mode mode in the named address space as. This target hook is the same as the
TARGET_LEGITIMIZE_ADDRESStarget hook, except that it includes explicit named address space support.
Define this to return whether the subset named address space is contained within the superset named address space. Pointers to a named address space that is a subset of another named address space will be converted automatically without a cast if used together in arithmetic operations. Pointers to a superset address space can be converted to pointers to a subset address space via explicit casts.
Define this to convert the pointer expression represented by the RTL op with type from_type that points to a named address space to a new pointer expression with type to_type that points to a different named address space. When this hook it called, it is guaranteed that one of the two address spaces is a subset of the other, as determined by the