[cfe-dev] Cleaning up ARM parts of the Clang driver

Eli Friedman eli.friedman at gmail.com
Tue Oct 4 09:12:16 PDT 2011


On Tue, Oct 4, 2011 at 9:00 AM, James Molloy <james.molloy at arm.com> wrote:
> Hi Eli,
>
>> 2: The driver currently tries to pick a default CPU for the architecture
> if
>> none is specified. I think this is wrong – if no CPU is specified then the
>> compiler should *not* tune for a specific CPU. The user would expect if
>> specifying –arch armv7, for the compiler to give an output that has good
>> blended performance on all armv7 cores, not cortex-a8 specifically for
>> example.
>
> We don't actually have any "blended" tuning at the moment...cortex-a8
> tuning is probably at least as good as anything else we have at the
> moment.
>
> Sure; what I was thinking was even though we don't have that sort of tuning,
> it's not right to force a specific core. OK, for ARM, cortex-a8 will
> probably give the best performance all round as it actually has an
> Itinerary, but looking forward that's probably not right.
>
> The main thing is that being able to remove this would remove 50+ lines of
> horrible crufty switch statements, which I think are not needed.

Well, we don't really want to change the behavior for Apple targets
here.  Given that, if you think you have a better approach, fine.

>> 7:
>>   // Setting -mno-global-merge disables the codegen global merge pass.
>> Setting
>>   // -mglobal-merge has no effect as the pass is enabled by default.
>>   if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
>>                                options::OPT_mno_global_merge)) {
>>     if (A->getOption().matches(options::OPT_mno_global_merge))
>>       CmdArgs.push_back("-mno-global-merge");
>>   }
>>
>> It seems like this should be better handled by the sys::cl code in llc.
>
> I'm not following.  sys::cl command-line options aren't relevant to
> clang command-line processing.
>
> Apologies, my description made a bit of a leap between tools without
> explaining. -mno-global-merge is passed down from the driver to llc, where
> it is picked up in Target/ARM/ARMTargetMachine.cpp by a sys::cl static. I
> should think that sys::cl should be able to deal with having repeated
> "-mno-global-merge -mglobal-merge" arguments and picking the last one
> itself, instead of the Driver having to do some massaging?

The textual representation of the command-line is completely gone by
the time we invoke CodeGen.  Communicating with CodeGen via sys::cl is
less than ideal, but nobody has volunteered to clean it up.

-Eli




More information about the cfe-dev mailing list