mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
LowerBitSets: Introduce global layout builder.
The builder is based on a layout algorithm that tries to keep members of small bit sets together. The new layout compresses Chromium's bit sets to around 15% of their original size. Differential Revision: http://reviews.llvm.org/D7796 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230394 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -62,3 +62,30 @@ TEST(LowerBitSets, BitSetBuilder) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LowerBitSets, GlobalLayoutBuilder) {
|
||||
struct {
|
||||
uint64_t NumObjects;
|
||||
std::vector<std::set<uint64_t>> Fragments;
|
||||
std::vector<uint64_t> WantLayout;
|
||||
} GLBTests[] = {
|
||||
{0, {}, {}},
|
||||
{4, {{0, 1}, {2, 3}}, {0, 1, 2, 3}},
|
||||
{3, {{0, 1}, {1, 2}}, {0, 1, 2}},
|
||||
{4, {{0, 1}, {1, 2}, {2, 3}}, {0, 1, 2, 3}},
|
||||
{4, {{0, 1}, {2, 3}, {1, 2}}, {0, 1, 2, 3}},
|
||||
{6, {{2, 5}, {0, 1, 2, 3, 4, 5}}, {0, 1, 2, 5, 3, 4}},
|
||||
};
|
||||
|
||||
for (auto &&T : GLBTests) {
|
||||
GlobalLayoutBuilder GLB(T.NumObjects);
|
||||
for (auto &&F : T.Fragments)
|
||||
GLB.addFragment(F);
|
||||
|
||||
std::vector<uint64_t> ComputedLayout;
|
||||
for (auto &&F : GLB.Fragments)
|
||||
ComputedLayout.insert(ComputedLayout.end(), F.begin(), F.end());
|
||||
|
||||
EXPECT_EQ(T.WantLayout, ComputedLayout);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user