This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,AVR]: ad PR49868: Extend __pgmx semantics to flatten memory


2012/1/10 Georg-Johann Lay <avr@gjlay.de>:
> This patch extends the semantics of 24-bit __pgmx address space qualifier to
> cover RAM and Flash.
>
> RAM is represented by setting the high byte of 24-bit address to 0x80. The code
> to read from 24-bit address space decides at runtime what instruction to use to
> read by if-else decision depending on bit 23 of the address, i.e. the code
> looks like.
>
> if address.23
> Â Âreturn LD reg, Z // read from RAM
> else
> Â Âif have RAMPZ
> Â Â Â ÂRAMPZ = address.msb
> Â Âreturn LPM reg, Z // read from Flash
>
> The code in avr.c actually gets simpler because more work is shifted to libgcc
> as the code to emit gets more complex.
>
> Moreover, there is better separation of 16-bit address spaces and 24-bit
> address spaces because even on small devices with just 1 flash segment 24-bit
> pointers make sense now.
>
> Ok for trunk?
>
> This should be the last patch for 4.7 from my side that adds new functionality,
> so that all what remains is documentation and release note updates, test cases
> and bug fixes.
>
> Unfortunately, the address space implementation in GCC is odd from the user
> perspective, in particular when dealing with literals.
>
> Johann
>
> libgcc/
> Â Â Â ÂPR target/49868
> Â Â Â ÂExtend __pgmx semantics to linearize memory.
> Â Â Â Â* config/avr/t-avr (LIB1ASMFUNCS): Add _xload_1, _movmemx.
> Â Â Â Â* config/avr/lib1funcs.S (__xload_1): New function.
> Â Â Â Â(__movmemx_qi, __movmemx_hi): New functions.
> Â Â Â Â(__xload_2, __xload_3, __xload_4): Rewrite to fit new __pgmx
> Â Â Â Âsemantics.
>
> gcc/
> Â Â Â ÂPR target/49868
> Â Â Â ÂExtend __pgmx semantics to linearize memory.
> Â Â Â Â* config/avr/avr.md (mov<mode>): Use avr_xload_libgcc_p to
> Â Â Â Âdetermine if code comes inline or from libgcc.
> Â Â Â Â(MOVMEM_r_d:HI): Add "w" to constraint for better preference.
> Â Â Â Â(movmem_qi, movmem_qi): Set constraint #2 to "n".
> Â Â Â Â(movmem_qi_elpm, movmem_hi_elpm): Remove insns.
> Â Â Â Â(movmemx_qi, movmemx_hi): New insns.
> Â Â Â Â(xload_<mode>_libgcc): Rewrite to new insn condition.
> Â Â Â Â(xload_<mode>): Remove insns.
> Â Â Â Â* config/avr/avr.c (avr_out_xload): Rewrite: Only need to handle
> Â Â Â Âcases that don't satisfy avr_xload_libgcc_p().
> Â Â Â Â(avr_addr_space_convert): Allow converting in any direction.
> Â Â Â Â(avr_addr_space_subset_p): Return always true.
> Â Â Â Â(avr_xload_libgcc_p): Rewrite to fit new __pgmx semantics.
> Â Â Â Â(avr_emit_movmemhi): Ditto.
> Â Â Â Â(avr_out_lpm): No need to handle ADDR_SPACE_PGMX any more.
> Â Â Â Â(avr_out_movmem): Ditto.
> Â Â Â Â(AVR_SYMBOL_FLAG_PROGMEM): New macro.
> Â Â Â Â(AVR_SYMBOL_SET_ADDR_SPACE): New macro.
> Â Â Â Â(AVR_SYMBOL_GET_ADDR_SPACE): New macro.
> Â Â Â Â(avr_encode_section_info): Encode 'progmem' in symbol flags.
> Â Â Â Â(output_reload_in_const): Don't zero-extend any 24-bit symbols.

Approved.

Denis.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]