This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49857] Put constant switch-tables into flash
- From: "gjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Jul 2017 12:15:39 +0000
- Subject: [Bug tree-optimization/49857] Put constant switch-tables into flash
- Auto-submitted: auto-generated
- References: <bug-49857-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49857
--- Comment #15 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 41829
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41829&action=edit
pr49857-v2-all.diff: Proposed patch
PR 49857
* target.def (TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA): New hook.
* targhooks.c (default_addr_space_for_artificial_rodata): New function.
* targhooks.h (default_addr_space_for_artificial_rodata): New proto.
* tree-switch-conversion.c (target.h): Include it.
(build_one_array): Set address space of array_type according to
targetm.addr_space.for_artificial_rodata().
* doc/tm.texi.in (Named Address Spaces)
[TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA]: Add hook anchor.
* doc/tm.texi: Regenerate.
* config/avr/avr-opts.h: New file.
* config/avr/avr.opt: Include it.
(-maddr-space-for-lookup=): New option and...
(avr_opt_addr_space_for_lookup): ...associated Var.
(avr_aspace_for_lookup): New option enums used by above.
* config/avr/avr-protos.h (avr_out_load_flashx): New proto.
* config/avr/avr.c (avr_out_load_flashx): New function.
* avr_adjust_insn_length [ADJUST_LEN_LOAD_FLASHX]: Handle it.
* avr_rtx_costs_1 [ZERO_EXTEND, SIGN_EXTEND]: Handle
shift-and-extend-by-1 of HI -> PSI.
[ASHIFT,PSImode]: Describe cost of extend-and-shift-by-1.
(TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA): Define to...
(avr_addr_space_for_artificial_rodata): ...this new static function.
* config/avr/avr.md (unspec): Add UNSPEC_LOAD_FLASHX.
(adjust_len): Add load_flashx.
(*ashiftpsi.1_sign_extend.hi, *ashiftpsi.1_zero_extend.hi)
(*extendpsi.ashift.1.uqi, *load<mode>-flashx): New insns.
(*split_xload<mode>-cswtch): New insn-and-split.
* doc/invoke.texi (AVR Options) <-maddr-space-for-lookup=>: Document.