[cfe-commits] r115302 - in /cfe/trunk: include/clang/Basic/Builtins.def include/clang/Basic/BuiltinsX86.def lib/AST/ASTContext.cpp

Eli Friedman eli.friedman at gmail.com
Fri Oct 1 08:47:42 PDT 2010


On Fri, Oct 1, 2010 at 12:13 AM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Fri Oct  1 02:13:18 2010
> New Revision: 115302
>
> URL: http://llvm.org/viewvc/llvm-project?rev=115302&view=rev
> Log:
> Various builtins a require an integer constant.  Not providing
> one results in an obscure error from the backend that doesn't make
> sense.  Capture this information in the .def files for builtins with
> a new "I" modifier letter indicating the an argument needs to be an ICE.
>
> Nothing uses this yet, but sema will eventually enforce this (eliminating
> some special cases from semachecking.cpp) and codegen will use this to
> force an ICE value, preventing backend error messages.
>
> Modified:
>    cfe/trunk/include/clang/Basic/Builtins.def
>    cfe/trunk/include/clang/Basic/BuiltinsX86.def
>    cfe/trunk/lib/AST/ASTContext.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=115302&r1=115301&r2=115302&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Fri Oct  1 02:13:18 2010
> @@ -38,12 +38,13 @@
>  //  SJ -> sigjmp_buf
>  //  . -> "...".  This may only occur at the end of the function list.
>  //
> -// Types maybe prefixed with the following modifiers:
> +// Types may be prefixed with the following modifiers:
>  //  L   -> long (e.g. Li for 'long int')
>  //  LL  -> long long
>  //  LLL -> __int128_t (e.g. LLLi)
>  //  S   -> signed
>  //  U   -> unsigned
> +//  I   -> Required to constant fold to an integer constant expression.
>  //
>  // Types may be postfixed with the following modifiers:
>  // * -> pointer (optionally followed by an address space number)
> @@ -367,7 +368,7 @@
>  BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:")
>
>  BUILTIN(__builtin_expect, "LiLiLi"   , "nc")
> -BUILTIN(__builtin_prefetch, "vvC*.", "nc")
> +BUILTIN(__builtin_prefetch, "vvC*.", "nIc")

Err, is this change really intentional?  For functions with variable
parameters, we should probably just depend on the SemaChecking
infrastructure to make the appropriate checks.

-Eli




More information about the cfe-commits mailing list