This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Implement the -arch flag
ClosedPublic

Authored by ehsan on Jul 15 2014, 7:12 AM.

Details

Summary

This implements the -arch flag for both x86 and x86-64 by letting
them affect the default target features we pass to cc1. -m machine
flags will override the features set by -arch.

Diff Detail

Repository
rL LLVM

Event Timeline

ehsan updated this revision to Diff 11440.Jul 15 2014, 7:12 AM
ehsan retitled this revision from to clang-cl: Implement the -arch flag.
ehsan updated this object.
ehsan edited the test plan for this revision. (Show Details)
ehsan added a reviewer: rnk.
ehsan added a subscriber: Unknown Object (MLST).
hans added a subscriber: hans.Jul 15 2014, 8:33 AM

Nice!

If this is for PR20213 (though I guess this doesn't solve the SSSE3 problem?), please put that in the description.

lib/Driver/Tools.cpp
1450 ↗(On Diff #11440)

Do we need this check? The option can only be specified in clang-cl mode anyway.

1453 ↗(On Diff #11440)

Is MSVC really case insensitive here? I get "ignored unknown option" for /arch:ia32, but it accepts /arch:IA32.

1465 ↗(On Diff #11440)

It would be nice to warn about unknown Arch values.

In D4519#4, @hans wrote:

If this is for PR20213 (though I guess this doesn't solve the SSSE3 problem?), please put that in the description.

Yes, it doesn't solve the SSE3 issue...

ehsan updated this revision to Diff 11445.Jul 15 2014, 9:25 AM

Addressed the review comments.

hans accepted this revision.Jul 15 2014, 9:35 AM
hans added a reviewer: hans.

lgtm

lib/Driver/Tools.cpp
1454 ↗(On Diff #11445)

You can just do:

std::string ArchLower = Arch->lower();

Or maybe just use Arch->lower() when updating Features in the code below.

This revision is now accepted and ready to land.Jul 15 2014, 9:35 AM
hans added inline comments.Jul 15 2014, 9:36 AM
lib/Driver/Tools.cpp
1454 ↗(On Diff #11445)

And by Arch->lower(), I mean Arch.lower() of course :)

ehsan closed this revision.Jul 15 2014, 11:36 AM
ehsan updated this revision to Diff 11459.

Closed by commit rL213083 (authored by @ehsan).