diff options
author | 2023-04-25 16:40:06 +0000 | |
---|---|---|
committer | 2023-04-27 10:53:55 +0000 | |
commit | cde6497d286337de2ed21c71c85157e2745b742b (patch) | |
tree | 087d790efb6987f5aab1da7cd91b89bedcdc5725 /compiler/optimizing/register_allocation_resolver.cc | |
parent | 79dc217688a774fc532584f6551a0aec8b45bc4a (diff) |
Optimizing: Add `HInstruction::As##type()`.
After the old implementation was renamed in
https://android-review.googlesource.com/2526708 ,
we introduce a new function with the old name but new
behavior, just `DCHECK()`-ing the instruction kind before
casting down the pointer. We change appropriate calls from
`As##type##OrNull()` to `As##type()` to avoid unncessary
run-time checks and reduce the size of libart-compiler.so.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: run-gtests.sh
Test: testrunner.py --target --optimizing
Bug: 181943478
Change-Id: I025681612a77ca2157fed4886ca47f2053975d4e
Diffstat (limited to 'compiler/optimizing/register_allocation_resolver.cc')
-rw-r--r-- | compiler/optimizing/register_allocation_resolver.cc | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/compiler/optimizing/register_allocation_resolver.cc b/compiler/optimizing/register_allocation_resolver.cc index 969a2733b1..a4b1698b8d 100644 --- a/compiler/optimizing/register_allocation_resolver.cc +++ b/compiler/optimizing/register_allocation_resolver.cc @@ -76,8 +76,7 @@ void RegisterAllocationResolver::Resolve(ArrayRef<HInstruction* const> safepoint } else if (instruction->IsCurrentMethod()) { // The current method is always at offset 0. DCHECK_IMPLIES(current->HasSpillSlot(), (current->GetSpillSlot() == 0)); - // TODO: Remove "OrNull". - } else if (instruction->IsPhi() && instruction->AsPhiOrNull()->IsCatchPhi()) { + } else if (instruction->IsPhi() && instruction->AsPhi()->IsCatchPhi()) { DCHECK(current->HasSpillSlot()); size_t slot = current->GetSpillSlot() + spill_slots @@ -352,8 +351,7 @@ void RegisterAllocationResolver::ConnectSiblings(LiveInterval* interval) { } } else { DCHECK(use.GetUser()->IsInvoke()); - // TODO: Remove "OrNull". - DCHECK(use.GetUser()->AsInvokeOrNull()->GetIntrinsic() != Intrinsics::kNone); + DCHECK(use.GetUser()->AsInvoke()->GetIntrinsic() != Intrinsics::kNone); } } } @@ -540,8 +538,7 @@ void RegisterAllocationResolver::AddInputMoveFor(HInstruction* input, move->SetLifetimePosition(user->GetLifetimePosition()); user->GetBlock()->InsertInstructionBefore(move, user); } else { - // TODO: Remove "OrNull". - move = previous->AsParallelMoveOrNull(); + move = previous->AsParallelMove(); } DCHECK_EQ(move->GetLifetimePosition(), user->GetLifetimePosition()); AddMove(move, source, destination, nullptr, input->GetType()); @@ -590,8 +587,7 @@ void RegisterAllocationResolver::InsertParallelMoveAt(size_t position, at->GetBlock()->InsertInstructionBefore(move, at); } else { DCHECK(at->IsParallelMove()); - // TODO: Remove "OrNull". - move = at->AsParallelMoveOrNull(); + move = at->AsParallelMove(); } } } else if (IsInstructionEnd(position)) { @@ -621,8 +617,7 @@ void RegisterAllocationResolver::InsertParallelMoveAt(size_t position, move->SetLifetimePosition(position); at->GetBlock()->InsertInstructionBefore(move, at); } else { - // TODO: Remove "OrNull". - move = previous->AsParallelMoveOrNull(); + move = previous->AsParallelMove(); } } DCHECK_EQ(move->GetLifetimePosition(), position); @@ -650,14 +645,12 @@ void RegisterAllocationResolver::InsertParallelMoveAtExitOf(HBasicBlock* block, size_t position = last->GetLifetimePosition(); if (previous == nullptr || !previous->IsParallelMove() || - // TODO: Remove "OrNull". - previous->AsParallelMoveOrNull()->GetLifetimePosition() != position) { + previous->AsParallelMove()->GetLifetimePosition() != position) { move = new (allocator_) HParallelMove(allocator_); move->SetLifetimePosition(position); block->InsertInstructionBefore(move, last); } else { - // TODO: Remove "OrNull". - move = previous->AsParallelMoveOrNull(); + move = previous->AsParallelMove(); } AddMove(move, source, destination, instruction, instruction->GetType()); } |