summaryrefslogtreecommitdiff
path: root/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-04-24 09:58:52 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-04-24 09:58:52 +0000
commit3cc798b4632e9bbef325653b167a85a3ef2b38fc (patch)
tree0a381344328f6de0b2632a8837a4cabfc5c25b3f /lib/Basic/Targets.cpp
parentb4e01ab54a3dfcddb845f241239b2f5efffed8ba (diff)
downloadclang-3cc798b4632e9bbef325653b167a85a3ef2b38fc.tar.gz
clang-3cc798b4632e9bbef325653b167a85a3ef2b38fc.tar.bz2
clang-3cc798b4632e9bbef325653b167a85a3ef2b38fc.tar.xz
[mips] Correct size_t and ptrdiff_t for N32.
Summary: Correct size_t to be unsigned int and ptrdiff_t to be signed long. The types were the correct size before this change but the exact type matters for name mangling and exception handling in C++. Reviewers: atanasyan Reviewed By: atanasyan Differential Revision: http://reviews.llvm.org/D3470 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r--lib/Basic/Targets.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 108b197dae..59f5a018b0 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -5777,32 +5777,44 @@ class Mips64TargetInfoBase : public MipsTargetInfoBase {
public:
Mips64TargetInfoBase(const llvm::Triple &Triple)
: MipsTargetInfoBase(Triple, "n64", "mips64r2") {
- LongWidth = LongAlign = 64;
- PointerWidth = PointerAlign = 64;
LongDoubleWidth = LongDoubleAlign = 128;
LongDoubleFormat = &llvm::APFloat::IEEEquad;
if (getTriple().getOS() == llvm::Triple::FreeBSD) {
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
}
+ setN64ABITypes();
SuitableAlign = 128;
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
}
+
+ void setN64ABITypes() {
+ LongWidth = LongAlign = 64;
+ PointerWidth = PointerAlign = 64;
+ SizeType = UnsignedLong;
+ PtrDiffType = SignedLong;
+ }
+
+ void setN32ABITypes() {
+ LongWidth = LongAlign = 32;
+ PointerWidth = PointerAlign = 32;
+ SizeType = UnsignedInt;
+ PtrDiffType = SignedInt;
+ }
+
bool setABI(const std::string &Name) override {
if (Name == "n32") {
- LongWidth = LongAlign = 32;
- PointerWidth = PointerAlign = 32;
- ABI = Name;
- return true;
- } else if (Name == "n64") {
+ setN32ABITypes();
ABI = Name;
return true;
- } else if (Name == "64") {
+ } else if (Name == "n64" || Name == "64") {
+ setN64ABITypes();
ABI = "n64";
return true;
- } else
- return false;
+ }
+ return false;
}
+
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override {
MipsTargetInfoBase::getTargetDefines(Opts, Builder);