ARM target tweaks.

- Change TargetData string to match llvm-gcc.
 - Some -target-abi support for 'apcs-gnu', most importantly the alignment of double and long long changes.

llvm-svn: 81732
This commit is contained in:
Daniel Dunbar 2009-09-14 00:02:24 +00:00
parent 4e97bc3ee7
commit 125f8fb761
2 changed files with 28 additions and 2 deletions

View File

@ -994,8 +994,11 @@ class ARMTargetInfo : public TargetInfo {
public:
ARMTargetInfo(const std::string& triple) : TargetInfo(triple) {
// FIXME: Are the defaults correct for ARM?
DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:64";
DescriptionString = ("e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-"
"i64:32:32-f32:32:32-f64:32:32-"
"v64:64:64-v128:128:128-a0:0:32");
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
if (triple.find("armv7-") == 0)
ArmArch = Armv7a;
else if (triple.find("arm-") == 0 || triple.find("armv6-") == 0)
@ -1013,6 +1016,25 @@ public:
ArmArch = Armv6;
}
}
virtual bool setABI(const std::string &Name) {
// The defaults (above) are for AAPCS, check if we need to change them.
//
// FIXME: We need support for -meabi... we could just mangle it into the
// name.
if (Name == "apcs-gnu") {
DoubleAlign = LongLongAlign = 32;
SizeType = UnsignedLong;
// FIXME: Override "preferred align" for double and long long.
} else if (Name == "aapcs") {
// FIXME: Enumerated types are variable width in straight AAPCS.
} else if (Name == "aapcs-linux") {
;
} else
return false;
return true;
}
virtual void getTargetDefines(const LangOptions &Opts,
std::vector<char> &Defs) const {
// Target identification.

View File

@ -0,0 +1,4 @@
// RUN: clang-cc -triple arm-unknown-unknown -target-abi=apcs-gnu -fsyntax-only -verify %s
struct s0 { double f0; int f1; };
char chk0[__alignof__(struct s0) == 4 ? 1 : -1];