[MC] Use subclass data for MCExpr to reduce memory usage
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 10 Apr 2020 20:06:12 +0000 (22:06 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Apr 2020 18:02:11 +0000 (20:02 +0200)
commit8e7d771cf9b6197c723e1ea8739563d24aca2e3c
tree27b06b8ceaa726b48ac0526ea586397cdc90e58d
parenta916e819275922ab9a350283a12647da6f4ad4b1
[MC] Use subclass data for MCExpr to reduce memory usage

MCExpr has a bunch of free space that is currently going to waste.
Repurpose it as 24 bits of subclass data, which is enough to reduce
the size of all subclasses by 8 bytes. This gives us some respectable
savings for debuginfo builds. Here are the max-rss reductions for the
fat LTO link step:

    kc.link               238MiB   231MiB   (-2.82%)
    sqlite3.link          258MiB   250MiB   (-3.27%)
    consumer-typeset.link 152MiB   148MiB   (-2.51%)
    bullet.link           197MiB   192MiB   (-2.30%)
    tramp3d-v4.link       578MiB   567MiB   (-1.92%)
    pairlocalalign.link    92MiB    90MiB   (-1.98%)
    clamscan.link         230MiB   223MiB   (-2.81%)
    lencod.link           242MiB   235MiB   (-2.67%)
    SPASS.link            235MiB   230MiB   (-2.23%)
    7zip-benchmark.link   450MiB   435MiB   (-3.25%)

Differential Revision: https://reviews.llvm.org/D77939
llvm/include/llvm/MC/MCExpr.h
llvm/lib/MC/MCExpr.cpp