[PATCH][middle-end][i386][Version 4] Add -fzero-call-used-regs=[skip|used-gpr-arg|used-arg|all-arg|used-gpr|all-gpr|used|all]
Qing Zhao
QING.ZHAO@ORACLE.COM
Wed Oct 28 15:13:01 GMT 2020
Hi, Richard,
I changed the “enum” to “namespace”.
There is no issue for C++ compilation. However, flag-types.h header file is also included by C modules and compiled with gcc, then I got a lot of following compilation errors:
make[4]: Entering directory '/home/qinzhao/Work/x86-build/x86_64-pc-linux-gnu/libgcc'
In file included from ../.././gcc/options.h:6,
from ../.././gcc/tm.h:22,
from ../../../x86-gcc/libgcc/libgcc2.c:29,
from ../../../x86-gcc/libgcc/config/i386/64/_multc3.c:6:
../../../x86-gcc/libgcc/../gcc/flag-types.h:289:1: error: unknown type name ‘namespace’
289 | namespace zero_regs_code {
| ^~~~~~~~~
Looks like that I should not put this new namespace inside “flag-types.h”? Which other header file I should put this namespace in?
thanks.
Qing
> On Oct 28, 2020, at 9:24 AM, Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> Okay, I will change it to namespace.
>
> Qing
>
>> On Oct 28, 2020, at 9:19 AM, Richard Sandiford <richard.sandiford@arm.com> wrote:
>>
>> Qing Zhao <QING.ZHAO@ORACLE.COM <mailto:QING.ZHAO@ORACLE.COM>> writes:
>>> Hi, Richard,
>>>
>>> In order to be consistent with other flags in flag-types.h, for example, “sanitize_code”,
>>> I didn’t use namespace, instead making the name more specific as following:
>>>
>>> /* Different settings for zeroing subset of registers. */
>>> enum zero_regs_flags {
>>> ZERO_REGS_UNSET = 0,
>>> ZERO_REGS_SKIP = 1UL << 0,
>>> ZERO_REGS_ONLY_USED = 1UL << 1,
>>> ZERO_REGS_ONLY_GPR = 1UL << 2,
>>> ZERO_REGS_ONLY_ARG = 1UL << 3,
>>> ZERO_REGS_ENABLED = 1UL << 4,
>>> ZERO_REGS_USED_GPR_ARG = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_USED
>>> | ZERO_REGS_ONLY_GPR | ZERO_REGS_ONLY_ARG,
>>> ZERO_REGS_USED_GPR = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_USED
>>> | ZERO_REGS_ONLY_GPR,
>>> ZERO_REGS_USED_ARG = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_USED
>>> | ZERO_REGS_ONLY_ARG,
>>> ZERO_REGS_USED = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_USED,
>>> ZERO_REGS_ALL_GPR_ARG = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_GPR
>>> | ZERO_REGS_ONLY_ARG,
>>> ZERO_REGS_ALL_GPR = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_GPR,
>>> ZERO_REGS_ALL_ARG = ZERO_REGS_ENABLED | ZERO_REGS_ONLY_ARG,
>>> ZERO_REGS_ALL = ZERO_REGS_ENABLED
>>> };
>>>
>>> Is this good?
>>>
>>> Or you still prefer namespace?
>>
>> I prefer the namespace. I realise namespaces aren't used that much
>> in GCC yet, but they *are* used.
>>
>> The advantage they have is that it's possible to do:
>>
>> using namespace ...;
>>
>> in contexts where there's no ambiguity. They also make lines like
>> the | ones above easier to read.
>>
>> Thanks,
>> Richard
>
More information about the Gcc-patches
mailing list