[cfe-commits] r68413 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/Sema/SemaDeclAttr.cpp
Anton Korobeynikov
asl at math.spbu.ru
Fri Apr 3 16:38:25 PDT 2009
Author: asl
Date: Fri Apr 3 18:38:25 2009
New Revision: 68413
URL: http://llvm.org/viewvc/llvm-project?rev=68413&view=rev
Log:
Provide sema proper values of maximal number of arguments passed in registers.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=68413&r1=68412&r2=68413&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Apr 3 18:38:25 2009
@@ -436,9 +436,9 @@
"'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
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=68413&r1=68412&r2=68413&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Fri Apr 3 18:38:25 2009
@@ -48,6 +48,7 @@
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);
@@ -304,6 +305,12 @@
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;
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=68413&r1=68412&r2=68413&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Apr 3 18:38:25 2009
@@ -633,6 +633,7 @@
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
IntPtrType = SignedInt;
+ RegParmMax = 3;
}
virtual const char *getVAListDeclaration() const {
return "typedef char* __builtin_va_list;";
@@ -762,6 +763,7 @@
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-"
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=68413&r1=68412&r2=68413&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Apr 3 18:38:25 2009
@@ -1465,17 +1465,16 @@
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;
}
More information about the cfe-commits
mailing list