unsigned HasAlignMac68kSupport : 1;
unsigned RealTypeUsesObjCFPRet : 3;
- unsigned UsePreferredTypeAlign : 1;
// TargetInfo Constructor. Default initializes all fields.
TargetInfo(const std::string &T);
return HasAlignMac68kSupport;
}
- /// usePreferredTypeAlign - Check whether this target uses minimum alignment
- /// defined by ABI or some other preferred alignment.
- bool usePreferredTypeAlign() const {
- return UsePreferredTypeAlign;
- }
-
/// getTypeName - Return the user string for the specified integer type enum.
/// For example, SignedShort -> "short".
static const char *getTypeName(IntType T);
// 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
// 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) {
// 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;
"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;
+++ /dev/null
-// RUN: %clang_cc1 -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];
-
-double g1;
-short chk1[__alignof__(g1) == 4 ? 1 : -1];
-short chk2[__alignof__(double) == 4 ? 1 : -1];
-
-long long g2;
-short chk1[__alignof__(g2) == 4 ? 1 : -1];
-short chk2[__alignof__(long long) == 4 ? 1 : -1];
-
-_Complex double g3;
-short chk1[__alignof__(g3) == 4 ? 1 : -1];
-short chk2[__alignof__(_Complex double) == 4 ? 1 : -1];
--- /dev/null
+// RUN: %clang_cc1 -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];
+++ /dev/null
-// RUN: %clang_cc1 -triple armv7-apple-darwin10 -fsyntax-only -verify %s
-
-double g1;
-short chk1[__alignof__(g1) == 8 ? 1 : -1];
-short chk2[__alignof__(double) == 8 ? 1 : -1];
-
-long long g2;
-short chk1[__alignof__(g2) == 8 ? 1 : -1];
-short chk2[__alignof__(long long) == 8 ? 1 : -1];
-
-_Complex double g3;
-short chk1[__alignof__(g3) == 8 ? 1 : -1];
-short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];