summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2013-11-12 10:09:34 +0000
committerRobert Lytton <robert@xmos.com>2013-11-12 10:09:34 +0000
commiteaf6f36e6de425064cdd608538d0a7c9bbf74ee5 (patch)
treeaca407a89b5a8f960a34d26f50e9da85f35d3cbb /clang/lib
parentcc4246614f7829183c335c44012fd6952265fe52 (diff)
downloadbcm5719-llvm-eaf6f36e6de425064cdd608538d0a7c9bbf74ee5.tar.gz
bcm5719-llvm-eaf6f36e6de425064cdd608538d0a7c9bbf74ee5.zip
XCore target requires preferred alignment.
The xcore llvm backend does not handle 8 byte alignment viz: "%BadAlignment = alloca i64, align 8" So getPreferredTypeAlign() must never overalign. llvm-svn: 194462
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 6729986c8d5..a03cf9e7d47 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -34,6 +34,7 @@
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/Capacity.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
@@ -1757,6 +1758,9 @@ CharUnits ASTContext::getTypeAlignInChars(const Type *T) const {
unsigned ASTContext::getPreferredTypeAlign(const Type *T) const {
unsigned ABIAlign = getTypeAlign(T);
+ if (Target->getTriple().getArch() == llvm::Triple::xcore)
+ return ABIAlign; // Never overalign on XCore.
+
// Double and long long should be naturally aligned if possible.
if (const ComplexType* CT = T->getAs<ComplexType>())
T = CT->getElementType().getTypePtr();
OpenPOWER on IntegriCloud