This is the mail archive of the gcc@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: [gimplefe] Regarding command line option handling


On 4 May 2016 at 15:54, Richard Biener <richard.guenther@gmail.com> wrote:
> On Wed, May 4, 2016 at 11:46 AM, Prasad Ghangal
> <prasad.ghangal@gmail.com> wrote:
>> On 4 May 2016 at 13:02, Richard Biener <richard.guenther@gmail.com> wrote:
>>> On Wed, May 4, 2016 at 8:41 AM, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
>>>> Hi !
>>>> Currently I am trying to introduce new command line option -fgimple,
>>>> for that I am adding this to c.opt
>>>>
>>>> diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
>>>> index 4f86876..88e55c6 100644
>>>> --- a/gcc/c-family/c.opt
>>>> +++ b/gcc/c-family/c.opt
>>>> @@ -66,6 +66,10 @@ C ObjC C++ ObjC++ Separate Alias(d)
>>>>  -dump=
>>>>  C ObjC C++ ObjC++ Joined Alias(d)
>>>>
>>>> +fgimple
>>>> +C Var(flag_gimple) Init(0)
>>>> +Enable parsing GIMPLE
>>>> +
>>>>  -imacros
>>>>  C ObjC C++ ObjC++ Separate Alias(imacros) MissingArgError(missing
>>>> filename after %qs)
>>>>
>>>>
>>>> But I am getting error as - "gcc: error: unrecognized command line
>>>> option â-fgimple â; did you mean â-fgimple â?"
>>>>
>>>> I am unable to find where to handle it.
>>>
>>> Did you properly re-build gcc after that change?  It should work just fine.
>>>
>>> Richard.
>>>
>>
>> Yes, I did stage 1 build on latest revision. Still it's giving this
>> strange error - "gcc: error: unrecognized command line option
>> â-fgimpleâ; did you mean â-fgimpleâ?"
>
> The error is indeed strage.  W/o the patch I get
>
>> ./xgcc -B. -fgimple -S t.i
> xgcc: error: unrecognized command line option '-fgimple'; did you mean
> '--compile'?
>
> and with it (re-building cc1 and xgcc inside gcc/ of my dev-tree)
>
>> ./xgcc -B. -fgimple -S t.i
> (no error)
>
> so it works fine for me.  Note that 'gcc' inside the build tree is called xgcc.
>

Yes, it works for $build/gcc/cc1 but not for $prefix/bin/gcc i.e.
after installing

> Richard.
>
>
>>
>>>>
>>>>
>>>> Till now I am able to JUST parse __GIMPLE keyword
>>>>
>>>> diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
>>>> index cae2faf..1ccb4d6 100644
>>>> --- a/gcc/c-family/c-common.c
>>>> +++ b/gcc/c-family/c-common.c
>>>> @@ -468,6 +468,7 @@ const struct c_common_resword c_common_reswords[] =
>>>>    { "__extension__",    RID_EXTENSION,    0 },
>>>>    { "__func__",        RID_C99_FUNCTION_NAME, 0 },
>>>>    { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXXONLY },
>>>> +  { "__GIMPLE",        RID_GIMPLE,    0 },
>>>>    { "__has_nothrow_constructor", RID_HAS_NOTHROW_CONSTRUCTOR, D_CXXONLY },
>>>>    { "__has_nothrow_copy", RID_HAS_NOTHROW_COPY, D_CXXONLY },
>>>>    { "__has_trivial_assign", RID_HAS_TRIVIAL_ASSIGN, D_CXXONLY },
>>>> @@ -12393,6 +12394,7 @@ keyword_is_function_specifier (enum rid keyword)
>>>>      case RID_NORETURN:
>>>>      case RID_VIRTUAL:
>>>>      case RID_EXPLICIT:
>>>> +    case RID_GIMPLE:
>>>>        return true;
>>>>      default:
>>>>        return false;
>>>> diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
>>>> index 663e457..a91665f 100644
>>>> --- a/gcc/c-family/c-common.h
>>>> +++ b/gcc/c-family/c-common.h
>>>> @@ -64,10 +64,10 @@ enum rid
>>>>    /* Modifiers: */
>>>>    /* C, in empirical order of frequency.  */
>>>>    RID_STATIC = 0,
>>>> -  RID_UNSIGNED, RID_LONG,    RID_CONST, RID_EXTERN,
>>>> -  RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
>>>> -  RID_VOLATILE, RID_SIGNED,  RID_AUTO,  RID_RESTRICT,
>>>> -  RID_NORETURN, RID_ATOMIC,
>>>> +  RID_UNSIGNED, RID_LONG,     RID_CONST,   RID_EXTERN,
>>>> +  RID_GIMPLE,    RID_REGISTER, RID_TYPEDEF, RID_SHORT,
>>>> +  RID_INLINE,    RID_VOLATILE, RID_SIGNED,  RID_AUTO,
>>>> +  RID_RESTRICT, RID_NORETURN, RID_ATOMIC,
>>>>
>>>>    /* C extensions */
>>>>    RID_COMPLEX, RID_THREAD, RID_SAT,
>>>> diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
>>>> index f0c677b..e690ca3 100644
>>>> --- a/gcc/c/c-decl.c
>>>> +++ b/gcc/c/c-decl.c
>>>> @@ -10401,6 +10401,8 @@ declspecs_add_scspec (source_location loc,
>>>>      case RID_TYPEDEF:
>>>>        n = csc_typedef;
>>>>        break;
>>>> +    case RID_GIMPLE:
>>>> +      break;
>>>>      default:
>>>>        gcc_unreachable ();
>>>>      }
>>>> diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
>>>> index bdd669d..266b672 100644
>>>> --- a/gcc/c/c-parser.c
>>>> +++ b/gcc/c/c-parser.c
>>>> @@ -732,6 +732,7 @@ c_token_starts_declspecs (c_token *token)
>>>>      case RID_ALIGNAS:
>>>>      case RID_ATOMIC:
>>>>      case RID_AUTO_TYPE:
>>>> +    case RID_GIMPLE:
>>>>        return true;
>>>>      default:
>>>>        if (token->keyword >= RID_FIRST_INT_N
>>>> @@ -2461,6 +2462,7 @@ c_parser_declspecs (c_parser *parser, struct
>>>> c_declspecs *specs,
>>>>      case RID_NORETURN:
>>>>      case RID_AUTO:
>>>>      case RID_THREAD:
>>>> +    case RID_GIMPLE:
>>>>        if (!scspec_ok)
>>>>          goto out;
>>>>        attrs_ok = true;
>>>> @@ -3960,6 +3962,7 @@ c_parser_attribute_any_word (c_parser *parser)
>>>>      case RID_INT_N_1:
>>>>      case RID_INT_N_2:
>>>>      case RID_INT_N_3:
>>>> +    case RID_GIMPLE:
>>>>        ok = true;
>>>>        break;
>>>>      default:
>>>>
>>>>
>>>>
>>>> After recognizing __GIMPLE, I am planning to call gimple_fn_parser
>>>> function which will parse gimple body.
>>>> For pass manager, basic idea is to introduce new member to struct
>>>> function as pass_list and modify function execute_pass_list to run
>>>> only passes in pass list.
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Prasad Ghangal


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