[PATCH] D54676: [AST] Pack CallExpr

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 18 06:24:32 PST 2018


riccibruno created this revision.
riccibruno added a reviewer: rjmccall.
riccibruno added a project: clang.
Herald added a subscriber: cfe-commits.

Use the newly available space in the bit-fields of `Stmt` to store some
data from `CallExpr`. This saves 8 bytes per `CallExpr`. This is a straightforward
patch, except that it limits the maximum number of arguments to `2^14 - 1`.

The maximum number of arguments to a function call is already
limited to 16 bits because of `FunctionTypeBitfields::NumParams`,
which used to be 15 bits until a few month ago.

This also do not leave any space for additional bits, but after looking at
the history of `CallExpr` it seems that people are not adding data
here very frequently.

It would be possible to reuse some bits of the `SubExprs` pointer, but ideally
this pointer would be removed by storing the arguments in a trailing array.
Alternatively it would be possible to store the number of arguments in a
trailing object when it is too large.


Repository:
  rC Clang

https://reviews.llvm.org/D54676

Files:
  include/clang/AST/Expr.h
  include/clang/AST/Stmt.h
  lib/AST/Expr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54676.174538.patch
Type: text/x-patch
Size: 5529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181118/6caa2f7a/attachment.bin>


More information about the cfe-commits mailing list