Inconsistency between PowerPC and PPC?

Hi all,

I've noticed the naming of the PowerPC/PPC backend has a lot of
inconsistency when it comes to naming. To start off with, the directory
of the backend is called PowerPC and the files are prefixed with PPC.
This is not a major issue in my opinion, but makes my Clang Makefiles
for the FreeBSD build system a bit more complex than they have to be.

Anyway, with the C++ frontend, there seems to be some inconsistency
between clang-driver and which architecture name is supported by clang:

$ PATH=/usr/obj/powerpc/usr/src/tmp/usr/bin:$PATH CFLAGS='-###' make
testcc -### test.c -o test
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk )
"/usr/obj/powerpc/usr/src/tmp/usr/bin/clang" <snip> "-arch" "ppc" <snip>

If I execute this command by hand, I get:

ERROR: Unable to get target machine: No available targets are compatible with this module

If I change "ppc" to "powerpc", it builds properly.

The following patch seems to fix this:

%%%
Index: lib/Driver/Driver.cpp

I've noticed the naming of the PowerPC/PPC backend has a lot of
inconsistency when it comes to naming. To start off with, the directory
of the backend is called PowerPC and the files are prefixed with PPC.
This is not a major issue in my opinion, but makes my Clang Makefiles
for the FreeBSD build system a bit more complex than they have to be.

Yes, there is no consistency here. :frowning:

Anyway, with the C++ frontend, there seems to be some inconsistency
between clang-driver and which architecture name is supported by clang:

$ PATH=/usr/obj/powerpc/usr/src/tmp/usr/bin:$PATH CFLAGS='-###' make
testcc -### test.c -o test
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk )
"/usr/obj/powerpc/usr/src/tmp/usr/bin/clang" <snip> "-arch" "ppc" <snip>

The issue here is that the triple should be "powerpc-foo-bar", but you can pick the ppc backend with the "-arch ppc" option. I implemented a simple mapping here:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090323/014465.html

It would be nice for the driver to suck in some of this logic from clang.cpp at some point.

-Chris