No before I go an redo the main part of patch #2, I have a question, which
people prefer.

The current code has sequences of:

    target_flags |= MASK_FOO;                   /* set -mfoo */
    if ((target_flags_explicit & MASK_FOO)) ... /* Did user do -mfoo or
                                                    -mno-foo */

I can either change the code like I did before:

    rs6000_isa_flags |= OPTION_MASK_FOO;
    if ((rs6000_isa_flags_explicit & OPTION_MASK_FOO)) ...

Or I can add various macros to 'hide' the underlying bit manipulation, which
would allow me to stage all of the changes into multiple patches.  I tend to
prefer the raw bit manipulation because it is less change overall, we've used
raw bit manipulation forever.  However I'm willing to add the accessor macros
and submit multiple patches to get this checked in:

   #define TARGET_FOO_EXPLICIT ((target_flags_explict & MASK_FOO) != 0)

   #define SET_TARGET_FOO(VALUE)                                        \
   do {                                                                 \
     if (VALUE)                                                         \
       target_flags |= MASK_FOO;                                        \
     else                                                               \
       target_flags &= ~MASK_FOO;                                       \
   } while (0)

   #define SET_TARGET_FOO_EXPLICIT (target_flags_explicit |= MASK_FOO)

and then once all of the raw access to target_flags and target_flags_explicit
is done via accessors, I can finally do the change:

   #define TARGET_FOO_EXPLICIT                                          \
     ((rs6000_isa_flags_explict & OPTION_MASK_FOO) != 0)

   #define SET_TARGET_FOO(VALUE)                                        \
   do {                                                                 \
     if (VALUE)                                                         \
       rs6000_isa_flags |= OPTION_MASK_FOO;                             \
     else                                                               \
       rs6000_isa_flags &= ~OPTION_MASK_FOO;                            \
   } while (0)

   #define SET_TARGET_FOO_EXPLICIT                                      \
     (rs6000_isa_flags_explicit |= OPTION_MASK_FOO)

An alternative would be to provide separate SET/CLEAR macros:

   #define TARGET_FOO_EXPLICIT ((target_flags_explict & MASK_FOO) != 0)

   #define SET_TARGET_FOO (target_flags |= MASK_FOO)
   #define CLEAR_TARGET_FOO (target_flags &= ~MASK_FOO)

   #define SET_TARGET_FOO_EXPLICIT (target_flags_explicit |= MASK_FOO)

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com     fax +1 (978) 399-6899

Reply via email to