ARM backend

I added some Initial ARM target support to clang. I'm pretty sure it's
not all correct (validateAsmConstraint for example)
The defines were taken from a FreeBSD machine with: arm-elf-gcc -dM -E
- < /dev/null

Can anyone take a look and give me some hints on how it needs to be
changed before it can be committed?


clang-arm.diff (8.96 KB)

Would be nice to have a plugin architecture for targets, but how the code is structured now, mixes arm code and non-arm code, though, that's more just an observation.

This looks pretty reasonable to me. The target stuff in clang clearly needs to be refactored, but I won't ask you to do that as part of this patch! :slight_smile:

static void getARMDefines(std::vector<char> &Defs, bool is64Bit) {

"is64Bit" is irrelevant, please remove it.

+namespace {
+class DarwinARMTargetInfo : public DarwinTargetInfo {

Why make this "DarwinARM"? I'd suggest making it FreeBSDARMELFTargetInfo or something, if it's freebsd arm elf :slight_smile:

instead of calling:
+ DarwinTargetInfo::getTargetDefines(Defines);

You're probably better off getting the linux defines.

+// This is just a placeholder, the types and attributes are wrong.
+BUILTIN(__builtin_altivec_abs_v4sf , "ii" , "nc")
+// FIXME: Obviously incomplete.

ARM doesn't have altivec, please remove this one, or the whole .def file.

Otherwise, looks great, please resend with these updates,