[PATCH] D29827: [AVR] Add -mmcu option to the driver

Jonathan Roelofs via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 07:45:03 PDT 2017


jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: include/clang/Driver/Options.td:1613
 def mcpu_EQ : Joined<["-"], "mcpu=">, Group<m_Group>;
+def mmcu_EQ : Joined<["-"], "mmcu=">, Group<m_Group>;
 def mdynamic_no_pic : Joined<["-"], "mdynamic-no-pic">, Group<m_Group>;
----------------
Lekensteyn wrote:
> dylanmckay wrote:
> > Lekensteyn wrote:
> > > jroelofs wrote:
> > > > Would it make sense to have mcu be an alias for mcpu instead?
> > > That would deviate from the GCC interface, so I have chosen for the current situation:
> > > ```
> > > $ avr-gcc -mmcu=avr2 -o /dev/null x.c
> > > $ avr-gcc -mcpu=avr2 -o /dev/null x.c
> > > avr-gcc: error: unrecognized command line option '-mcpu=avr2'
> > > $ avr-gcc -march=avr2 -o /dev/null x.c
> > > avr-gcc: error: unrecognized command line option '-march=avr2'
> > > $ avr-gcc -v
> > > ...
> > > gcc version 6.3.0 (GCC)
> > > ```
> > I think @jroelofs  means that it is possible to make `mmcu` an alias of `mmcu` internally. This would mean we wouldn't need to add AVR-specific `getCPUName` handling.
> If mmcu is made an alias of mcpu, wouldn't that mean that both `-mcpu` and `-mmcu` would be accepted by driver (undesirable)?
> As far as I can see, `-target-cpu` must be passed to the frontend and assembler, `-mcpu=` is not recognized as option. And ensuring that `getCPUName` returns a non-empty string ensures that `-target-cpu` is passed.
> 
> I am quite new to the internals, so please let me know if I misunderstood something :-)
-mmcu= is the right thing to do, without the alias (I was wrong).


https://reviews.llvm.org/D29827





More information about the cfe-commits mailing list