On Thu, 19 Dec 2019 16:47:42 -0500
Erick Ochoa <[email protected]> wrote:
> Hello,
>
> I am working on testing an optimization. I am starting to write
> tests in the GCC testing suite. However, I want to develop some
> fine grain testing for my own sake.
>
> This optimization I am working on, is a variant of struct reordering.
> One way I would like to test my pass is for example, making a test case
> and guaranteeing that my pass is able to detect global variables of
> a specific struct type.
>
> For example, given the following C file
>
> ```
> /* { dg-lto-options {{-flto -fipa-struct-reorg
> -fipa-struct-reorg-assert-has-structs=astruct_s}} } */
>
> struct astruct_s { _Bool a; };
> struct astruct_s astruct;
>
> int main() { };
> ```
>
> I would like to create the option flag that has a list of string arguments
>
> -fipa-struct-reorg-assert-has-structs=<string>+
>
> such that during the analysis time, I'd be able to have an assertion
> to make sure that my pass has actually collected the types identified by the
> strings.
> I'm not very familiar on the DSL to specify option flags.
> I've looked at gcc/common.opt for some examples and found this one:
>
> ```
> frandom-seed=
> Common Joined RejectNegative Var(common_deferred_options) Defer
> -frandom-seed=<string> Make compile reproducible using <string>.
> ```
>
> Could anyone explain how to specify my flag? Or possibly
> point to some documentation/source that explains Common, Joined, etc...?
Have you looked at the GCC Internals Manual (gccint)? The section on option
specification files is online here:
https://gcc.gnu.org/onlinedocs/gccint/Option-properties.html#Option-properties
Jozef