Introduce a SideEffectsAnalysis class.
LICM also needs the side effects information of loops, so move
the GVN::ComputeSideEffects method into its own analysis class.
Change-Id: I810c8230a0eb6b9b536e8f808e17a3a4ad72f7db
diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h
index fde65e7..b848429 100644
--- a/compiler/utils/growable_array.h
+++ b/compiler/utils/growable_array.h
@@ -37,6 +37,18 @@
kArenaAllocGrowableArray));
}
+ GrowableArray(ArenaAllocator* arena, size_t init_length, T initial_data)
+ : arena_(arena),
+ num_allocated_(init_length),
+ num_used_(0) {
+ SetSize(init_length);
+ elem_list_ = static_cast<T*>(arena_->Alloc(sizeof(T) * init_length,
+ kArenaAllocGrowableArray));
+ for (size_t i = 0; i < init_length; ++i) {
+ elem_list_[i] = initial_data;
+ }
+ }
+
// Expand the list size to at least new length.
void Resize(size_t new_length) {