summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_visualizer.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2023-04-25 16:40:06 +0000
committer Vladimir Marko <vmarko@google.com> 2023-04-27 10:53:55 +0000
commitcde6497d286337de2ed21c71c85157e2745b742b (patch)
tree087d790efb6987f5aab1da7cd91b89bedcdc5725 /compiler/optimizing/graph_visualizer.cc
parent79dc217688a774fc532584f6551a0aec8b45bc4a (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/graph_visualizer.cc')
-rw-r--r--compiler/optimizing/graph_visualizer.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index a264968b10..73bdd1e223 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -323,17 +323,13 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
stream << "#";
HConstant* constant = location.GetConstant();
if (constant->IsIntConstant()) {
- // TODO: Remove "OrNull".
- stream << constant->AsIntConstantOrNull()->GetValue();
+ stream << constant->AsIntConstant()->GetValue();
} else if (constant->IsLongConstant()) {
- // TODO: Remove "OrNull".
- stream << constant->AsLongConstantOrNull()->GetValue();
+ stream << constant->AsLongConstant()->GetValue();
} else if (constant->IsFloatConstant()) {
- // TODO: Remove "OrNull".
- stream << constant->AsFloatConstantOrNull()->GetValue();
+ stream << constant->AsFloatConstant()->GetValue();
} else if (constant->IsDoubleConstant()) {
- // TODO: Remove "OrNull".
- stream << constant->AsDoubleConstantOrNull()->GetValue();
+ stream << constant->AsDoubleConstant()->GetValue();
} else if (constant->IsNullConstant()) {
stream << "null";
}
@@ -629,8 +625,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
void VisitVecDotProd(HVecDotProd* instruction) override {
VisitVecOperation(instruction);
- // TODO: Remove "OrNull".
- DataType::Type arg_type = instruction->InputAt(1)->AsVecOperationOrNull()->GetPackedType();
+ DataType::Type arg_type = instruction->InputAt(1)->AsVecOperation()->GetPackedType();
StartAttributeStream("type") << (instruction->IsZeroExtending() ?
DataType::ToUnsigned(arg_type) :
DataType::ToSigned(arg_type));
@@ -752,14 +747,13 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
&& (instruction->GetType() == DataType::Type::kReference ||
instruction->IsInstanceOf() ||
instruction->IsCheckCast())) {
- // TODO: Remove "OrNull".
ReferenceTypeInfo info = (instruction->GetType() == DataType::Type::kReference)
? instruction->IsLoadClass()
- ? instruction->AsLoadClassOrNull()->GetLoadedClassRTI()
+ ? instruction->AsLoadClass()->GetLoadedClassRTI()
: instruction->GetReferenceTypeInfo()
: instruction->IsInstanceOf()
- ? instruction->AsInstanceOfOrNull()->GetTargetClassRTI()
- : instruction->AsCheckCastOrNull()->GetTargetClassRTI();
+ ? instruction->AsInstanceOf()->GetTargetClassRTI()
+ : instruction->AsCheckCast()->GetTargetClassRTI();
ScopedObjectAccess soa(Thread::Current());
if (info.IsValid()) {
StartAttributeStream("klass")