diff options
author | Zinovy Nis <zinovy.nis@gmail.com> | 2014-07-10 15:27:19 +0000 |
---|---|---|
committer | Zinovy Nis <zinovy.nis@gmail.com> | 2014-07-10 15:27:19 +0000 |
commit | 1db9573f03ab3e286affff5c374282647283310f (patch) | |
tree | 5faa9eed3c94a5ba1be6eddcefb5ed3dabb23db1 /clang/lib/Basic/Targets.cpp | |
parent | b38f8f07c55e384b16678f56a80ce02d6e3adf0e (diff) | |
download | bcm5719-llvm-1db9573f03ab3e286affff5c374282647283310f.tar.gz bcm5719-llvm-1db9573f03ab3e286affff5c374282647283310f.zip |
[x32] Adding X32 target support to driver, including TargetInfo,DescriptionString, flags, paths lookup, etc. Cover changes with new tests. The author of the patch is Pavel Chupin (@pavel.v.chupin).
The changes enable "hello world" on x32 target (x86_64-*-linux-gnux32). s/isX32/IsX32/ also fixed.
Differential Revision: http://reviews.llvm.org/D4180
llvm-svn: 212725
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index a38e752c1f9..c45a9ca035a 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3272,18 +3272,24 @@ namespace { class X86_64TargetInfo : public X86TargetInfo { public: X86_64TargetInfo(const llvm::Triple &Triple) : X86TargetInfo(Triple) { - LongWidth = LongAlign = PointerWidth = PointerAlign = 64; + const bool IsX32{getTriple().getEnvironment() == llvm::Triple::GNUX32}; + LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64; LongDoubleWidth = 128; LongDoubleAlign = 128; LargeArrayMinWidth = 128; LargeArrayAlign = 128; SuitableAlign = 128; - IntMaxType = SignedLong; - UIntMaxType = UnsignedLong; - Int64Type = SignedLong; + SizeType = IsX32 ? UnsignedInt : UnsignedLong; + PtrDiffType = IsX32 ? SignedInt : SignedLong; + IntPtrType = IsX32 ? SignedInt : SignedLong; + IntMaxType = IsX32 ? SignedLongLong : SignedLong; + UIntMaxType = IsX32 ? UnsignedLongLong : UnsignedLong; + Int64Type = IsX32 ? SignedLongLong : SignedLong; RegParmMax = 6; - DescriptionString = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"; + DescriptionString = (IsX32) + ? "e-m:e-" "p:32:32-" "i64:64-f80:128-n8:16:32:64-S128" + : "e-m:e-" "i64:64-f80:128-n8:16:32:64-S128"; // Use fpret only for long double. RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble); |