diff options
author | Roland Levillain <rpl@google.com> | 2014-09-15 18:29:00 +0100 |
---|---|---|
committer | Roland Levillain <rpl@google.com> | 2014-09-17 18:23:21 +0100 |
commit | 72bceff11a98cc1ecdb64a6fae16c521f99ec6a7 (patch) | |
tree | d326cc4fd32315735466efbb17ea22adf121395c /compiler/optimizing/optimizing_unit_test.h | |
parent | ccc07a9579c554443cd03a306ca9b4f943fd2a93 (diff) | |
download | art-72bceff11a98cc1ecdb64a6fae16c521f99ec6a7.zip art-72bceff11a98cc1ecdb64a6fae16c521f99ec6a7.tar.gz art-72bceff11a98cc1ecdb64a6fae16c521f99ec6a7.tar.bz2 |
Initiate a dead code elimination pass in the optimizing compiler.
Change-Id: Ie9db5d8e2c2c30e34145a0f7d2386b8ec58cfc4e
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r-- | compiler/optimizing/optimizing_unit_test.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index 1b930ec..6dd53e5 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -23,6 +23,8 @@ #include "dex_instruction.h" #include "ssa_liveness_analysis.h" +#include "gtest/gtest.h" + namespace art { #define NUM_INSTRUCTIONS(...) \ @@ -74,6 +76,24 @@ inline HGraph* CreateCFG(ArenaAllocator* allocator, const uint16_t* data) { return graph; } +// Naive string diff data type. +typedef std::list<std::pair<std::string, std::string>> diff_t; + +// An alias for the empty string used to make it clear that a line is +// removed in a diff. +static const std::string removed = ""; + +// Naive patch command: apply a diff to a string. +inline std::string Patch(const std::string& original, const diff_t& diff) { + std::string result = original; + for (const auto& p : diff) { + std::string::size_type pos = result.find(p.first); + EXPECT_NE(pos, std::string::npos); + result.replace(pos, p.first.size(), p.second); + } + return result; +} + } // namespace art #endif // ART_COMPILER_OPTIMIZING_OPTIMIZING_UNIT_TEST_H_ |