"'cleanup' function %0 parameter has type %1 which is incompatible with "
"type %2">;
def err_attribute_regparm_wrong_platform : Error<
- "'regparm' is not valid on platforms other than x86-32">;
+ "'regparm' is not valid on this platform">;
def err_attribute_regparm_invalid_number : Error<
- "'regparm' parameter must be between 0 and 3 inclusive">;
+ "'regparm' parameter must be between 0 and %0 inclusive">;
// Clang-Specific Attributes
const char *DescriptionString;
const char *UserLabelPrefix;
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
+ unsigned char RegParmMax, SSERegParmMax;
// TargetInfo Constructor. Default initializes all fields.
TargetInfo(const std::string &T);
return -1;
return 0;
}
+
+ // getRegParmMax - Returns maximal number of args passed in registers.
+ unsigned getRegParmMax() const {
+ return RegParmMax;
+ }
+
protected:
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
return PointerWidth;
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
IntPtrType = SignedInt;
+ RegParmMax = 3;
}
virtual const char *getVAListDeclaration() const {
return "typedef char* __builtin_va_list;";
LongDoubleAlign = 128;
IntMaxType = SignedLong;
UIntMaxType = UnsignedLong;
+ RegParmMax = 6;
DescriptionString = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
return;
}
- if (NumParams.getLimitedValue(4) > 3) {
- S.Diag(Attr.getLoc(), diag::err_attribute_regparm_invalid_number)
+ if (S.Context.Target.getRegParmMax() == 0) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_regparm_wrong_platform)
<< NumParamsExpr->getSourceRange();
return;
}
- const char *TargetPrefix = S.Context.Target.getTargetPrefix();
- unsigned PointerWidth = S.Context.Target.getPointerWidth(0);
- if (strcmp(TargetPrefix, "x86") || PointerWidth != 32) {
- S.Diag(Attr.getLoc(), diag::err_attribute_regparm_wrong_platform)
- << NumParamsExpr->getSourceRange();
+ // FIXME: we need to honour command line settings also...
+ if (NumParams.getLimitedValue(4) > S.Context.Target.getRegParmMax()) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_regparm_invalid_number)
+ << S.Context.Target.getRegParmMax() << NumParamsExpr->getSourceRange();
return;
}