erichkeane added a comment.

In D127762#4102526 <https://reviews.llvm.org/D127762#4102526>, @aaron.ballman 
wrote:

> In D127762#4102436 <https://reviews.llvm.org/D127762#4102436>, @erichkeane 
> wrote:
>
>> Finally, and this is something @aaron.ballman probably wants to answer:  Is 
>> this sufficiently important that we're willing to take the additional 
>> overhead of 8 bits for each function type (plus an extra 8 bits for its 
>> prototype?).  Memory wise, this seems a little costly.
>
> It'd be nice to have a rough idea of what the overhead costs are. I think we 
> can steal a few bits back to reduce memory overhead if necessary.

I just have knowing how much memory per-function-type, which is 2 bytes per at 
the moment it looks (1 for the function type, 1 for the prototype).  Reducing 
it to 6 bits saves us 1 of those bytes I think, but the one on 
`FunctionTypeExtraBitfields` doesn't save us anything.  That said... its 
entirely possible to make it cost nothing there now that I look... It is 
`align-as void*`, so align 4 or 8 depending on the platform.  It currently 
contains a single `unsigned` (so 4 bytes) for the number of types in an 
exception spec.  So on 64 bit systems, we currently don't use any additional 
memory there as far as I can tell, but on 32 bit systems this likely costs 32 
bits there (despite being an 8 bit bitfield).

By standard imp-limits, apparently we only need to handle 8 bits worth for the 
Exception Spec types.  I'd be tempted, based on exception specs being 
deprecated and rarely used, to reduce it to an 'unsigned short' (2 bytes), 
which makes this cost-free on 32 bit machines.  WDYT?



================
Comment at: clang/include/clang/AST/Type.h:4123
     bool HasTrailingReturn : 1;
+    unsigned AArch64SMEAttributes : 8;
     Qualifiers TypeQuals;
----------------
aaron.ballman wrote:
> We could steal two bits back here and make this a 6-bit bit-field (we'd 
> probably want to adjust `SME_AttributeMask` accordingly as well).
That would be nice at least here, since Variadic/TrailingReturn would use the 
other 2, and mean that htis takes zero more data, instead of an entire 
additional byte.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to