From c2c52a18a210b3c3c2a2a4345019b9d961a29f49 Mon Sep 17 00:00:00 2001 From: Alexandre Rames Date: Tue, 2 Aug 2016 13:45:28 +0100 Subject: [PATCH] Improve the graph visualizer's output for constant locations. Change-Id: I423fb378ee61fb53c3b328fc74f4e95cdef0992a --- compiler/optimizing/graph_visualizer.cc | 6 ++++ .../expected.txt | 0 test/614-checker-dump-constant-location/info.txt | 2 ++ .../src/Main.java | 42 ++++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 test/614-checker-dump-constant-location/expected.txt create mode 100644 test/614-checker-dump-constant-location/info.txt create mode 100644 test/614-checker-dump-constant-location/src/Main.java diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index 0b4c569b0..89d80cc28 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -298,6 +298,12 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { stream << constant->AsIntConstant()->GetValue(); } else if (constant->IsLongConstant()) { stream << constant->AsLongConstant()->GetValue(); + } else if (constant->IsFloatConstant()) { + stream << constant->AsFloatConstant()->GetValue(); + } else if (constant->IsDoubleConstant()) { + stream << constant->AsDoubleConstant()->GetValue(); + } else if (constant->IsNullConstant()) { + stream << "null"; } } else if (location.IsInvalid()) { stream << "invalid"; diff --git a/test/614-checker-dump-constant-location/expected.txt b/test/614-checker-dump-constant-location/expected.txt new file mode 100644 index 000000000..e69de29bb diff --git a/test/614-checker-dump-constant-location/info.txt b/test/614-checker-dump-constant-location/info.txt new file mode 100644 index 000000000..4a94fface --- /dev/null +++ b/test/614-checker-dump-constant-location/info.txt @@ -0,0 +1,2 @@ +Test that the graph visualizer outputs useful information for constant +locations in parallel moves. diff --git a/test/614-checker-dump-constant-location/src/Main.java b/test/614-checker-dump-constant-location/src/Main.java new file mode 100644 index 000000000..f6bc063d8 --- /dev/null +++ b/test/614-checker-dump-constant-location/src/Main.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + + public static int array_int[] = { 0 }; + public static long array_long[] = { 0 }; + public static float array_float[] = { 0.0f }; + public static double array_double[] = { 0.0 }; + + // The code used to print constant locations in parallel moves is architecture + // independent. We only test for ARM and ARM64 as it is easy: 'store' + // instructions only take registers as a source. + + /// CHECK-START-ARM: void Main.store_to_arrays() register (after) + /// CHECK: ParallelMove {{.*#1->.*#2->.*#3\.3->.*#4\.4->.*}} + + /// CHECK-START-ARM64: void Main.store_to_arrays() register (after) + /// CHECK: ParallelMove {{.*#1->.*#2->.*#3\.3->.*#4\.4->.*}} + + public void store_to_arrays() { + array_int[0] = 1; + array_long[0] = 2; + array_float[0] = 3.3f; + array_double[0] = 4.4; + } + + public static void main(String args[]) {} +} -- 2.11.0