This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Target options
- From: Shiva Chen <shiva0217 at gmail dot com>
- To: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 16 Jul 2013 10:56:45 +0800
- Subject: Re: Target options
- References: <CANc4vhosUM7iwJJZbnzL3sPU5R0Okh7yg1cPuB-AoAWpZ-YCiA at mail dot gmail dot com> <CANc4vhqkwoYGvu8fkao-NaDVBaqwagHHQhE7pEjaUaGScVqjaw at mail dot gmail dot com>
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