This is the mail archive of the gcc@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: Target options


2013/7/16 Hendrik Greving <hendrik.greving.intel@gmail.com>:
> Along the same lines, what's the difference of target_flags (I know
> from old compilers) and target_flags_explicit (I do not know)?
>
> Thanks,
> Regards,
> Hendrik Greving
>
> On Mon, Jul 15, 2013 at 10:30 AM, Hendrik Greving
> <hendrik.greving.intel@gmail.com> wrote:
>> Hi,
>>
>> when defining target options with Mask() and "Target" going to
>> target_flags. Can I use Init(1) to define the default, or is "Init"
>> only used to initialize "Var(name)" kind of options? If so, what's the
>> proper way to define defaults, it wasn't clear to me when checking
>> mips/i386 definitions for instance.
>>
>> Thanks,
>> Hendrik Greving

Hi,  Greving

To my understanding, when the option use MASK(F)
we shouldn't use Init (), one approach is to initialize it in
option_override target hook
Ex:  target_flags |= MASK_F

target_flags_explicit determine whether user have given the flag value
(disable/enable)or not.

Ex:
if the flag initial value depends on cpu type
when the cpu type is A, flag F should enable
However, user may disable the flag explicitly
we wish user semantic could take effect.

Therefore, the condition would be

if (cpu_type == A
    && !(target_flags_explicit & MASK_F))
   target_flags |= MASK_F;

Cheers,
Shiva


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