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: [match-and-simplify] error checking on user defined oper in for


On Tue, Oct 28, 2014 at 11:27 AM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> On Tue, Oct 28, 2014 at 3:45 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Sat, Oct 25, 2014 at 8:16 PM, Prathamesh Kulkarni
>> <bilbotheelffriend@gmail.com> wrote:
>>> Currently this is accepted:
>>> (for plus (mult div)
>>>   ...)
>>> which is incorrect. This patch puts more error-checks on the user-defined
>>> operator in for-pattern.
>>
>> Nicely spotted issue.  But I prefer to fix it simpler like with the following
>> which I applied.
> Won't using get_operator() lookup the hash-table twice for a valid
> user-defined operator ?

Sure - but who cares for a generator program.

> I thought it would be be better instead to write another function
> (insert_operator) to insert operator into hash-table, that does one
> lookup.

Well - I'd prefer easy maintainance for the code over optimization ;)
Which means less lines of code == better.

Thanks,
Richard.

> Thanks,
> Prathamesh.
>>
>> Richard.
>>
>> 2014-10-28  Richard Biener  <rguenther@suse.de>
>>
>>         * genmatch.c (parser::parse_for): Properly check for already
>>         defined operators.
>>
>>
>>> * genmatch.c
>>>   (insert_operator): New function.
>>>   (parse_for): Call insert_operator.
>>>
>>> Thanks,
>>> Prathamesh


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