This is the mail archive of the gcc-patches@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: [PATCH] Use flag_general_regs_only with -mgeneral-regs-only


On Sat, May 21, 2016 at 12:48 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Fri, May 20, 2016 at 7:49 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, May 20, 2016 at 10:15 AM, Rainer Orth
>> <ro@cebitec.uni-bielefeld.de> wrote:
>>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>>
>>>> On Thu, May 12, 2016 at 10:54 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>> Here is a patch to add
>>>>>>> -mgeneral-regs-only option to x86 backend.   We can update
>>>>>>> spec for interrupt handle to recommend compiling interrupt handler
>>>>>>> with -mgeneral-regs-only option and add a note for compiler
>>>>>>> implementers.
>>>>>>>
>>>>>>> OK for trunk if there is no regression?
>>>>>>
>>>>>>
>>>>>> I can't comment on the code patch, but for the documentation part:
>>>>>>
>>>>>>> @@ -24242,6 +24242,12 @@ opcodes, to mitigate against certain forms of
>>>>>>> attack. At the moment,
>>>>>>>  this option is limited in what it can do and should not be relied
>>>>>>>  on to provide serious protection.
>>>>>>>
>>>>>>> +@item -mgeneral-regs-only
>>>>>>> +@opindex mgeneral-regs-only
>>>>>>> +Generate code which uses only the general-purpose registers.  This will
>>>>>>
>>>>>>
>>>>>> s/which/that/
>>>>>>
>>>>>>> +prevent the compiler from using floating-point, vector, mask and bound
>>>>>>
>>>>>>
>>>>>> s/will prevent/prevents/
>>>>>>
>>>>>>> +registers, but will not impose any restrictions on the assembler.
>>>>>>
>>>>>>
>>>>>> Maybe you mean to say "does not restrict use of those registers in inline
>>>>>> assembly code"?  In any case, please get rid of the future tense here, too.
>>>>>
>>>>> I changed it to
>>>>>
>>>>> ---
>>>>> @item -mgeneral-regs-only
>>>>> @opindex mgeneral-regs-only
>>>>> Generate code that uses only the general-purpose registers.  This
>>>>> prevents the compiler from using floating-point, vector, mask and bound
>>>>> registers.
>>>>> ---
>>>>>
>>>>
>>>> Here is the updated patch.  Tested on x86-64.  OK for trunk?
>>>
>>> This patch broke {i386,x86_64}-apple-darwin15.5.0 bootstrap:
>>>
>>> In file included from ./tm.h:16:0,
>>>                  from /vol/gcc/src/hg/trunk/local/gcc/genattrtab.c:108:
>>> ./options.h:5443:2: error: #error too many target masks
>>>  #error too many target masks
>>>   ^
>>> Makefile:2497: recipe for target 'build/genattrtab.o' failed
>>> make[3]: *** [build/genattrtab.o] Error 1
>>>
>>> options.h has
>>>
>>> #define OPTION_MASK_ISA_XSAVES (HOST_WIDE_INT_1 << 62)
>>> #error too many target masks
>>>
>>> The tree bootstraps just fine at the previous revision.
>>>
>>
>> Tested on x86-64.  OK for trunk?
>
> No, this is a flag, not a variable. Let's figure out how to extend
> target flags to more than 63 flags first.

Extending target flags to more than 63 bits requires replacing
HOST_WIDE_INT with a bit vector.  Since target flags is used in
TARGET_SUBTARGET_DEFAULT, change it to a bit vector is a
non-trivial change.  On the other hand, -mgeneral-regs-only is a
command-line option which doesn't require support for
TARGET_SUBTARGET_DEFAULT, similar to other -m options like
-mmitigate-rop.  Using flag_general_regs_only is an option.

-- 
H.J.


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