[PATCH 1/2] if-to-switch conversion pass

Tom de Vries Tom_deVries@mentor.com
Thu Jul 19 12:43:00 GMT 2012


On 18/07/12 23:47, Steven Bosscher wrote:
> On Wed, Jul 18, 2012 at 11:30 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>>>> +tree-if-switch-conversion.o : tree-if-switch-conversion.c $(CONFIG_H) \
>>>> +    $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) \
>>>> +    $(TREE_INLINE_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
>>>> +    $(GIMPLE_H) $(TREE_PASS_H) $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h \
>>>> +    $(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H)
>>>
>>> I think this list needs updating.
>>>
>>
>> I went over the list just now and all the elements appear in other makerules as
>> well, so I don't see any obvious ones that should be removed. I think the
>> PARAMS_H is not necessary. Do you have concerns about anything else?
> 
> Why would the other make rules matter?

Steven,

Some header files are grouped into a macros like f.i. TREE_H. Something I saw
happening before was that a header file moved into such a macro, and my rule in
the patch was the only rule left using that header directly. I was referring to
this scenario.

> You're adding new make rules
> for your new file. Make it depend only on what your new file needs.
> 
> Makefile.in is a mess. One of these days, someone (hi, Tromey) will
> hopefully get annoyed enough with this again to finish some tool to
> auto-generate the dependences list. Until that time, let's try to
> avoid proliferating the messy rules from old files to new ones.
> 
>> +#include "config.h"
>> +#include "system.h"
>> +#include "coretypes.h"
>> +#include "tm.h"
> 
> Dearohdearohdear. You're going to look at target macros in this pass?
> Surely not. So, let's drop this header,
> 
>> +
>> +#include "params.h"
> 
> -ENONEEDFORTHIS
> 
> 
>> +#include "flags.h"
> 
> You get flags.h for free from tree.h, but...
> 
>> +#include "tree.h"
>> +#include "basic-block.h"
>> +#include "tree-ssa-operands.h"
> 
> You get these if you be a nice GIMPLE pass and include gimple.h
> instead of these three headers.
> 
>> +#include "tree-flow.h"
>> +#include "tree-flow-inline.h"
> 
> You don't need tree-flow-inline.h. tree-flow.h includes it already for you.
> 
> 
>> +#include "diagnostic.h"
> 
> I don't think you're emitting diagnostics.
> Except maybe: "warning: trying to out-smart developer if I do this
> without profile info" :-)
> 
> 
>> +#include "tree-pass.h"
>> +#include "tree-dump.h"
> 
> You don't need tree-dump.h
> 
> 
>> +#include "timevar.h"
> 
> You don't need timevar.h, either.
> 
> 
>> +#include "tree-pretty-print.h"
> 
> You want gimple-pretty-print.h in a GIMPLE pass.
> 
> So you're left with:
> 
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +
> +#include "gimple.h"
> +#include "gimple-pretty-print.h"
> +#include "tree-flow.h"
> +#include "tree-pass.h"
> 
> and
> 
> +tree-if-switch-conversion.o : tree-if-switch-conversion.c $(CONFIG_H)
> $(SYSTEM_H) coretypes.h \
> +   $(GIMPLE_H) $(GIMPLE_PRETTY_PRINT_H) $(TREE_FLOW_H) $(TREE_PASS_H)
> 
> Looks a lot nicer to me.
> 

Indeed :) , thanks a lot.

I'll clean this up for the next submission.

Thanks,
- Tom

> Please do feel free to join my headless header-hunt and help clean up
> all those other files that have needlessly complex #includes and
> correspondingly silly Makefile.in rules!
> 
> Ciao!
> Steven
> 




More information about the Gcc-patches mailing list