1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/unittests/ADT/CMakeLists.txt
Guillaume Chatelet 9871a892f8 [ADT] Add Bitfield utilities
Context:
--------
There are places in LLVM where we need to pack typed fields into opaque values.
For instance, the `XXXInst` classes in `llvm/include/llvm/IR/Instructions.h` that extract informations from `Value::SubclassData` via `getSubclassDataFromInstruction()`.
The bit twiddling is done manually: this impairs readability and prevent consistent handling of out of range values (e.g. 435b458ad0/llvm/include/llvm/IR/Instructions.h (L564))
More importantly, the bit pattern is scattered throughout the implementation making it hard to pack additionnal fields or check for overlapping bits.

Design decisions:
-----------------
The Bitfield structs are to be declared together so it is clear which bits are used or not.
The code is designed with simplicity in mind, hence a few limitations:
 - Storage is limited to a single integer,
 - Enum values have to be `unsigned`,
 - Storage type has to be `unsigned`,
 - There are no automatic detection of overlapping fields (packed bitfield declaration should help though),
 - The interface is C like so `storage` needs to be passed in everytime (code is simpler and lifetime considerations more obvious)

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-June/142196.html

Differential Revision: https://reviews.llvm.org/D81580
2020-06-29 12:48:44 +00:00

85 lines
1.8 KiB
CMake

set(LLVM_LINK_COMPONENTS
Support
)
add_llvm_unittest(ADTTests
AnyTest.cpp
APFloatTest.cpp
APIntTest.cpp
APSIntTest.cpp
ArrayRefTest.cpp
BitFieldsTest.cpp
BitmaskEnumTest.cpp
BitVectorTest.cpp
BreadthFirstIteratorTest.cpp
BumpPtrListTest.cpp
CoalescingBitVectorTest.cpp
DAGDeltaAlgorithmTest.cpp
DeltaAlgorithmTest.cpp
DenseMapTest.cpp
DenseSetTest.cpp
DepthFirstIteratorTest.cpp
DirectedGraphTest.cpp
EnumeratedArrayTest.cpp
EquivalenceClassesTest.cpp
FallibleIteratorTest.cpp
FloatingPointMode.cpp
FoldingSet.cpp
FunctionExtrasTest.cpp
FunctionRefTest.cpp
HashingTest.cpp
IListBaseTest.cpp
IListIteratorTest.cpp
IListNodeBaseTest.cpp
IListNodeTest.cpp
IListSentinelTest.cpp
IListTest.cpp
ImmutableListTest.cpp
ImmutableMapTest.cpp
ImmutableSetTest.cpp
IntEqClassesTest.cpp
IntervalMapTest.cpp
IntrusiveRefCntPtrTest.cpp
IteratorTest.cpp
MappedIteratorTest.cpp
MapVectorTest.cpp
OptionalTest.cpp
PackedVectorTest.cpp
PointerEmbeddedIntTest.cpp
PointerIntPairTest.cpp
PointerSumTypeTest.cpp
PointerUnionTest.cpp
PostOrderIteratorTest.cpp
PriorityWorklistTest.cpp
RangeAdapterTest.cpp
SCCIteratorTest.cpp
STLExtrasTest.cpp
ScopeExitTest.cpp
SequenceTest.cpp
SetVectorTest.cpp
SimpleIListTest.cpp
SmallPtrSetTest.cpp
SmallSetTest.cpp
SmallStringTest.cpp
SmallVectorTest.cpp
SparseBitVectorTest.cpp
SparseMultiSetTest.cpp
SparseSetTest.cpp
StatisticTest.cpp
StringExtrasTest.cpp
StringMapTest.cpp
StringRefTest.cpp
StringSetTest.cpp
StringSwitchTest.cpp
TinyPtrVectorTest.cpp
TripleTest.cpp
TwineTest.cpp
TypeSwitchTest.cpp
TypeTraitsTest.cpp
WaymarkingTest.cpp
)
target_link_libraries(ADTTests PRIVATE LLVMTestingSupport)
add_dependencies(ADTTests intrinsics_gen)