Sequence of access to passes.c
Ankit Mahanot
ankit1986@gmail.com
Fri Sep 11 18:09:00 GMT 2009
Yes the flags are being set at some stage or in some file. I think I
found that file in the source code :
Filename - opts.c
The code that sets the optimization flags is as follows:
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
for (i = 1; i < argc; i++)
{
if (!strcmp (argv[i], "-O"))
{
optimize = 1;
optimize_size = 0;
}
else if (argv[i][0] == '-' && argv[i][1] == 'O')
{
/* Handle -Os, -O2, -O3, -O69, ... */
const char *p = &argv[i][2];
if ((p[0] == 's') && (p[1] == 0))
{
optimize_size = 1;
/* Optimizing for size forces optimize to be 2. */
optimize = 2;
}
else
{
const int optimize_val = read_integral_parameter (p, p - 2, -1);
if (optimize_val != -1)
{
optimize = optimize_val;
optimize_size = 0;
}
}
}
}
I think now I can go on & see where to implement my algo :)
thanks everyone.
More information about the Gcc-help
mailing list