diff options
author | Chad Rosier <mcrosier@apple.com> | 2011-07-26 07:03:04 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2011-07-26 07:03:04 +0000 |
commit | 9f1210c3280104417a4ad30f0a00825ac8fa718a (patch) | |
tree | 83f234ecc9559fa8695ae5664c56e3dc59e6614b /lib | |
parent | 108f756bebd991eaa980cfb9994353612a2e5ff6 (diff) |
After further discussion it has been determined that alignof should report
the preferred alignment. Thus, revert r135934, r135935, and r135940.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ASTContext.cpp | 5 | ||||
-rw-r--r-- | lib/AST/ExprConstant.cpp | 13 | ||||
-rw-r--r-- | lib/Basic/TargetInfo.cpp | 3 | ||||
-rw-r--r-- | lib/Basic/Targets.cpp | 6 |
4 files changed, 7 insertions, 20 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c6e2c20df7..5463b7b7b0 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -696,10 +696,7 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool RefAsPointee) const { // Walk through any array types while we're at it. T = getBaseElementType(arrayType); } - if (Target.usePreferredTypeAlign()) - Align = std::max(Align, getPreferredTypeAlign(T.getTypePtr())); - else - Align = std::max(Align, getTypeAlign(T.getTypePtr())); + Align = std::max(Align, getPreferredTypeAlign(T.getTypePtr())); } // Fields can be subject to extra alignment constraints, like if diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 1435627562..fdcff0a4da 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -1592,15 +1592,10 @@ CharUnits IntExprEvaluator::GetAlignOfType(QualType T) { // result shall be the alignment of the referenced type." if (const ReferenceType *Ref = T->getAs<ReferenceType>()) T = Ref->getPointeeType(); - - // __alignof defaults to returning the preferred alignment, but - // can be overridden by the specific target. - if (Info.Ctx.Target.usePreferredTypeAlign()) - return Info.Ctx.toCharUnitsFromBits( - Info.Ctx.getPreferredTypeAlign(T.getTypePtr())); - else - return Info.Ctx.toCharUnitsFromBits( - Info.Ctx.getTypeAlign(T.getTypePtr())); + + // __alignof is defined to return the preferred alignment. + return Info.Ctx.toCharUnitsFromBits( + Info.Ctx.getPreferredTypeAlign(T.getTypePtr())); } CharUnits IntExprEvaluator::GetAlignOfExpr(const Expr *E) { diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index c7a87b20eb..7ea51467c1 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -65,9 +65,6 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) { // Default to no types using fpret. RealTypeUsesObjCFPRet = 0; - // Default to using preferred type alignment. - UsePreferredTypeAlign = true; - // Default to using the Itanium ABI. CXXABI = CXXABI_Itanium; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 53f5c0abaf..3aebc41d71 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1978,13 +1978,11 @@ public: "v64:32:64-v128:32:128-a0:0:32-n32"); } - // Default to using minimum alignment, not preferred. - UsePreferredTypeAlign = false; + // 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; |