summaryrefslogtreecommitdiff
path: root/test/gtest
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-08-28 09:13:33 -0700
committerGitHub <noreply@github.com>2024-08-28 09:13:33 -0700
commit95ddd057424b996a0a2a54f282c6c567246d8cc9 (patch)
tree5fb5cf34c779f1cf9cb49208e470d557db91b177 /test/gtest
parente2ceaa58c10e9ee3e9eece42466243f5a8aff125 (diff)
downloadbinaryen-95ddd057424b996a0a2a54f282c6c567246d8cc9.tar.gz
binaryen-95ddd057424b996a0a2a54f282c6c567246d8cc9.tar.bz2
binaryen-95ddd057424b996a0a2a54f282c6c567246d8cc9.zip
[NFC] Refactor LocalGraph's core getSets API (#6877)
Before we just had a map that people would access with localGraph.getSetses[get], while now it is a call localGraph.getSets(get), which more nicely hides the internal implementation details. Also rename getSetses => getSetsMap. This will allow a later PR to optimize the internals of this API. This is performance-neutral as far as I can measure. (We do replace a direct read from a data structure with a call, but the call is in a header and should always get inlined.)
Diffstat (limited to 'test/gtest')
-rw-r--r--test/gtest/cfg.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/gtest/cfg.cpp b/test/gtest/cfg.cpp
index e72341b32..b8d26caa4 100644
--- a/test/gtest/cfg.cpp
+++ b/test/gtest/cfg.cpp
@@ -298,10 +298,10 @@ TEST_F(CFGTest, LinearReachingDefinitions) {
Function* func = wasm.getFunction("bar");
CFG cfg = CFG::fromFunction(func);
- LocalGraph::GetSetses getSetses;
+ LocalGraph::GetSetsMap getSetsMap;
LocalGraph::Locations locations;
ReachingDefinitionsTransferFunction transferFunction(
- func, getSetses, locations);
+ func, getSetsMap, locations);
MonotoneCFGAnalyzer<FinitePowersetLattice<LocalSet*>,
ReachingDefinitionsTransferFunction>
@@ -320,12 +320,12 @@ TEST_F(CFGTest, LinearReachingDefinitions) {
LocalGet* getC = foundGets.list[2];
LocalSet* setA1 = foundSets.list[0];
- LocalGraph::GetSetses expectedResult;
+ LocalGraph::GetSetsMap expectedResult;
expectedResult[getA1].insert(setA1);
expectedResult[getA2].insert(setA1);
expectedResult[getC].insert(nullptr);
- EXPECT_EQ(expectedResult, getSetses);
+ EXPECT_EQ(expectedResult, getSetsMap);
}
TEST_F(CFGTest, ReachingDefinitionsIf) {
@@ -369,10 +369,10 @@ TEST_F(CFGTest, ReachingDefinitionsIf) {
Function* func = wasm.getFunction("bar");
CFG cfg = CFG::fromFunction(func);
- LocalGraph::GetSetses getSetses;
+ LocalGraph::GetSetsMap getSetsMap;
LocalGraph::Locations locations;
ReachingDefinitionsTransferFunction transferFunction(
- func, getSetses, locations);
+ func, getSetsMap, locations);
MonotoneCFGAnalyzer<FinitePowersetLattice<LocalSet*>,
ReachingDefinitionsTransferFunction>
@@ -390,14 +390,14 @@ TEST_F(CFGTest, ReachingDefinitionsIf) {
LocalSet* setB = foundSets.list[1];
LocalSet* setA2 = foundSets.list[2];
- LocalGraph::GetSetses expectedResult;
+ LocalGraph::GetSetsMap expectedResult;
expectedResult[getA1].insert(setA1);
expectedResult[getB].insert(nullptr);
expectedResult[getB].insert(setB);
expectedResult[getA2].insert(setA1);
expectedResult[getA2].insert(setA2);
- EXPECT_EQ(expectedResult, getSetses);
+ EXPECT_EQ(expectedResult, getSetsMap);
}
TEST_F(CFGTest, ReachingDefinitionsLoop) {
@@ -437,10 +437,10 @@ TEST_F(CFGTest, ReachingDefinitionsLoop) {
Function* func = wasm.getFunction("bar");
CFG cfg = CFG::fromFunction(func);
- LocalGraph::GetSetses getSetses;
+ LocalGraph::GetSetsMap getSetsMap;
LocalGraph::Locations locations;
ReachingDefinitionsTransferFunction transferFunction(
- func, getSetses, locations);
+ func, getSetsMap, locations);
MonotoneCFGAnalyzer<FinitePowersetLattice<LocalSet*>,
ReachingDefinitionsTransferFunction>
@@ -458,7 +458,7 @@ TEST_F(CFGTest, ReachingDefinitionsLoop) {
LocalGet* getA4 = foundGets.list[4];
LocalSet* setA = foundSets.list[0];
- LocalGraph::GetSetses expectedResult;
+ LocalGraph::GetSetsMap expectedResult;
expectedResult[getA1].insert(nullptr);
expectedResult[getA1].insert(setA);
expectedResult[getA2].insert(nullptr);
@@ -467,5 +467,5 @@ TEST_F(CFGTest, ReachingDefinitionsLoop) {
expectedResult[getB].insert(nullptr);
expectedResult[getA4].insert(setA);
- EXPECT_EQ(expectedResult, getSetses);
+ EXPECT_EQ(expectedResult, getSetsMap);
}