Aldy Hernandez <al...@redhat.com> writes:
>> Rather than:
>>
>>        /* Change optabs if needed.  */
>>        if (TREE_OPTIMIZATION_OPTABS (opts))
>>          this_target_optabs
>>            = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts);
>>        else
>>          this_target_optabs = &default_target_optabs;
>>
>> I think it'd be better to have:
>>
>>        /* Change optabs if needed.  */
>>        if (TREE_OPTIMIZATION_OPTABS (opts))
>>          this_fn_optabs
>>            = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts);
>>        else
>>          this_fn_optabs = this_target_optabs;
>>
>> with genopinit.c updated to use this_fn_optabs instead of this_target_optabs.
>
> Hmmm, ok.
>
> I also added a default case setting this_fn_optabs = 
> &default_target_optabs when the optimizations haven't changed.  I can 
> remove this if redundant.

No, sounds like a good plan, but I think it should be this_target_optabs
rather than &default_target_optabs.  Also:

@@ -76,11 +76,8 @@ struct target_optabs {
 };
 
 extern struct target_optabs default_target_optabs;
-#if SWITCHABLE_TARGET
 extern struct target_optabs *this_target_optabs;
-#else
-#define this_target_optabs (&default_target_optabs)
-#endif

This shouldn't be needed now, and:

@@ -44,8 +44,9 @@ along with GCC; see the file COPYING3.  If not see
 
 struct target_optabs default_target_optabs;
 struct target_libfuncs default_target_libfuncs;
-#if SWITCHABLE_TARGET
 struct target_optabs *this_target_optabs = &default_target_optabs;
+struct target_optabs *this_fn_optabs = &default_target_optabs;
+#if SWITCHABLE_TARGET
 struct target_libfuncs *this_target_libfuncs = &default_target_libfuncs;
 #endif

I think this should be:

 struct target_optabs default_target_optabs;
 struct target_libfuncs default_target_libfuncs;
+struct target_optabs *this_fn_optabs = &default_target_optabs;
 #if SWITCHABLE_TARGET
 struct target_optabs *this_target_optabs = &default_target_optabs;
 struct target_libfuncs *this_target_libfuncs = &default_target_libfuncs;
 #endif

Looks good to me otherwise as far as switchable targets go.

Richard

Reply via email to