summaryrefslogtreecommitdiff
path: root/compiler/optimizing/side_effects_analysis.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-09-17 17:03:26 +0100
committerVladimir Marko <vmarko@google.com>2015-09-25 12:18:02 +0100
commit2aaa4b5532d30c4e65d8892b556400bb61f9dc8c (patch)
treef4259c33171ec8efd945aeedab1e57feb7970f42 /compiler/optimizing/side_effects_analysis.cc
parent3f4b39dec9ec6b8948ed18b9d65ba49db2465004 (diff)
Optimizing: Tag more arena allocations.
Replace GrowableArray with ArenaVector and tag arena allocations with new allocation types. As part of this, make the register allocator a bit more efficient, doing bulk insert/erase. Some loops are now O(n) instead of O(n^2). Change-Id: Ifac0871ffb34b121cc0447801a2d07eefd308c14
Diffstat (limited to 'compiler/optimizing/side_effects_analysis.cc')
-rw-r--r--compiler/optimizing/side_effects_analysis.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/optimizing/side_effects_analysis.cc b/compiler/optimizing/side_effects_analysis.cc
index 1956781b79..338a3aaad0 100644
--- a/compiler/optimizing/side_effects_analysis.cc
+++ b/compiler/optimizing/side_effects_analysis.cc
@@ -21,8 +21,8 @@ namespace art {
void SideEffectsAnalysis::Run() {
// Inlining might have created more blocks, so we need to increase the size
// if needed.
- block_effects_.SetSize(graph_->GetBlocks().size());
- loop_effects_.SetSize(graph_->GetBlocks().size());
+ block_effects_.resize(graph_->GetBlocks().size());
+ loop_effects_.resize(graph_->GetBlocks().size());
// In DEBUG mode, ensure side effects are properly initialized to empty.
if (kIsDebugBuild) {
@@ -54,7 +54,7 @@ void SideEffectsAnalysis::Run() {
}
}
- block_effects_.Put(block->GetBlockId(), effects);
+ block_effects_[block->GetBlockId()] = effects;
if (block->IsLoopHeader()) {
// The side effects of the loop header are part of the loop.
@@ -76,16 +76,19 @@ void SideEffectsAnalysis::Run() {
SideEffects SideEffectsAnalysis::GetLoopEffects(HBasicBlock* block) const {
DCHECK(block->IsLoopHeader());
- return loop_effects_.Get(block->GetBlockId());
+ DCHECK_LT(block->GetBlockId(), loop_effects_.size());
+ return loop_effects_[block->GetBlockId()];
}
SideEffects SideEffectsAnalysis::GetBlockEffects(HBasicBlock* block) const {
- return block_effects_.Get(block->GetBlockId());
+ DCHECK_LT(block->GetBlockId(), block_effects_.size());
+ return block_effects_[block->GetBlockId()];
}
void SideEffectsAnalysis::UpdateLoopEffects(HLoopInformation* info, SideEffects effects) {
- int id = info->GetHeader()->GetBlockId();
- loop_effects_.Put(id, loop_effects_.Get(id).Union(effects));
+ uint32_t id = info->GetHeader()->GetBlockId();
+ DCHECK_LT(id, loop_effects_.size());
+ loop_effects_[id] = loop_effects_[id].Union(effects);
}
} // namespace art