From ccc07a9579c554443cd03a306ca9b4f943fd2a93 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Tue, 16 Sep 2014 14:48:16 +0100 Subject: Add CFG and SSA form checkers in the optimizing compiler. Checks performed on control-flow graphs: - Ensure that the predecessors and successors of a basic block are consistent within a control-flow graph. - Ensure basic blocks end with a branch instruction. - Detect phi functions listed in non-phi instruction lists and vice versa. - Ensure a block's instructions (and phi functions) are associated with this very block. Checks performed on SSA form graphs: - Ensure an instruction dominates all its uses. - Ensure there are no critical edges. Change-Id: I1c12b4a61ecf608682152c897980ababa7eca847 --- compiler/optimizing/optimizing_unit_test.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'compiler/optimizing/optimizing_unit_test.h') diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index c409529727..1b930ec3df 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -17,6 +17,10 @@ #ifndef ART_COMPILER_OPTIMIZING_OPTIMIZING_UNIT_TEST_H_ #define ART_COMPILER_OPTIMIZING_OPTIMIZING_UNIT_TEST_H_ +#include "nodes.h" +#include "builder.h" +#include "dex_file.h" +#include "dex_instruction.h" #include "ssa_liveness_analysis.h" namespace art { @@ -61,6 +65,15 @@ void RemoveSuspendChecks(HGraph* graph) { } } +// Create a control-flow graph from Dex instructions. +inline HGraph* CreateCFG(ArenaAllocator* allocator, const uint16_t* data) { + HGraphBuilder builder(allocator); + const DexFile::CodeItem* item = + reinterpret_cast(data); + HGraph* graph = builder.BuildGraph(*item); + return graph; +} + } // namespace art #endif // ART_COMPILER_OPTIMIZING_OPTIMIZING_UNIT_TEST_H_ -- cgit v1.2.3-59-g8ed1b