[llvm-dev] Command line -mcpu= and -march= (original) (raw)

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 19 02:34:41 PST 2018


Hi Mark,

On Wed, 19 Dec 2018 at 10:23, Mark R V Murray via llvm-dev <llvm-dev at lists.llvm.org> wrote:

What I can't figure out is how to the -mcpu=foo and/or -march=bar to work. The documentation implies that you get these for free by setting up the processor and subtarget features in the MC6809.td file, but try as I might I can't get it to work, and it doesn't work for the MSP430 either.

This probably applies to the developer tools (llc, opt etc), but Clang needs a bit of attention since it often tries to present a sanitized view of those internals to end users.

... even for MSP430 ...

MSP430 is a fairly bare-bones target, I'm not entirely surprised no-one has done the work there.

I'm concluding that I need to write a "consumer" of the -march and/or -mcpu options myself, but I can't find a canonical example of this anywhere. I've played with RegisterTarget, but the documentation is a bit too densely packed for me. Other CPUs like ARM and AArch64 work, and I can't figure out why.

I think the top-level code you want is in (under clang) lib/Driver/ToolChains/Clang.cpp (a bunch of getTargetFeature stuff) and lib/Driver/ToolChains/CommonArgs.cpp (getCPUName especially). These defer to target-specific .cpp files in the more complete targets (lib/Driver/ToolChains/Arch/XYZ.cpp).

Cheers.

Tim.



More information about the llvm-dev mailing list