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/common_arm.h | |
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/common_arm.h')
-rw-r--r-- | compiler/optimizing/common_arm.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/compiler/optimizing/common_arm.h b/compiler/optimizing/common_arm.h index 53768efad6..5f71cb906c 100644 --- a/compiler/optimizing/common_arm.h +++ b/compiler/optimizing/common_arm.h @@ -155,14 +155,12 @@ inline vixl::aarch32::DRegister DRegisterFromS(vixl::aarch32::SRegister s) { inline int32_t Int32ConstantFrom(HInstruction* instr) { if (instr->IsIntConstant()) { - // TODO: Remove "OrNull". - return instr->AsIntConstantOrNull()->GetValue(); + return instr->AsIntConstant()->GetValue(); } else if (instr->IsNullConstant()) { return 0; } else { DCHECK(instr->IsLongConstant()) << instr->DebugName(); - // TODO: Remove "OrNull". - const int64_t ret = instr->AsLongConstantOrNull()->GetValue(); + const int64_t ret = instr->AsLongConstant()->GetValue(); DCHECK_GE(ret, std::numeric_limits<int32_t>::min()); DCHECK_LE(ret, std::numeric_limits<int32_t>::max()); return ret; @@ -176,21 +174,18 @@ inline int32_t Int32ConstantFrom(Location location) { inline int64_t Int64ConstantFrom(Location location) { HConstant* instr = location.GetConstant(); if (instr->IsIntConstant()) { - // TODO: Remove "OrNull". - return instr->AsIntConstantOrNull()->GetValue(); + return instr->AsIntConstant()->GetValue(); } else if (instr->IsNullConstant()) { return 0; } else { DCHECK(instr->IsLongConstant()) << instr->DebugName(); - // TODO: Remove "OrNull". - return instr->AsLongConstantOrNull()->GetValue(); + return instr->AsLongConstant()->GetValue(); } } inline uint64_t Uint64ConstantFrom(HInstruction* instr) { DCHECK(instr->IsConstant()) << instr->DebugName(); - // TODO: Remove "OrNull". - return instr->AsConstantOrNull()->GetValueAsUint64(); + return instr->AsConstant()->GetValueAsUint64(); } inline vixl::aarch32::Operand OperandFrom(Location location, DataType::Type type) { |