[PATCH] D25581: Implement __builtin_alloca_with_align for GCC compatibility

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 15:46:15 PDT 2016


rnk created this revision.
rnk added a reviewer: rsmith.
rnk added a subscriber: cfe-commits.

GCC documents that the alignment parameter is in bits and it must be:

- an integer constant
- a power of two
- a multiple of CHAR_BITS
- below an unspecified limit

This lines up directly with the requirements for LLVM's alloca
instruction, so I went ahead and wired it up. We limit the alignment to
1<<29, which is the maximum alignment supported by LLVM's alloca.

Implements feature request in PR30658


https://reviews.llvm.org/D25581

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/CGBuiltin.cpp
  lib/Sema/SemaChecking.cpp
  test/CodeGen/alloca.c
  test/Sema/builtin-alloca.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25581.74592.patch
Type: text/x-patch
Size: 5398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161013/09499b26/attachment.bin>


More information about the cfe-commits mailing list