[cfe-commits] r68413 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/Sema/SemaDeclAttr.cpp

Hi, Eli

Is this documented somewhere?

Well. Yes. It defaults to gcc's REGPARM_MAX, which is 3 on x86-32 and 6
on x86-64.

  As far as I can tell, it has no effect on the calling convention in LLVM.

That's correct. Actually regparm is among features which do not have
properly documented semantics.

So far (gcc's behaviour):
1. Hard error on non-x86 platforms
2. Ignore on x86-64 (warning is emitted with apple gcc / llvm-gcc, not
not with fsf gcc). However it's perfectly allowed to use regparm there.
3. Honour on x86-32

I decided to make clang's implementation as flexible as possible to allow theoretical
regparm(N) support for non-x86 targets, if needed.

> + 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;
> }

This check doesn't work correctly with getRegParmMax > 3.

Fixed, thanks