[Subtarget] Remove static global constructor call from the tablegened subtarget featu...
authorCraig Topper <craig.topper@intel.com>
Fri, 1 Mar 2019 02:19:26 +0000 (02:19 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 1 Mar 2019 02:19:26 +0000 (02:19 +0000)
commit4f61308af274c72fa30ae6441d6a5c799924f221
tree0b5e0fb5d855fbc684e331aaf499d7c1855d7e84
parent93317d82daf864956ae0608594ee94293e3a4257
[Subtarget] Remove static global constructor call from the tablegened subtarget feature tables

Subtarget features are stored in a std::bitset that has been subclassed. There is a special constructor to allow the tablegen files to provide a list of bits to initialize the std::bitset to. This constructor isn't constexpr and std::bitset doesn't support many constexpr operations either. This results in a static global constructor being used to initialize the feature bitsets in these files at startup.

To fix this I've introduced a new FeatureBitArray class that holds three 64-bit values representing the initial bit values and taught tablegen to emit hex constants for them based on the feature enum values. This makes the tablegen files less readable than they were before. I can add the list of features back as a comment if we think that's important.

I've added a method to convert from this class into the std::bitset subclass we had before. I considered making the new FeatureBitArray class just implement the std::bitset interface we need instead, but thought I'd see how others felts about that first.

I've simplified the interfaces to SetImpliedBits and ClearImpliedBits a little minimize the number of times we need to convert to the bitset.

This removes about 27K from my local release+asserts build of llc.

Differential Revision: https://reviews.llvm.org/D58520

llvm-svn: 355167
llvm/include/llvm/MC/SubtargetFeature.h
llvm/lib/MC/SubtargetFeature.cpp
llvm/utils/TableGen/SubtargetEmitter.cpp