Index: target.def
===================================================================
--- target.def	(revision 250302)
+++ target.def	(working copy)
@@ -3285,6 +3285,25 @@ The default implementation does nothing.
  void, (addr_space_t as, location_t loc),
  default_addr_space_diagnose_usage)
 
+/* Function to get the address space of some compiler-generated
+   read-only data.  Used for optimization purposes only.  */
+DEFHOOK
+(for_artificial_rodata,
+ "Define this hook to return an address space to be used for @var{type},\n\
+usually an artificial lookup-table that would reside in @code{.rodata}.\n\
+It is always safe not to implement this hook or to return\n\
+@code{ADDR_SPACE_GENERIC}.\n\
+\n\
+The hook can be used to put compiler-generated, artificial data in\n\
+static stzorage into a specific address space when this is better suited\n\
+than the generic address space.\n\
+The compiler will also generate all accesses to the respective data\n\
+so that all associated accesses will also use the desired address space.\n\
+An example for such data are the @code{CSWTCH} lookup tables as generated\n\
+by @option{-ftree-switch-conversion}.",
+ addr_space_t, (tree type),
+ default_addr_space_for_artificial_rodata)
+
 HOOK_VECTOR_END (addr_space)
 
 #undef HOOK_PREFIX
Index: targhooks.c
===================================================================
--- targhooks.c	(revision 250302)
+++ targhooks.c	(working copy)
@@ -1397,6 +1397,14 @@ default_addr_space_convert (rtx op ATTRI
   gcc_unreachable ();
 }
 
+/* The default hook for TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA.  */
+
+addr_space_t
+default_addr_space_for_artificial_rodata (tree)
+{
+  return ADDR_SPACE_GENERIC;
+}
+
 bool
 default_hard_regno_scratch_ok (unsigned int regno ATTRIBUTE_UNUSED)
 {
Index: targhooks.h
===================================================================
--- targhooks.h	(revision 250302)
+++ targhooks.h	(working copy)
@@ -184,6 +184,7 @@ extern bool default_addr_space_zero_addr
 extern int default_addr_space_debug (addr_space_t);
 extern void default_addr_space_diagnose_usage (addr_space_t, location_t);
 extern rtx default_addr_space_convert (rtx, tree, tree);
+extern addr_space_t default_addr_space_for_artificial_rodata (tree);
 extern unsigned int default_case_values_threshold (void);
 extern bool default_have_conditional_execution (void);
 
Index: tree-switch-conversion.c
===================================================================
--- tree-switch-conversion.c	(revision 250302)
+++ tree-switch-conversion.c	(working copy)
@@ -46,6 +46,7 @@ Software Foundation, 51 Franklin Street,
 #include "gimplify-me.h"
 #include "tree-cfg.h"
 #include "cfgloop.h"
+#include "target.h"
 
 /* ??? For lang_hooks.types.type_for_mode, but is there a word_mode
    type in the GIMPLE type system that is language-independent?  */
@@ -1136,6 +1137,16 @@ build_one_array (gswitch *swtch, int num
       default_type = TREE_TYPE (info->default_values[num]);
       value_type = array_value_type (swtch, default_type, num, info);
       array_type = build_array_type (value_type, arr_index_type);
+      // Run the following hook on the complete array so the back-end
+      // can inspect details of it.
+      addr_space_t as = targetm.addr_space.for_artificial_rodata (array_type);
+      if (!ADDR_SPACE_GENERIC_P (as))
+	{
+	  int quals = (TYPE_QUALS_NO_ADDR_SPACE (value_type)
+		       | ENCODE_QUAL_ADDR_SPACE (as));
+	  value_type = build_qualified_type (value_type, quals);
+	  array_type = build_array_type (value_type, arr_index_type);
+	}
       if (default_type != value_type)
 	{
 	  unsigned int i;
Index: doc/tm.texi
===================================================================
--- doc/tm.texi	(revision 250302)
+++ doc/tm.texi	(working copy)
@@ -10595,6 +10595,21 @@ the address space as registered with @co
 The default implementation does nothing.
 @end deftypefn
 
+@deftypefn {Target Hook} addr_space_t TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA (tree @var{type})
+Define this hook to return an address space to be used for @var{type},
+usually an artificial lookup-table that would reside in @code{.rodata}.
+It is always safe not to implement this hook or to return
+@code{ADDR_SPACE_GENERIC}.
+
+The hook can be used to put compiler-generated, artificial data in
+static stzorage into a specific address space when this is better suited
+than the generic address space.
+The compiler will also generate all accesses to the respective data
+so that all associated accesses will also use the desired address space.
+An example for such data are the @code{CSWTCH} lookup tables as generated
+by @option{-ftree-switch-conversion}.
+@end deftypefn
+
 @node Misc
 @section Miscellaneous Parameters
 @cindex parameters, miscellaneous
Index: doc/tm.texi.in
===================================================================
--- doc/tm.texi.in	(revision 250302)
+++ doc/tm.texi.in	(working copy)
@@ -7529,6 +7529,8 @@ c_register_addr_space ("__ea", ADDR_SPAC
 
 @hook TARGET_ADDR_SPACE_DIAGNOSE_USAGE
 
+@hook TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA
+
 @node Misc
 @section Miscellaneous Parameters
 @cindex parameters, miscellaneous
