1*795d594fSAndroid Build Coastguard Worker /*
2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2014 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker *
4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker *
8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker *
10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker * limitations under the License.
15*795d594fSAndroid Build Coastguard Worker */
16*795d594fSAndroid Build Coastguard Worker
17*795d594fSAndroid Build Coastguard Worker #include "graph_visualizer.h"
18*795d594fSAndroid Build Coastguard Worker
19*795d594fSAndroid Build Coastguard Worker #include <dlfcn.h>
20*795d594fSAndroid Build Coastguard Worker
21*795d594fSAndroid Build Coastguard Worker #include <cctype>
22*795d594fSAndroid Build Coastguard Worker #include <ios>
23*795d594fSAndroid Build Coastguard Worker #include <sstream>
24*795d594fSAndroid Build Coastguard Worker
25*795d594fSAndroid Build Coastguard Worker #include "android-base/stringprintf.h"
26*795d594fSAndroid Build Coastguard Worker #include "art_method.h"
27*795d594fSAndroid Build Coastguard Worker #include "art_method-inl.h"
28*795d594fSAndroid Build Coastguard Worker #include "base/intrusive_forward_list.h"
29*795d594fSAndroid Build Coastguard Worker #include "bounds_check_elimination.h"
30*795d594fSAndroid Build Coastguard Worker #include "builder.h"
31*795d594fSAndroid Build Coastguard Worker #include "code_generator.h"
32*795d594fSAndroid Build Coastguard Worker #include "data_type-inl.h"
33*795d594fSAndroid Build Coastguard Worker #include "dead_code_elimination.h"
34*795d594fSAndroid Build Coastguard Worker #include "dex/descriptors_names.h"
35*795d594fSAndroid Build Coastguard Worker #include "disassembler.h"
36*795d594fSAndroid Build Coastguard Worker #include "inliner.h"
37*795d594fSAndroid Build Coastguard Worker #include "licm.h"
38*795d594fSAndroid Build Coastguard Worker #include "nodes.h"
39*795d594fSAndroid Build Coastguard Worker #include "optimization.h"
40*795d594fSAndroid Build Coastguard Worker #include "reference_type_propagation.h"
41*795d594fSAndroid Build Coastguard Worker #include "register_allocator_linear_scan.h"
42*795d594fSAndroid Build Coastguard Worker #include "scoped_thread_state_change-inl.h"
43*795d594fSAndroid Build Coastguard Worker #include "ssa_liveness_analysis.h"
44*795d594fSAndroid Build Coastguard Worker #include "utils/assembler.h"
45*795d594fSAndroid Build Coastguard Worker
46*795d594fSAndroid Build Coastguard Worker namespace art HIDDEN {
47*795d594fSAndroid Build Coastguard Worker
48*795d594fSAndroid Build Coastguard Worker // Unique pass-name to identify that the dump is for printing to log.
49*795d594fSAndroid Build Coastguard Worker constexpr const char* kDebugDumpName = "debug";
50*795d594fSAndroid Build Coastguard Worker constexpr const char* kDebugDumpGraphName = "debug_graph";
51*795d594fSAndroid Build Coastguard Worker
52*795d594fSAndroid Build Coastguard Worker using android::base::StringPrintf;
53*795d594fSAndroid Build Coastguard Worker
HasWhitespace(const char * str)54*795d594fSAndroid Build Coastguard Worker static bool HasWhitespace(const char* str) {
55*795d594fSAndroid Build Coastguard Worker DCHECK(str != nullptr);
56*795d594fSAndroid Build Coastguard Worker while (str[0] != 0) {
57*795d594fSAndroid Build Coastguard Worker if (isspace(str[0])) {
58*795d594fSAndroid Build Coastguard Worker return true;
59*795d594fSAndroid Build Coastguard Worker }
60*795d594fSAndroid Build Coastguard Worker str++;
61*795d594fSAndroid Build Coastguard Worker }
62*795d594fSAndroid Build Coastguard Worker return false;
63*795d594fSAndroid Build Coastguard Worker }
64*795d594fSAndroid Build Coastguard Worker
65*795d594fSAndroid Build Coastguard Worker class StringList {
66*795d594fSAndroid Build Coastguard Worker public:
67*795d594fSAndroid Build Coastguard Worker enum Format {
68*795d594fSAndroid Build Coastguard Worker kArrayBrackets,
69*795d594fSAndroid Build Coastguard Worker kSetBrackets,
70*795d594fSAndroid Build Coastguard Worker };
71*795d594fSAndroid Build Coastguard Worker
72*795d594fSAndroid Build Coastguard Worker // Create an empty list
StringList(Format format=kArrayBrackets)73*795d594fSAndroid Build Coastguard Worker explicit StringList(Format format = kArrayBrackets) : format_(format), is_empty_(true) {}
74*795d594fSAndroid Build Coastguard Worker
75*795d594fSAndroid Build Coastguard Worker // Construct StringList from a linked list. List element class T
76*795d594fSAndroid Build Coastguard Worker // must provide methods `GetNext` and `Dump`.
77*795d594fSAndroid Build Coastguard Worker template<class T>
StringList(T * first_entry,Format format=kArrayBrackets)78*795d594fSAndroid Build Coastguard Worker explicit StringList(T* first_entry, Format format = kArrayBrackets) : StringList(format) {
79*795d594fSAndroid Build Coastguard Worker for (T* current = first_entry; current != nullptr; current = current->GetNext()) {
80*795d594fSAndroid Build Coastguard Worker current->Dump(NewEntryStream());
81*795d594fSAndroid Build Coastguard Worker }
82*795d594fSAndroid Build Coastguard Worker }
83*795d594fSAndroid Build Coastguard Worker // Construct StringList from a list of elements. The value type must provide method `Dump`.
84*795d594fSAndroid Build Coastguard Worker template <typename Container>
StringList(const Container & list,Format format=kArrayBrackets)85*795d594fSAndroid Build Coastguard Worker explicit StringList(const Container& list, Format format = kArrayBrackets) : StringList(format) {
86*795d594fSAndroid Build Coastguard Worker for (const typename Container::value_type& current : list) {
87*795d594fSAndroid Build Coastguard Worker current.Dump(NewEntryStream());
88*795d594fSAndroid Build Coastguard Worker }
89*795d594fSAndroid Build Coastguard Worker }
90*795d594fSAndroid Build Coastguard Worker
NewEntryStream()91*795d594fSAndroid Build Coastguard Worker std::ostream& NewEntryStream() {
92*795d594fSAndroid Build Coastguard Worker if (is_empty_) {
93*795d594fSAndroid Build Coastguard Worker is_empty_ = false;
94*795d594fSAndroid Build Coastguard Worker } else {
95*795d594fSAndroid Build Coastguard Worker sstream_ << ",";
96*795d594fSAndroid Build Coastguard Worker }
97*795d594fSAndroid Build Coastguard Worker return sstream_;
98*795d594fSAndroid Build Coastguard Worker }
99*795d594fSAndroid Build Coastguard Worker
100*795d594fSAndroid Build Coastguard Worker private:
101*795d594fSAndroid Build Coastguard Worker Format format_;
102*795d594fSAndroid Build Coastguard Worker bool is_empty_;
103*795d594fSAndroid Build Coastguard Worker std::ostringstream sstream_;
104*795d594fSAndroid Build Coastguard Worker
105*795d594fSAndroid Build Coastguard Worker friend std::ostream& operator<<(std::ostream& os, const StringList& list);
106*795d594fSAndroid Build Coastguard Worker };
107*795d594fSAndroid Build Coastguard Worker
operator <<(std::ostream & os,const StringList & list)108*795d594fSAndroid Build Coastguard Worker std::ostream& operator<<(std::ostream& os, const StringList& list) {
109*795d594fSAndroid Build Coastguard Worker switch (list.format_) {
110*795d594fSAndroid Build Coastguard Worker case StringList::kArrayBrackets: return os << "[" << list.sstream_.str() << "]";
111*795d594fSAndroid Build Coastguard Worker case StringList::kSetBrackets: return os << "{" << list.sstream_.str() << "}";
112*795d594fSAndroid Build Coastguard Worker }
113*795d594fSAndroid Build Coastguard Worker }
114*795d594fSAndroid Build Coastguard Worker
115*795d594fSAndroid Build Coastguard Worker // On target: load `libart-disassembler` only when required (to save on memory).
116*795d594fSAndroid Build Coastguard Worker // On host: `libart-disassembler` should be linked directly (either as a static or dynamic lib)
117*795d594fSAndroid Build Coastguard Worker #ifdef ART_TARGET
118*795d594fSAndroid Build Coastguard Worker using create_disasm_prototype = Disassembler*(InstructionSet, DisassemblerOptions*);
119*795d594fSAndroid Build Coastguard Worker #endif
120*795d594fSAndroid Build Coastguard Worker
121*795d594fSAndroid Build Coastguard Worker class HGraphVisualizerDisassembler {
122*795d594fSAndroid Build Coastguard Worker public:
HGraphVisualizerDisassembler(InstructionSet instruction_set,const uint8_t * base_address,const uint8_t * end_address)123*795d594fSAndroid Build Coastguard Worker HGraphVisualizerDisassembler(InstructionSet instruction_set,
124*795d594fSAndroid Build Coastguard Worker const uint8_t* base_address,
125*795d594fSAndroid Build Coastguard Worker const uint8_t* end_address)
126*795d594fSAndroid Build Coastguard Worker : instruction_set_(instruction_set), disassembler_(nullptr) {
127*795d594fSAndroid Build Coastguard Worker #ifdef ART_TARGET
128*795d594fSAndroid Build Coastguard Worker constexpr const char* libart_disassembler_so_name =
129*795d594fSAndroid Build Coastguard Worker kIsDebugBuild ? "libartd-disassembler.so" : "libart-disassembler.so";
130*795d594fSAndroid Build Coastguard Worker libart_disassembler_handle_ = dlopen(libart_disassembler_so_name, RTLD_NOW);
131*795d594fSAndroid Build Coastguard Worker if (libart_disassembler_handle_ == nullptr) {
132*795d594fSAndroid Build Coastguard Worker LOG(ERROR) << "Failed to dlopen " << libart_disassembler_so_name << ": " << dlerror();
133*795d594fSAndroid Build Coastguard Worker return;
134*795d594fSAndroid Build Coastguard Worker }
135*795d594fSAndroid Build Coastguard Worker constexpr const char* create_disassembler_symbol = "create_disassembler";
136*795d594fSAndroid Build Coastguard Worker create_disasm_prototype* create_disassembler = reinterpret_cast<create_disasm_prototype*>(
137*795d594fSAndroid Build Coastguard Worker dlsym(libart_disassembler_handle_, create_disassembler_symbol));
138*795d594fSAndroid Build Coastguard Worker if (create_disassembler == nullptr) {
139*795d594fSAndroid Build Coastguard Worker LOG(ERROR) << "Could not find " << create_disassembler_symbol << " entry in "
140*795d594fSAndroid Build Coastguard Worker << libart_disassembler_so_name << ": " << dlerror();
141*795d594fSAndroid Build Coastguard Worker return;
142*795d594fSAndroid Build Coastguard Worker }
143*795d594fSAndroid Build Coastguard Worker #endif
144*795d594fSAndroid Build Coastguard Worker // Reading the disassembly from 0x0 is easier, so we print relative
145*795d594fSAndroid Build Coastguard Worker // addresses. We will only disassemble the code once everything has
146*795d594fSAndroid Build Coastguard Worker // been generated, so we can read data in literal pools.
147*795d594fSAndroid Build Coastguard Worker disassembler_ = std::unique_ptr<Disassembler>(create_disassembler(
148*795d594fSAndroid Build Coastguard Worker instruction_set,
149*795d594fSAndroid Build Coastguard Worker new DisassemblerOptions(/* absolute_addresses= */ false,
150*795d594fSAndroid Build Coastguard Worker base_address,
151*795d594fSAndroid Build Coastguard Worker end_address,
152*795d594fSAndroid Build Coastguard Worker /* can_read_literals= */ true,
153*795d594fSAndroid Build Coastguard Worker Is64BitInstructionSet(instruction_set)
154*795d594fSAndroid Build Coastguard Worker ? &Thread::DumpThreadOffset<PointerSize::k64>
155*795d594fSAndroid Build Coastguard Worker : &Thread::DumpThreadOffset<PointerSize::k32>)));
156*795d594fSAndroid Build Coastguard Worker }
157*795d594fSAndroid Build Coastguard Worker
~HGraphVisualizerDisassembler()158*795d594fSAndroid Build Coastguard Worker ~HGraphVisualizerDisassembler() {
159*795d594fSAndroid Build Coastguard Worker // We need to call ~Disassembler() before we close the library.
160*795d594fSAndroid Build Coastguard Worker disassembler_.reset();
161*795d594fSAndroid Build Coastguard Worker #ifdef ART_TARGET
162*795d594fSAndroid Build Coastguard Worker if (libart_disassembler_handle_ != nullptr) {
163*795d594fSAndroid Build Coastguard Worker dlclose(libart_disassembler_handle_);
164*795d594fSAndroid Build Coastguard Worker }
165*795d594fSAndroid Build Coastguard Worker #endif
166*795d594fSAndroid Build Coastguard Worker }
167*795d594fSAndroid Build Coastguard Worker
Disassemble(std::ostream & output,size_t start,size_t end) const168*795d594fSAndroid Build Coastguard Worker void Disassemble(std::ostream& output, size_t start, size_t end) const {
169*795d594fSAndroid Build Coastguard Worker if (disassembler_ == nullptr) {
170*795d594fSAndroid Build Coastguard Worker return;
171*795d594fSAndroid Build Coastguard Worker }
172*795d594fSAndroid Build Coastguard Worker
173*795d594fSAndroid Build Coastguard Worker const uint8_t* base = disassembler_->GetDisassemblerOptions()->base_address_;
174*795d594fSAndroid Build Coastguard Worker if (instruction_set_ == InstructionSet::kThumb2) {
175*795d594fSAndroid Build Coastguard Worker // ARM and Thumb-2 use the same disassembler. The bottom bit of the
176*795d594fSAndroid Build Coastguard Worker // address is used to distinguish between the two.
177*795d594fSAndroid Build Coastguard Worker base += 1;
178*795d594fSAndroid Build Coastguard Worker }
179*795d594fSAndroid Build Coastguard Worker disassembler_->Dump(output, base + start, base + end);
180*795d594fSAndroid Build Coastguard Worker }
181*795d594fSAndroid Build Coastguard Worker
182*795d594fSAndroid Build Coastguard Worker private:
183*795d594fSAndroid Build Coastguard Worker InstructionSet instruction_set_;
184*795d594fSAndroid Build Coastguard Worker std::unique_ptr<Disassembler> disassembler_;
185*795d594fSAndroid Build Coastguard Worker
186*795d594fSAndroid Build Coastguard Worker #ifdef ART_TARGET
187*795d594fSAndroid Build Coastguard Worker void* libart_disassembler_handle_;
188*795d594fSAndroid Build Coastguard Worker #endif
189*795d594fSAndroid Build Coastguard Worker };
190*795d594fSAndroid Build Coastguard Worker
191*795d594fSAndroid Build Coastguard Worker
192*795d594fSAndroid Build Coastguard Worker /**
193*795d594fSAndroid Build Coastguard Worker * HGraph visitor to generate a file suitable for the c1visualizer tool and IRHydra.
194*795d594fSAndroid Build Coastguard Worker */
195*795d594fSAndroid Build Coastguard Worker class HGraphVisualizerPrinter final : public HGraphDelegateVisitor {
196*795d594fSAndroid Build Coastguard Worker public:
HGraphVisualizerPrinter(HGraph * graph,std::ostream & output,const char * pass_name,bool is_after_pass,bool graph_in_bad_state,const CodeGenerator * codegen,const BlockNamer & namer,const DisassemblyInformation * disasm_info=nullptr)197*795d594fSAndroid Build Coastguard Worker HGraphVisualizerPrinter(HGraph* graph,
198*795d594fSAndroid Build Coastguard Worker std::ostream& output,
199*795d594fSAndroid Build Coastguard Worker const char* pass_name,
200*795d594fSAndroid Build Coastguard Worker bool is_after_pass,
201*795d594fSAndroid Build Coastguard Worker bool graph_in_bad_state,
202*795d594fSAndroid Build Coastguard Worker const CodeGenerator* codegen,
203*795d594fSAndroid Build Coastguard Worker const BlockNamer& namer,
204*795d594fSAndroid Build Coastguard Worker const DisassemblyInformation* disasm_info = nullptr)
205*795d594fSAndroid Build Coastguard Worker : HGraphDelegateVisitor(graph),
206*795d594fSAndroid Build Coastguard Worker output_(output),
207*795d594fSAndroid Build Coastguard Worker pass_name_(pass_name),
208*795d594fSAndroid Build Coastguard Worker is_after_pass_(is_after_pass),
209*795d594fSAndroid Build Coastguard Worker graph_in_bad_state_(graph_in_bad_state),
210*795d594fSAndroid Build Coastguard Worker codegen_(codegen),
211*795d594fSAndroid Build Coastguard Worker disasm_info_(disasm_info),
212*795d594fSAndroid Build Coastguard Worker namer_(namer),
213*795d594fSAndroid Build Coastguard Worker disassembler_(disasm_info_ != nullptr
214*795d594fSAndroid Build Coastguard Worker ? new HGraphVisualizerDisassembler(
215*795d594fSAndroid Build Coastguard Worker codegen_->GetInstructionSet(),
216*795d594fSAndroid Build Coastguard Worker codegen_->GetAssembler().CodeBufferBaseAddress(),
217*795d594fSAndroid Build Coastguard Worker codegen_->GetAssembler().CodeBufferBaseAddress()
218*795d594fSAndroid Build Coastguard Worker + codegen_->GetAssembler().CodeSize())
219*795d594fSAndroid Build Coastguard Worker : nullptr),
220*795d594fSAndroid Build Coastguard Worker indent_(0) {}
221*795d594fSAndroid Build Coastguard Worker
Flush()222*795d594fSAndroid Build Coastguard Worker void Flush() {
223*795d594fSAndroid Build Coastguard Worker // We use "\n" instead of std::endl to avoid implicit flushing which
224*795d594fSAndroid Build Coastguard Worker // generates too many syscalls during debug-GC tests (b/27826765).
225*795d594fSAndroid Build Coastguard Worker output_ << std::flush;
226*795d594fSAndroid Build Coastguard Worker }
227*795d594fSAndroid Build Coastguard Worker
StartTag(const char * name)228*795d594fSAndroid Build Coastguard Worker void StartTag(const char* name) {
229*795d594fSAndroid Build Coastguard Worker AddIndent();
230*795d594fSAndroid Build Coastguard Worker output_ << "begin_" << name << "\n";
231*795d594fSAndroid Build Coastguard Worker indent_++;
232*795d594fSAndroid Build Coastguard Worker }
233*795d594fSAndroid Build Coastguard Worker
EndTag(const char * name)234*795d594fSAndroid Build Coastguard Worker void EndTag(const char* name) {
235*795d594fSAndroid Build Coastguard Worker indent_--;
236*795d594fSAndroid Build Coastguard Worker AddIndent();
237*795d594fSAndroid Build Coastguard Worker output_ << "end_" << name << "\n";
238*795d594fSAndroid Build Coastguard Worker }
239*795d594fSAndroid Build Coastguard Worker
PrintProperty(const char * name,HBasicBlock * blk)240*795d594fSAndroid Build Coastguard Worker void PrintProperty(const char* name, HBasicBlock* blk) {
241*795d594fSAndroid Build Coastguard Worker AddIndent();
242*795d594fSAndroid Build Coastguard Worker output_ << name << " \"" << namer_.GetName(blk) << "\"\n";
243*795d594fSAndroid Build Coastguard Worker }
244*795d594fSAndroid Build Coastguard Worker
PrintProperty(const char * name,const char * property)245*795d594fSAndroid Build Coastguard Worker void PrintProperty(const char* name, const char* property) {
246*795d594fSAndroid Build Coastguard Worker AddIndent();
247*795d594fSAndroid Build Coastguard Worker output_ << name << " \"" << property << "\"\n";
248*795d594fSAndroid Build Coastguard Worker }
249*795d594fSAndroid Build Coastguard Worker
PrintProperty(const char * name,const char * property,int id)250*795d594fSAndroid Build Coastguard Worker void PrintProperty(const char* name, const char* property, int id) {
251*795d594fSAndroid Build Coastguard Worker AddIndent();
252*795d594fSAndroid Build Coastguard Worker output_ << name << " \"" << property << id << "\"\n";
253*795d594fSAndroid Build Coastguard Worker }
254*795d594fSAndroid Build Coastguard Worker
PrintEmptyProperty(const char * name)255*795d594fSAndroid Build Coastguard Worker void PrintEmptyProperty(const char* name) {
256*795d594fSAndroid Build Coastguard Worker AddIndent();
257*795d594fSAndroid Build Coastguard Worker output_ << name << "\n";
258*795d594fSAndroid Build Coastguard Worker }
259*795d594fSAndroid Build Coastguard Worker
PrintTime(const char * name)260*795d594fSAndroid Build Coastguard Worker void PrintTime(const char* name) {
261*795d594fSAndroid Build Coastguard Worker AddIndent();
262*795d594fSAndroid Build Coastguard Worker output_ << name << " " << time(nullptr) << "\n";
263*795d594fSAndroid Build Coastguard Worker }
264*795d594fSAndroid Build Coastguard Worker
PrintInt(const char * name,int value)265*795d594fSAndroid Build Coastguard Worker void PrintInt(const char* name, int value) {
266*795d594fSAndroid Build Coastguard Worker AddIndent();
267*795d594fSAndroid Build Coastguard Worker output_ << name << " " << value << "\n";
268*795d594fSAndroid Build Coastguard Worker }
269*795d594fSAndroid Build Coastguard Worker
AddIndent()270*795d594fSAndroid Build Coastguard Worker void AddIndent() {
271*795d594fSAndroid Build Coastguard Worker for (size_t i = 0; i < indent_; ++i) {
272*795d594fSAndroid Build Coastguard Worker output_ << " ";
273*795d594fSAndroid Build Coastguard Worker }
274*795d594fSAndroid Build Coastguard Worker }
275*795d594fSAndroid Build Coastguard Worker
PrintPredecessors(HBasicBlock * block)276*795d594fSAndroid Build Coastguard Worker void PrintPredecessors(HBasicBlock* block) {
277*795d594fSAndroid Build Coastguard Worker AddIndent();
278*795d594fSAndroid Build Coastguard Worker output_ << "predecessors";
279*795d594fSAndroid Build Coastguard Worker for (HBasicBlock* predecessor : block->GetPredecessors()) {
280*795d594fSAndroid Build Coastguard Worker output_ << " \"" << namer_.GetName(predecessor) << "\" ";
281*795d594fSAndroid Build Coastguard Worker }
282*795d594fSAndroid Build Coastguard Worker if (block->IsEntryBlock() && (disasm_info_ != nullptr)) {
283*795d594fSAndroid Build Coastguard Worker output_ << " \"" << kDisassemblyBlockFrameEntry << "\" ";
284*795d594fSAndroid Build Coastguard Worker }
285*795d594fSAndroid Build Coastguard Worker output_<< "\n";
286*795d594fSAndroid Build Coastguard Worker }
287*795d594fSAndroid Build Coastguard Worker
PrintSuccessors(HBasicBlock * block)288*795d594fSAndroid Build Coastguard Worker void PrintSuccessors(HBasicBlock* block) {
289*795d594fSAndroid Build Coastguard Worker AddIndent();
290*795d594fSAndroid Build Coastguard Worker output_ << "successors";
291*795d594fSAndroid Build Coastguard Worker for (HBasicBlock* successor : block->GetNormalSuccessors()) {
292*795d594fSAndroid Build Coastguard Worker output_ << " \"" << namer_.GetName(successor) << "\" ";
293*795d594fSAndroid Build Coastguard Worker }
294*795d594fSAndroid Build Coastguard Worker output_<< "\n";
295*795d594fSAndroid Build Coastguard Worker }
296*795d594fSAndroid Build Coastguard Worker
PrintExceptionHandlers(HBasicBlock * block)297*795d594fSAndroid Build Coastguard Worker void PrintExceptionHandlers(HBasicBlock* block) {
298*795d594fSAndroid Build Coastguard Worker bool has_slow_paths = block->IsExitBlock() &&
299*795d594fSAndroid Build Coastguard Worker (disasm_info_ != nullptr) &&
300*795d594fSAndroid Build Coastguard Worker !disasm_info_->GetSlowPathIntervals().empty();
301*795d594fSAndroid Build Coastguard Worker if (IsDebugDump() && block->GetExceptionalSuccessors().empty() && !has_slow_paths) {
302*795d594fSAndroid Build Coastguard Worker return;
303*795d594fSAndroid Build Coastguard Worker }
304*795d594fSAndroid Build Coastguard Worker AddIndent();
305*795d594fSAndroid Build Coastguard Worker output_ << "xhandlers";
306*795d594fSAndroid Build Coastguard Worker for (HBasicBlock* handler : block->GetExceptionalSuccessors()) {
307*795d594fSAndroid Build Coastguard Worker output_ << " \"" << namer_.GetName(handler) << "\" ";
308*795d594fSAndroid Build Coastguard Worker }
309*795d594fSAndroid Build Coastguard Worker if (has_slow_paths) {
310*795d594fSAndroid Build Coastguard Worker output_ << " \"" << kDisassemblyBlockSlowPaths << "\" ";
311*795d594fSAndroid Build Coastguard Worker }
312*795d594fSAndroid Build Coastguard Worker output_<< "\n";
313*795d594fSAndroid Build Coastguard Worker }
314*795d594fSAndroid Build Coastguard Worker
DumpLocation(std::ostream & stream,const Location & location)315*795d594fSAndroid Build Coastguard Worker void DumpLocation(std::ostream& stream, const Location& location) {
316*795d594fSAndroid Build Coastguard Worker DCHECK(codegen_ != nullptr);
317*795d594fSAndroid Build Coastguard Worker if (location.IsRegister()) {
318*795d594fSAndroid Build Coastguard Worker codegen_->DumpCoreRegister(stream, location.reg());
319*795d594fSAndroid Build Coastguard Worker } else if (location.IsFpuRegister()) {
320*795d594fSAndroid Build Coastguard Worker codegen_->DumpFloatingPointRegister(stream, location.reg());
321*795d594fSAndroid Build Coastguard Worker } else if (location.IsConstant()) {
322*795d594fSAndroid Build Coastguard Worker stream << "#";
323*795d594fSAndroid Build Coastguard Worker HConstant* constant = location.GetConstant();
324*795d594fSAndroid Build Coastguard Worker if (constant->IsIntConstant()) {
325*795d594fSAndroid Build Coastguard Worker stream << constant->AsIntConstant()->GetValue();
326*795d594fSAndroid Build Coastguard Worker } else if (constant->IsLongConstant()) {
327*795d594fSAndroid Build Coastguard Worker stream << constant->AsLongConstant()->GetValue();
328*795d594fSAndroid Build Coastguard Worker } else if (constant->IsFloatConstant()) {
329*795d594fSAndroid Build Coastguard Worker stream << constant->AsFloatConstant()->GetValue();
330*795d594fSAndroid Build Coastguard Worker } else if (constant->IsDoubleConstant()) {
331*795d594fSAndroid Build Coastguard Worker stream << constant->AsDoubleConstant()->GetValue();
332*795d594fSAndroid Build Coastguard Worker } else if (constant->IsNullConstant()) {
333*795d594fSAndroid Build Coastguard Worker stream << "null";
334*795d594fSAndroid Build Coastguard Worker }
335*795d594fSAndroid Build Coastguard Worker } else if (location.IsInvalid()) {
336*795d594fSAndroid Build Coastguard Worker stream << "invalid";
337*795d594fSAndroid Build Coastguard Worker } else if (location.IsStackSlot()) {
338*795d594fSAndroid Build Coastguard Worker stream << location.GetStackIndex() << "(sp)";
339*795d594fSAndroid Build Coastguard Worker } else if (location.IsFpuRegisterPair()) {
340*795d594fSAndroid Build Coastguard Worker codegen_->DumpFloatingPointRegister(stream, location.low());
341*795d594fSAndroid Build Coastguard Worker stream << "|";
342*795d594fSAndroid Build Coastguard Worker codegen_->DumpFloatingPointRegister(stream, location.high());
343*795d594fSAndroid Build Coastguard Worker } else if (location.IsRegisterPair()) {
344*795d594fSAndroid Build Coastguard Worker codegen_->DumpCoreRegister(stream, location.low());
345*795d594fSAndroid Build Coastguard Worker stream << "|";
346*795d594fSAndroid Build Coastguard Worker codegen_->DumpCoreRegister(stream, location.high());
347*795d594fSAndroid Build Coastguard Worker } else if (location.IsUnallocated()) {
348*795d594fSAndroid Build Coastguard Worker stream << "unallocated";
349*795d594fSAndroid Build Coastguard Worker } else if (location.IsDoubleStackSlot()) {
350*795d594fSAndroid Build Coastguard Worker stream << "2x" << location.GetStackIndex() << "(sp)";
351*795d594fSAndroid Build Coastguard Worker } else {
352*795d594fSAndroid Build Coastguard Worker DCHECK(location.IsSIMDStackSlot());
353*795d594fSAndroid Build Coastguard Worker stream << "4x" << location.GetStackIndex() << "(sp)";
354*795d594fSAndroid Build Coastguard Worker }
355*795d594fSAndroid Build Coastguard Worker }
356*795d594fSAndroid Build Coastguard Worker
StartAttributeStream(const char * name=nullptr)357*795d594fSAndroid Build Coastguard Worker std::ostream& StartAttributeStream(const char* name = nullptr) {
358*795d594fSAndroid Build Coastguard Worker if (name == nullptr) {
359*795d594fSAndroid Build Coastguard Worker output_ << " ";
360*795d594fSAndroid Build Coastguard Worker } else {
361*795d594fSAndroid Build Coastguard Worker DCHECK(!HasWhitespace(name)) << "Checker does not allow spaces in attributes";
362*795d594fSAndroid Build Coastguard Worker output_ << " " << name << ":";
363*795d594fSAndroid Build Coastguard Worker }
364*795d594fSAndroid Build Coastguard Worker return output_;
365*795d594fSAndroid Build Coastguard Worker }
366*795d594fSAndroid Build Coastguard Worker
VisitParallelMove(HParallelMove * instruction)367*795d594fSAndroid Build Coastguard Worker void VisitParallelMove(HParallelMove* instruction) override {
368*795d594fSAndroid Build Coastguard Worker StartAttributeStream("liveness") << instruction->GetLifetimePosition();
369*795d594fSAndroid Build Coastguard Worker StringList moves;
370*795d594fSAndroid Build Coastguard Worker for (size_t i = 0, e = instruction->NumMoves(); i < e; ++i) {
371*795d594fSAndroid Build Coastguard Worker MoveOperands* move = instruction->MoveOperandsAt(i);
372*795d594fSAndroid Build Coastguard Worker std::ostream& str = moves.NewEntryStream();
373*795d594fSAndroid Build Coastguard Worker DumpLocation(str, move->GetSource());
374*795d594fSAndroid Build Coastguard Worker str << "->";
375*795d594fSAndroid Build Coastguard Worker DumpLocation(str, move->GetDestination());
376*795d594fSAndroid Build Coastguard Worker }
377*795d594fSAndroid Build Coastguard Worker StartAttributeStream("moves") << moves;
378*795d594fSAndroid Build Coastguard Worker }
379*795d594fSAndroid Build Coastguard Worker
VisitParameterValue(HParameterValue * instruction)380*795d594fSAndroid Build Coastguard Worker void VisitParameterValue(HParameterValue* instruction) override {
381*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_this") << std::boolalpha << instruction->IsThis() << std::noboolalpha;
382*795d594fSAndroid Build Coastguard Worker }
383*795d594fSAndroid Build Coastguard Worker
VisitIntConstant(HIntConstant * instruction)384*795d594fSAndroid Build Coastguard Worker void VisitIntConstant(HIntConstant* instruction) override {
385*795d594fSAndroid Build Coastguard Worker StartAttributeStream() << instruction->GetValue();
386*795d594fSAndroid Build Coastguard Worker }
387*795d594fSAndroid Build Coastguard Worker
VisitLongConstant(HLongConstant * instruction)388*795d594fSAndroid Build Coastguard Worker void VisitLongConstant(HLongConstant* instruction) override {
389*795d594fSAndroid Build Coastguard Worker StartAttributeStream() << instruction->GetValue();
390*795d594fSAndroid Build Coastguard Worker }
391*795d594fSAndroid Build Coastguard Worker
VisitFloatConstant(HFloatConstant * instruction)392*795d594fSAndroid Build Coastguard Worker void VisitFloatConstant(HFloatConstant* instruction) override {
393*795d594fSAndroid Build Coastguard Worker StartAttributeStream() << instruction->GetValue();
394*795d594fSAndroid Build Coastguard Worker }
395*795d594fSAndroid Build Coastguard Worker
VisitDoubleConstant(HDoubleConstant * instruction)396*795d594fSAndroid Build Coastguard Worker void VisitDoubleConstant(HDoubleConstant* instruction) override {
397*795d594fSAndroid Build Coastguard Worker StartAttributeStream() << instruction->GetValue();
398*795d594fSAndroid Build Coastguard Worker }
399*795d594fSAndroid Build Coastguard Worker
VisitPhi(HPhi * phi)400*795d594fSAndroid Build Coastguard Worker void VisitPhi(HPhi* phi) override {
401*795d594fSAndroid Build Coastguard Worker StartAttributeStream("reg") << phi->GetRegNumber();
402*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_catch_phi") << std::boolalpha << phi->IsCatchPhi() << std::noboolalpha;
403*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_live") << std::boolalpha << phi->IsLive() << std::noboolalpha;
404*795d594fSAndroid Build Coastguard Worker }
405*795d594fSAndroid Build Coastguard Worker
VisitMemoryBarrier(HMemoryBarrier * barrier)406*795d594fSAndroid Build Coastguard Worker void VisitMemoryBarrier(HMemoryBarrier* barrier) override {
407*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << barrier->GetBarrierKind();
408*795d594fSAndroid Build Coastguard Worker }
409*795d594fSAndroid Build Coastguard Worker
VisitMonitorOperation(HMonitorOperation * monitor)410*795d594fSAndroid Build Coastguard Worker void VisitMonitorOperation(HMonitorOperation* monitor) override {
411*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << (monitor->IsEnter() ? "enter" : "exit");
412*795d594fSAndroid Build Coastguard Worker }
413*795d594fSAndroid Build Coastguard Worker
VisitLoadClass(HLoadClass * load_class)414*795d594fSAndroid Build Coastguard Worker void VisitLoadClass(HLoadClass* load_class) override {
415*795d594fSAndroid Build Coastguard Worker StartAttributeStream("load_kind") << load_class->GetLoadKind();
416*795d594fSAndroid Build Coastguard Worker StartAttributeStream("in_image") << std::boolalpha << load_class->IsInImage();
417*795d594fSAndroid Build Coastguard Worker StartAttributeStream("class_name")
418*795d594fSAndroid Build Coastguard Worker << load_class->GetDexFile().PrettyType(load_class->GetTypeIndex());
419*795d594fSAndroid Build Coastguard Worker StartAttributeStream("gen_clinit_check")
420*795d594fSAndroid Build Coastguard Worker << std::boolalpha << load_class->MustGenerateClinitCheck() << std::noboolalpha;
421*795d594fSAndroid Build Coastguard Worker StartAttributeStream("needs_access_check") << std::boolalpha
422*795d594fSAndroid Build Coastguard Worker << load_class->NeedsAccessCheck() << std::noboolalpha;
423*795d594fSAndroid Build Coastguard Worker }
424*795d594fSAndroid Build Coastguard Worker
VisitLoadMethodHandle(HLoadMethodHandle * load_method_handle)425*795d594fSAndroid Build Coastguard Worker void VisitLoadMethodHandle(HLoadMethodHandle* load_method_handle) override {
426*795d594fSAndroid Build Coastguard Worker StartAttributeStream("load_kind") << "RuntimeCall";
427*795d594fSAndroid Build Coastguard Worker StartAttributeStream("method_handle_index") << load_method_handle->GetMethodHandleIndex();
428*795d594fSAndroid Build Coastguard Worker }
429*795d594fSAndroid Build Coastguard Worker
VisitLoadMethodType(HLoadMethodType * load_method_type)430*795d594fSAndroid Build Coastguard Worker void VisitLoadMethodType(HLoadMethodType* load_method_type) override {
431*795d594fSAndroid Build Coastguard Worker StartAttributeStream("load_kind") << "RuntimeCall";
432*795d594fSAndroid Build Coastguard Worker const DexFile& dex_file = load_method_type->GetDexFile();
433*795d594fSAndroid Build Coastguard Worker if (dex_file.NumProtoIds() >= load_method_type->GetProtoIndex().index_) {
434*795d594fSAndroid Build Coastguard Worker const dex::ProtoId& proto_id = dex_file.GetProtoId(load_method_type->GetProtoIndex());
435*795d594fSAndroid Build Coastguard Worker StartAttributeStream("method_type") << dex_file.GetProtoSignature(proto_id);
436*795d594fSAndroid Build Coastguard Worker } else {
437*795d594fSAndroid Build Coastguard Worker StartAttributeStream("method_type")
438*795d594fSAndroid Build Coastguard Worker << "<<Unknown proto-idx: " << load_method_type->GetProtoIndex() << ">>";
439*795d594fSAndroid Build Coastguard Worker }
440*795d594fSAndroid Build Coastguard Worker }
441*795d594fSAndroid Build Coastguard Worker
VisitLoadString(HLoadString * load_string)442*795d594fSAndroid Build Coastguard Worker void VisitLoadString(HLoadString* load_string) override {
443*795d594fSAndroid Build Coastguard Worker StartAttributeStream("load_kind") << load_string->GetLoadKind();
444*795d594fSAndroid Build Coastguard Worker }
445*795d594fSAndroid Build Coastguard Worker
HandleTypeCheckInstruction(HTypeCheckInstruction * check)446*795d594fSAndroid Build Coastguard Worker void HandleTypeCheckInstruction(HTypeCheckInstruction* check) {
447*795d594fSAndroid Build Coastguard Worker StartAttributeStream("check_kind") << check->GetTypeCheckKind();
448*795d594fSAndroid Build Coastguard Worker StartAttributeStream("must_do_null_check") << std::boolalpha
449*795d594fSAndroid Build Coastguard Worker << check->MustDoNullCheck() << std::noboolalpha;
450*795d594fSAndroid Build Coastguard Worker if (check->GetTypeCheckKind() == TypeCheckKind::kBitstringCheck) {
451*795d594fSAndroid Build Coastguard Worker StartAttributeStream("path_to_root") << std::hex
452*795d594fSAndroid Build Coastguard Worker << "0x" << check->GetBitstringPathToRoot() << std::dec;
453*795d594fSAndroid Build Coastguard Worker StartAttributeStream("mask") << std::hex << "0x" << check->GetBitstringMask() << std::dec;
454*795d594fSAndroid Build Coastguard Worker }
455*795d594fSAndroid Build Coastguard Worker }
456*795d594fSAndroid Build Coastguard Worker
VisitCheckCast(HCheckCast * check_cast)457*795d594fSAndroid Build Coastguard Worker void VisitCheckCast(HCheckCast* check_cast) override {
458*795d594fSAndroid Build Coastguard Worker HandleTypeCheckInstruction(check_cast);
459*795d594fSAndroid Build Coastguard Worker }
460*795d594fSAndroid Build Coastguard Worker
VisitInstanceOf(HInstanceOf * instance_of)461*795d594fSAndroid Build Coastguard Worker void VisitInstanceOf(HInstanceOf* instance_of) override {
462*795d594fSAndroid Build Coastguard Worker HandleTypeCheckInstruction(instance_of);
463*795d594fSAndroid Build Coastguard Worker }
464*795d594fSAndroid Build Coastguard Worker
VisitArrayLength(HArrayLength * array_length)465*795d594fSAndroid Build Coastguard Worker void VisitArrayLength(HArrayLength* array_length) override {
466*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_string_length") << std::boolalpha
467*795d594fSAndroid Build Coastguard Worker << array_length->IsStringLength() << std::noboolalpha;
468*795d594fSAndroid Build Coastguard Worker if (array_length->IsEmittedAtUseSite()) {
469*795d594fSAndroid Build Coastguard Worker StartAttributeStream("emitted_at_use") << "true";
470*795d594fSAndroid Build Coastguard Worker }
471*795d594fSAndroid Build Coastguard Worker }
472*795d594fSAndroid Build Coastguard Worker
VisitBoundsCheck(HBoundsCheck * bounds_check)473*795d594fSAndroid Build Coastguard Worker void VisitBoundsCheck(HBoundsCheck* bounds_check) override {
474*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_string_char_at") << std::boolalpha
475*795d594fSAndroid Build Coastguard Worker << bounds_check->IsStringCharAt() << std::noboolalpha;
476*795d594fSAndroid Build Coastguard Worker }
477*795d594fSAndroid Build Coastguard Worker
VisitSuspendCheck(HSuspendCheck * suspend_check)478*795d594fSAndroid Build Coastguard Worker void VisitSuspendCheck(HSuspendCheck* suspend_check) override {
479*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_no_op")
480*795d594fSAndroid Build Coastguard Worker << std::boolalpha << suspend_check->IsNoOp() << std::noboolalpha;
481*795d594fSAndroid Build Coastguard Worker }
482*795d594fSAndroid Build Coastguard Worker
VisitArrayGet(HArrayGet * array_get)483*795d594fSAndroid Build Coastguard Worker void VisitArrayGet(HArrayGet* array_get) override {
484*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_string_char_at") << std::boolalpha
485*795d594fSAndroid Build Coastguard Worker << array_get->IsStringCharAt() << std::noboolalpha;
486*795d594fSAndroid Build Coastguard Worker }
487*795d594fSAndroid Build Coastguard Worker
VisitArraySet(HArraySet * array_set)488*795d594fSAndroid Build Coastguard Worker void VisitArraySet(HArraySet* array_set) override {
489*795d594fSAndroid Build Coastguard Worker StartAttributeStream("value_can_be_null")
490*795d594fSAndroid Build Coastguard Worker << std::boolalpha << array_set->GetValueCanBeNull() << std::noboolalpha;
491*795d594fSAndroid Build Coastguard Worker StartAttributeStream("needs_type_check")
492*795d594fSAndroid Build Coastguard Worker << std::boolalpha << array_set->NeedsTypeCheck() << std::noboolalpha;
493*795d594fSAndroid Build Coastguard Worker StartAttributeStream("static_type_of_array_is_object_array")
494*795d594fSAndroid Build Coastguard Worker << std::boolalpha << array_set->StaticTypeOfArrayIsObjectArray() << std::noboolalpha;
495*795d594fSAndroid Build Coastguard Worker StartAttributeStream("can_trigger_gc")
496*795d594fSAndroid Build Coastguard Worker << std::boolalpha << array_set->GetSideEffects().Includes(SideEffects::CanTriggerGC())
497*795d594fSAndroid Build Coastguard Worker << std::noboolalpha;
498*795d594fSAndroid Build Coastguard Worker StartAttributeStream("write_barrier_kind") << array_set->GetWriteBarrierKind();
499*795d594fSAndroid Build Coastguard Worker }
500*795d594fSAndroid Build Coastguard Worker
VisitNewInstance(HNewInstance * new_instance)501*795d594fSAndroid Build Coastguard Worker void VisitNewInstance(HNewInstance* new_instance) override {
502*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_finalizable")
503*795d594fSAndroid Build Coastguard Worker << std::boolalpha << new_instance->IsFinalizable() << std::noboolalpha;
504*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_partial_materialization")
505*795d594fSAndroid Build Coastguard Worker << std::boolalpha << new_instance->IsPartialMaterialization() << std::noboolalpha;
506*795d594fSAndroid Build Coastguard Worker }
507*795d594fSAndroid Build Coastguard Worker
VisitCompare(HCompare * compare)508*795d594fSAndroid Build Coastguard Worker void VisitCompare(HCompare* compare) override {
509*795d594fSAndroid Build Coastguard Worker StartAttributeStream("bias") << compare->GetBias();
510*795d594fSAndroid Build Coastguard Worker StartAttributeStream("comparison_type") << compare->GetComparisonType();
511*795d594fSAndroid Build Coastguard Worker }
512*795d594fSAndroid Build Coastguard Worker
VisitCondition(HCondition * condition)513*795d594fSAndroid Build Coastguard Worker void VisitCondition(HCondition* condition) override {
514*795d594fSAndroid Build Coastguard Worker StartAttributeStream("bias") << condition->GetBias();
515*795d594fSAndroid Build Coastguard Worker }
516*795d594fSAndroid Build Coastguard Worker
VisitIf(HIf * if_instr)517*795d594fSAndroid Build Coastguard Worker void VisitIf(HIf* if_instr) override {
518*795d594fSAndroid Build Coastguard Worker StartAttributeStream("true_count") << if_instr->GetTrueCount();
519*795d594fSAndroid Build Coastguard Worker StartAttributeStream("false_count") << if_instr->GetFalseCount();
520*795d594fSAndroid Build Coastguard Worker }
521*795d594fSAndroid Build Coastguard Worker
VisitInvoke(HInvoke * invoke)522*795d594fSAndroid Build Coastguard Worker void VisitInvoke(HInvoke* invoke) override {
523*795d594fSAndroid Build Coastguard Worker StartAttributeStream("dex_file_index") << invoke->GetMethodReference().index;
524*795d594fSAndroid Build Coastguard Worker ArtMethod* method = invoke->GetResolvedMethod();
525*795d594fSAndroid Build Coastguard Worker // We don't print signatures, which conflict with c1visualizer format.
526*795d594fSAndroid Build Coastguard Worker static constexpr bool kWithSignature = false;
527*795d594fSAndroid Build Coastguard Worker // Note that we can only use the graph's dex file for the unresolved case. The
528*795d594fSAndroid Build Coastguard Worker // other invokes might be coming from inlined methods.
529*795d594fSAndroid Build Coastguard Worker ScopedObjectAccess soa(Thread::Current());
530*795d594fSAndroid Build Coastguard Worker std::string method_name = (method == nullptr)
531*795d594fSAndroid Build Coastguard Worker ? invoke->GetMethodReference().PrettyMethod(kWithSignature)
532*795d594fSAndroid Build Coastguard Worker : method->PrettyMethod(kWithSignature);
533*795d594fSAndroid Build Coastguard Worker StartAttributeStream("method_name") << method_name;
534*795d594fSAndroid Build Coastguard Worker StartAttributeStream("always_throws") << std::boolalpha
535*795d594fSAndroid Build Coastguard Worker << invoke->AlwaysThrows()
536*795d594fSAndroid Build Coastguard Worker << std::noboolalpha;
537*795d594fSAndroid Build Coastguard Worker if (method != nullptr) {
538*795d594fSAndroid Build Coastguard Worker StartAttributeStream("method_index") << method->GetMethodIndex();
539*795d594fSAndroid Build Coastguard Worker }
540*795d594fSAndroid Build Coastguard Worker StartAttributeStream("intrinsic") << invoke->GetIntrinsic();
541*795d594fSAndroid Build Coastguard Worker }
542*795d594fSAndroid Build Coastguard Worker
VisitInvokeUnresolved(HInvokeUnresolved * invoke)543*795d594fSAndroid Build Coastguard Worker void VisitInvokeUnresolved(HInvokeUnresolved* invoke) override {
544*795d594fSAndroid Build Coastguard Worker VisitInvoke(invoke);
545*795d594fSAndroid Build Coastguard Worker StartAttributeStream("invoke_type") << invoke->GetInvokeType();
546*795d594fSAndroid Build Coastguard Worker }
547*795d594fSAndroid Build Coastguard Worker
VisitInvokeStaticOrDirect(HInvokeStaticOrDirect * invoke)548*795d594fSAndroid Build Coastguard Worker void VisitInvokeStaticOrDirect(HInvokeStaticOrDirect* invoke) override {
549*795d594fSAndroid Build Coastguard Worker VisitInvoke(invoke);
550*795d594fSAndroid Build Coastguard Worker StartAttributeStream("method_load_kind") << invoke->GetMethodLoadKind();
551*795d594fSAndroid Build Coastguard Worker if (invoke->IsStatic()) {
552*795d594fSAndroid Build Coastguard Worker StartAttributeStream("clinit_check") << invoke->GetClinitCheckRequirement();
553*795d594fSAndroid Build Coastguard Worker }
554*795d594fSAndroid Build Coastguard Worker }
555*795d594fSAndroid Build Coastguard Worker
VisitInvokeVirtual(HInvokeVirtual * invoke)556*795d594fSAndroid Build Coastguard Worker void VisitInvokeVirtual(HInvokeVirtual* invoke) override {
557*795d594fSAndroid Build Coastguard Worker VisitInvoke(invoke);
558*795d594fSAndroid Build Coastguard Worker }
559*795d594fSAndroid Build Coastguard Worker
VisitInvokePolymorphic(HInvokePolymorphic * invoke)560*795d594fSAndroid Build Coastguard Worker void VisitInvokePolymorphic(HInvokePolymorphic* invoke) override {
561*795d594fSAndroid Build Coastguard Worker VisitInvoke(invoke);
562*795d594fSAndroid Build Coastguard Worker StartAttributeStream("invoke_type") << "InvokePolymorphic";
563*795d594fSAndroid Build Coastguard Worker }
564*795d594fSAndroid Build Coastguard Worker
VisitInstanceFieldGet(HInstanceFieldGet * iget)565*795d594fSAndroid Build Coastguard Worker void VisitInstanceFieldGet(HInstanceFieldGet* iget) override {
566*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_name") <<
567*795d594fSAndroid Build Coastguard Worker iget->GetFieldInfo().GetDexFile().PrettyField(iget->GetFieldInfo().GetFieldIndex(),
568*795d594fSAndroid Build Coastguard Worker /* with type */ false);
569*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << iget->GetFieldType();
570*795d594fSAndroid Build Coastguard Worker }
571*795d594fSAndroid Build Coastguard Worker
VisitInstanceFieldSet(HInstanceFieldSet * iset)572*795d594fSAndroid Build Coastguard Worker void VisitInstanceFieldSet(HInstanceFieldSet* iset) override {
573*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_name") <<
574*795d594fSAndroid Build Coastguard Worker iset->GetFieldInfo().GetDexFile().PrettyField(iset->GetFieldInfo().GetFieldIndex(),
575*795d594fSAndroid Build Coastguard Worker /* with type */ false);
576*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << iset->GetFieldType();
577*795d594fSAndroid Build Coastguard Worker StartAttributeStream("write_barrier_kind") << iset->GetWriteBarrierKind();
578*795d594fSAndroid Build Coastguard Worker StartAttributeStream("value_can_be_null")
579*795d594fSAndroid Build Coastguard Worker << std::boolalpha << iset->GetValueCanBeNull() << std::noboolalpha;
580*795d594fSAndroid Build Coastguard Worker }
581*795d594fSAndroid Build Coastguard Worker
VisitStaticFieldGet(HStaticFieldGet * sget)582*795d594fSAndroid Build Coastguard Worker void VisitStaticFieldGet(HStaticFieldGet* sget) override {
583*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_name") <<
584*795d594fSAndroid Build Coastguard Worker sget->GetFieldInfo().GetDexFile().PrettyField(sget->GetFieldInfo().GetFieldIndex(),
585*795d594fSAndroid Build Coastguard Worker /* with type */ false);
586*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << sget->GetFieldType();
587*795d594fSAndroid Build Coastguard Worker }
588*795d594fSAndroid Build Coastguard Worker
VisitStaticFieldSet(HStaticFieldSet * sset)589*795d594fSAndroid Build Coastguard Worker void VisitStaticFieldSet(HStaticFieldSet* sset) override {
590*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_name") <<
591*795d594fSAndroid Build Coastguard Worker sset->GetFieldInfo().GetDexFile().PrettyField(sset->GetFieldInfo().GetFieldIndex(),
592*795d594fSAndroid Build Coastguard Worker /* with type */ false);
593*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << sset->GetFieldType();
594*795d594fSAndroid Build Coastguard Worker StartAttributeStream("write_barrier_kind") << sset->GetWriteBarrierKind();
595*795d594fSAndroid Build Coastguard Worker StartAttributeStream("value_can_be_null")
596*795d594fSAndroid Build Coastguard Worker << std::boolalpha << sset->GetValueCanBeNull() << std::noboolalpha;
597*795d594fSAndroid Build Coastguard Worker }
598*795d594fSAndroid Build Coastguard Worker
VisitUnresolvedInstanceFieldGet(HUnresolvedInstanceFieldGet * field_access)599*795d594fSAndroid Build Coastguard Worker void VisitUnresolvedInstanceFieldGet(HUnresolvedInstanceFieldGet* field_access) override {
600*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << field_access->GetFieldType();
601*795d594fSAndroid Build Coastguard Worker }
602*795d594fSAndroid Build Coastguard Worker
VisitUnresolvedInstanceFieldSet(HUnresolvedInstanceFieldSet * field_access)603*795d594fSAndroid Build Coastguard Worker void VisitUnresolvedInstanceFieldSet(HUnresolvedInstanceFieldSet* field_access) override {
604*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << field_access->GetFieldType();
605*795d594fSAndroid Build Coastguard Worker }
606*795d594fSAndroid Build Coastguard Worker
VisitUnresolvedStaticFieldGet(HUnresolvedStaticFieldGet * field_access)607*795d594fSAndroid Build Coastguard Worker void VisitUnresolvedStaticFieldGet(HUnresolvedStaticFieldGet* field_access) override {
608*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << field_access->GetFieldType();
609*795d594fSAndroid Build Coastguard Worker }
610*795d594fSAndroid Build Coastguard Worker
VisitUnresolvedStaticFieldSet(HUnresolvedStaticFieldSet * field_access)611*795d594fSAndroid Build Coastguard Worker void VisitUnresolvedStaticFieldSet(HUnresolvedStaticFieldSet* field_access) override {
612*795d594fSAndroid Build Coastguard Worker StartAttributeStream("field_type") << field_access->GetFieldType();
613*795d594fSAndroid Build Coastguard Worker }
614*795d594fSAndroid Build Coastguard Worker
VisitTryBoundary(HTryBoundary * try_boundary)615*795d594fSAndroid Build Coastguard Worker void VisitTryBoundary(HTryBoundary* try_boundary) override {
616*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << (try_boundary->IsEntry() ? "entry" : "exit");
617*795d594fSAndroid Build Coastguard Worker }
618*795d594fSAndroid Build Coastguard Worker
VisitGoto(HGoto * instruction)619*795d594fSAndroid Build Coastguard Worker void VisitGoto(HGoto* instruction) override {
620*795d594fSAndroid Build Coastguard Worker StartAttributeStream("target") << namer_.GetName(instruction->GetBlock()->GetSingleSuccessor());
621*795d594fSAndroid Build Coastguard Worker }
622*795d594fSAndroid Build Coastguard Worker
VisitDeoptimize(HDeoptimize * deoptimize)623*795d594fSAndroid Build Coastguard Worker void VisitDeoptimize(HDeoptimize* deoptimize) override {
624*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << deoptimize->GetKind();
625*795d594fSAndroid Build Coastguard Worker }
626*795d594fSAndroid Build Coastguard Worker
VisitVecOperation(HVecOperation * vec_operation)627*795d594fSAndroid Build Coastguard Worker void VisitVecOperation(HVecOperation* vec_operation) override {
628*795d594fSAndroid Build Coastguard Worker StartAttributeStream("packed_type") << vec_operation->GetPackedType();
629*795d594fSAndroid Build Coastguard Worker }
630*795d594fSAndroid Build Coastguard Worker
VisitVecMemoryOperation(HVecMemoryOperation * vec_mem_operation)631*795d594fSAndroid Build Coastguard Worker void VisitVecMemoryOperation(HVecMemoryOperation* vec_mem_operation) override {
632*795d594fSAndroid Build Coastguard Worker VisitVecOperation(vec_mem_operation);
633*795d594fSAndroid Build Coastguard Worker StartAttributeStream("alignment") << vec_mem_operation->GetAlignment().ToString();
634*795d594fSAndroid Build Coastguard Worker }
635*795d594fSAndroid Build Coastguard Worker
VisitVecHalvingAdd(HVecHalvingAdd * hadd)636*795d594fSAndroid Build Coastguard Worker void VisitVecHalvingAdd(HVecHalvingAdd* hadd) override {
637*795d594fSAndroid Build Coastguard Worker VisitVecBinaryOperation(hadd);
638*795d594fSAndroid Build Coastguard Worker StartAttributeStream("rounded") << std::boolalpha << hadd->IsRounded() << std::noboolalpha;
639*795d594fSAndroid Build Coastguard Worker }
640*795d594fSAndroid Build Coastguard Worker
VisitVecMultiplyAccumulate(HVecMultiplyAccumulate * instruction)641*795d594fSAndroid Build Coastguard Worker void VisitVecMultiplyAccumulate(HVecMultiplyAccumulate* instruction) override {
642*795d594fSAndroid Build Coastguard Worker VisitVecOperation(instruction);
643*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << instruction->GetOpKind();
644*795d594fSAndroid Build Coastguard Worker }
645*795d594fSAndroid Build Coastguard Worker
VisitVecDotProd(HVecDotProd * instruction)646*795d594fSAndroid Build Coastguard Worker void VisitVecDotProd(HVecDotProd* instruction) override {
647*795d594fSAndroid Build Coastguard Worker VisitVecOperation(instruction);
648*795d594fSAndroid Build Coastguard Worker DataType::Type arg_type = instruction->InputAt(1)->AsVecOperation()->GetPackedType();
649*795d594fSAndroid Build Coastguard Worker StartAttributeStream("type") << (instruction->IsZeroExtending() ?
650*795d594fSAndroid Build Coastguard Worker DataType::ToUnsigned(arg_type) :
651*795d594fSAndroid Build Coastguard Worker DataType::ToSigned(arg_type));
652*795d594fSAndroid Build Coastguard Worker }
653*795d594fSAndroid Build Coastguard Worker
VisitBitwiseNegatedRight(HBitwiseNegatedRight * instruction)654*795d594fSAndroid Build Coastguard Worker void VisitBitwiseNegatedRight(HBitwiseNegatedRight* instruction) override {
655*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << instruction->GetOpKind();
656*795d594fSAndroid Build Coastguard Worker }
657*795d594fSAndroid Build Coastguard Worker
658*795d594fSAndroid Build Coastguard Worker #if defined(ART_ENABLE_CODEGEN_arm) || defined(ART_ENABLE_CODEGEN_arm64)
VisitMultiplyAccumulate(HMultiplyAccumulate * instruction)659*795d594fSAndroid Build Coastguard Worker void VisitMultiplyAccumulate(HMultiplyAccumulate* instruction) override {
660*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << instruction->GetOpKind();
661*795d594fSAndroid Build Coastguard Worker }
662*795d594fSAndroid Build Coastguard Worker
VisitDataProcWithShifterOp(HDataProcWithShifterOp * instruction)663*795d594fSAndroid Build Coastguard Worker void VisitDataProcWithShifterOp(HDataProcWithShifterOp* instruction) override {
664*795d594fSAndroid Build Coastguard Worker StartAttributeStream("kind") << instruction->GetInstrKind() << "+" << instruction->GetOpKind();
665*795d594fSAndroid Build Coastguard Worker if (HDataProcWithShifterOp::IsShiftOp(instruction->GetOpKind())) {
666*795d594fSAndroid Build Coastguard Worker StartAttributeStream("shift") << instruction->GetShiftAmount();
667*795d594fSAndroid Build Coastguard Worker }
668*795d594fSAndroid Build Coastguard Worker }
669*795d594fSAndroid Build Coastguard Worker #endif
670*795d594fSAndroid Build Coastguard Worker
671*795d594fSAndroid Build Coastguard Worker #if defined(ART_ENABLE_CODEGEN_riscv64)
VisitRiscv64ShiftAdd(HRiscv64ShiftAdd * instruction)672*795d594fSAndroid Build Coastguard Worker void VisitRiscv64ShiftAdd(HRiscv64ShiftAdd* instruction) override {
673*795d594fSAndroid Build Coastguard Worker StartAttributeStream("distance") << instruction->GetDistance();
674*795d594fSAndroid Build Coastguard Worker }
675*795d594fSAndroid Build Coastguard Worker #endif
676*795d594fSAndroid Build Coastguard Worker
IsPass(const char * name)677*795d594fSAndroid Build Coastguard Worker bool IsPass(const char* name) {
678*795d594fSAndroid Build Coastguard Worker return strcmp(pass_name_, name) == 0;
679*795d594fSAndroid Build Coastguard Worker }
680*795d594fSAndroid Build Coastguard Worker
IsDebugDump()681*795d594fSAndroid Build Coastguard Worker bool IsDebugDump() {
682*795d594fSAndroid Build Coastguard Worker return IsPass(kDebugDumpGraphName) || IsPass(kDebugDumpName);
683*795d594fSAndroid Build Coastguard Worker }
684*795d594fSAndroid Build Coastguard Worker
PrintInstruction(HInstruction * instruction)685*795d594fSAndroid Build Coastguard Worker void PrintInstruction(HInstruction* instruction) {
686*795d594fSAndroid Build Coastguard Worker output_ << instruction->DebugName();
687*795d594fSAndroid Build Coastguard Worker HConstInputsRef inputs = instruction->GetInputs();
688*795d594fSAndroid Build Coastguard Worker if (!inputs.empty()) {
689*795d594fSAndroid Build Coastguard Worker StringList input_list;
690*795d594fSAndroid Build Coastguard Worker for (const HInstruction* input : inputs) {
691*795d594fSAndroid Build Coastguard Worker input_list.NewEntryStream() << DataType::TypeId(input->GetType()) << input->GetId();
692*795d594fSAndroid Build Coastguard Worker }
693*795d594fSAndroid Build Coastguard Worker StartAttributeStream() << input_list;
694*795d594fSAndroid Build Coastguard Worker }
695*795d594fSAndroid Build Coastguard Worker if (instruction->GetDexPc() != kNoDexPc) {
696*795d594fSAndroid Build Coastguard Worker StartAttributeStream("dex_pc") << instruction->GetDexPc();
697*795d594fSAndroid Build Coastguard Worker } else {
698*795d594fSAndroid Build Coastguard Worker StartAttributeStream("dex_pc") << "n/a";
699*795d594fSAndroid Build Coastguard Worker }
700*795d594fSAndroid Build Coastguard Worker HBasicBlock* block = instruction->GetBlock();
701*795d594fSAndroid Build Coastguard Worker StartAttributeStream("block") << namer_.GetName(block);
702*795d594fSAndroid Build Coastguard Worker
703*795d594fSAndroid Build Coastguard Worker instruction->Accept(this);
704*795d594fSAndroid Build Coastguard Worker if (instruction->HasEnvironment()) {
705*795d594fSAndroid Build Coastguard Worker StringList envs;
706*795d594fSAndroid Build Coastguard Worker for (HEnvironment* environment = instruction->GetEnvironment();
707*795d594fSAndroid Build Coastguard Worker environment != nullptr;
708*795d594fSAndroid Build Coastguard Worker environment = environment->GetParent()) {
709*795d594fSAndroid Build Coastguard Worker StringList vregs;
710*795d594fSAndroid Build Coastguard Worker for (size_t i = 0, e = environment->Size(); i < e; ++i) {
711*795d594fSAndroid Build Coastguard Worker HInstruction* insn = environment->GetInstructionAt(i);
712*795d594fSAndroid Build Coastguard Worker if (insn != nullptr) {
713*795d594fSAndroid Build Coastguard Worker vregs.NewEntryStream() << DataType::TypeId(insn->GetType()) << insn->GetId();
714*795d594fSAndroid Build Coastguard Worker } else {
715*795d594fSAndroid Build Coastguard Worker vregs.NewEntryStream() << "_";
716*795d594fSAndroid Build Coastguard Worker }
717*795d594fSAndroid Build Coastguard Worker }
718*795d594fSAndroid Build Coastguard Worker envs.NewEntryStream() << vregs;
719*795d594fSAndroid Build Coastguard Worker }
720*795d594fSAndroid Build Coastguard Worker StartAttributeStream("env") << envs;
721*795d594fSAndroid Build Coastguard Worker }
722*795d594fSAndroid Build Coastguard Worker if (IsPass(SsaLivenessAnalysis::kLivenessPassName)
723*795d594fSAndroid Build Coastguard Worker && is_after_pass_
724*795d594fSAndroid Build Coastguard Worker && instruction->GetLifetimePosition() != kNoLifetime) {
725*795d594fSAndroid Build Coastguard Worker StartAttributeStream("liveness") << instruction->GetLifetimePosition();
726*795d594fSAndroid Build Coastguard Worker if (instruction->HasLiveInterval()) {
727*795d594fSAndroid Build Coastguard Worker LiveInterval* interval = instruction->GetLiveInterval();
728*795d594fSAndroid Build Coastguard Worker StartAttributeStream("ranges")
729*795d594fSAndroid Build Coastguard Worker << StringList(interval->GetFirstRange(), StringList::kSetBrackets);
730*795d594fSAndroid Build Coastguard Worker StartAttributeStream("uses") << StringList(interval->GetUses());
731*795d594fSAndroid Build Coastguard Worker StartAttributeStream("env_uses") << StringList(interval->GetEnvironmentUses());
732*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_fixed") << interval->IsFixed();
733*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_split") << interval->IsSplit();
734*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_low") << interval->IsLowInterval();
735*795d594fSAndroid Build Coastguard Worker StartAttributeStream("is_high") << interval->IsHighInterval();
736*795d594fSAndroid Build Coastguard Worker }
737*795d594fSAndroid Build Coastguard Worker }
738*795d594fSAndroid Build Coastguard Worker
739*795d594fSAndroid Build Coastguard Worker if (IsPass(RegisterAllocator::kRegisterAllocatorPassName) && is_after_pass_) {
740*795d594fSAndroid Build Coastguard Worker StartAttributeStream("liveness") << instruction->GetLifetimePosition();
741*795d594fSAndroid Build Coastguard Worker LocationSummary* locations = instruction->GetLocations();
742*795d594fSAndroid Build Coastguard Worker if (locations != nullptr) {
743*795d594fSAndroid Build Coastguard Worker StringList input_list;
744*795d594fSAndroid Build Coastguard Worker for (size_t i = 0, e = locations->GetInputCount(); i < e; ++i) {
745*795d594fSAndroid Build Coastguard Worker DumpLocation(input_list.NewEntryStream(), locations->InAt(i));
746*795d594fSAndroid Build Coastguard Worker }
747*795d594fSAndroid Build Coastguard Worker std::ostream& attr = StartAttributeStream("locations");
748*795d594fSAndroid Build Coastguard Worker attr << input_list << "->";
749*795d594fSAndroid Build Coastguard Worker DumpLocation(attr, locations->Out());
750*795d594fSAndroid Build Coastguard Worker }
751*795d594fSAndroid Build Coastguard Worker }
752*795d594fSAndroid Build Coastguard Worker
753*795d594fSAndroid Build Coastguard Worker HLoopInformation* loop_info = (block != nullptr) ? block->GetLoopInformation() : nullptr;
754*795d594fSAndroid Build Coastguard Worker if (loop_info == nullptr) {
755*795d594fSAndroid Build Coastguard Worker StartAttributeStream("loop") << "none";
756*795d594fSAndroid Build Coastguard Worker } else {
757*795d594fSAndroid Build Coastguard Worker StartAttributeStream("loop") << namer_.GetName(loop_info->GetHeader());
758*795d594fSAndroid Build Coastguard Worker HLoopInformation* outer = loop_info->GetPreHeader()->GetLoopInformation();
759*795d594fSAndroid Build Coastguard Worker if (outer != nullptr) {
760*795d594fSAndroid Build Coastguard Worker StartAttributeStream("outer_loop") << namer_.GetName(outer->GetHeader());
761*795d594fSAndroid Build Coastguard Worker } else {
762*795d594fSAndroid Build Coastguard Worker StartAttributeStream("outer_loop") << "none";
763*795d594fSAndroid Build Coastguard Worker }
764*795d594fSAndroid Build Coastguard Worker StartAttributeStream("irreducible")
765*795d594fSAndroid Build Coastguard Worker << std::boolalpha << loop_info->IsIrreducible() << std::noboolalpha;
766*795d594fSAndroid Build Coastguard Worker }
767*795d594fSAndroid Build Coastguard Worker
768*795d594fSAndroid Build Coastguard Worker // For the builder and the inliner, we want to add extra information on HInstructions
769*795d594fSAndroid Build Coastguard Worker // that have reference types, and also HInstanceOf/HCheckcast.
770*795d594fSAndroid Build Coastguard Worker if ((IsPass(HGraphBuilder::kBuilderPassName)
771*795d594fSAndroid Build Coastguard Worker || IsPass(HInliner::kInlinerPassName)
772*795d594fSAndroid Build Coastguard Worker || IsDebugDump())
773*795d594fSAndroid Build Coastguard Worker && (instruction->GetType() == DataType::Type::kReference ||
774*795d594fSAndroid Build Coastguard Worker instruction->IsInstanceOf() ||
775*795d594fSAndroid Build Coastguard Worker instruction->IsCheckCast())) {
776*795d594fSAndroid Build Coastguard Worker ReferenceTypeInfo info = (instruction->GetType() == DataType::Type::kReference)
777*795d594fSAndroid Build Coastguard Worker ? instruction->IsLoadClass()
778*795d594fSAndroid Build Coastguard Worker ? instruction->AsLoadClass()->GetLoadedClassRTI()
779*795d594fSAndroid Build Coastguard Worker : instruction->GetReferenceTypeInfo()
780*795d594fSAndroid Build Coastguard Worker : instruction->IsInstanceOf()
781*795d594fSAndroid Build Coastguard Worker ? instruction->AsInstanceOf()->GetTargetClassRTI()
782*795d594fSAndroid Build Coastguard Worker : instruction->AsCheckCast()->GetTargetClassRTI();
783*795d594fSAndroid Build Coastguard Worker ScopedObjectAccess soa(Thread::Current());
784*795d594fSAndroid Build Coastguard Worker if (info.IsValid()) {
785*795d594fSAndroid Build Coastguard Worker StartAttributeStream("klass")
786*795d594fSAndroid Build Coastguard Worker << mirror::Class::PrettyDescriptor(info.GetTypeHandle().Get());
787*795d594fSAndroid Build Coastguard Worker if (instruction->GetType() == DataType::Type::kReference) {
788*795d594fSAndroid Build Coastguard Worker StartAttributeStream("can_be_null")
789*795d594fSAndroid Build Coastguard Worker << std::boolalpha << instruction->CanBeNull() << std::noboolalpha;
790*795d594fSAndroid Build Coastguard Worker }
791*795d594fSAndroid Build Coastguard Worker StartAttributeStream("exact") << std::boolalpha << info.IsExact() << std::noboolalpha;
792*795d594fSAndroid Build Coastguard Worker } else if (instruction->IsLoadClass() ||
793*795d594fSAndroid Build Coastguard Worker instruction->IsInstanceOf() ||
794*795d594fSAndroid Build Coastguard Worker instruction->IsCheckCast()) {
795*795d594fSAndroid Build Coastguard Worker StartAttributeStream("klass") << "unresolved";
796*795d594fSAndroid Build Coastguard Worker } else {
797*795d594fSAndroid Build Coastguard Worker StartAttributeStream("klass") << "invalid";
798*795d594fSAndroid Build Coastguard Worker }
799*795d594fSAndroid Build Coastguard Worker }
800*795d594fSAndroid Build Coastguard Worker if (disasm_info_ != nullptr) {
801*795d594fSAndroid Build Coastguard Worker DCHECK(disassembler_ != nullptr);
802*795d594fSAndroid Build Coastguard Worker // If the information is available, disassemble the code generated for
803*795d594fSAndroid Build Coastguard Worker // this instruction.
804*795d594fSAndroid Build Coastguard Worker auto it = disasm_info_->GetInstructionIntervals().find(instruction);
805*795d594fSAndroid Build Coastguard Worker if (it != disasm_info_->GetInstructionIntervals().end()
806*795d594fSAndroid Build Coastguard Worker && it->second.start != it->second.end) {
807*795d594fSAndroid Build Coastguard Worker output_ << "\n";
808*795d594fSAndroid Build Coastguard Worker disassembler_->Disassemble(output_, it->second.start, it->second.end);
809*795d594fSAndroid Build Coastguard Worker }
810*795d594fSAndroid Build Coastguard Worker }
811*795d594fSAndroid Build Coastguard Worker }
812*795d594fSAndroid Build Coastguard Worker
PrintInstructions(const HInstructionList & list)813*795d594fSAndroid Build Coastguard Worker void PrintInstructions(const HInstructionList& list) {
814*795d594fSAndroid Build Coastguard Worker for (HInstructionIterator it(list); !it.Done(); it.Advance()) {
815*795d594fSAndroid Build Coastguard Worker HInstruction* instruction = it.Current();
816*795d594fSAndroid Build Coastguard Worker int bci = 0;
817*795d594fSAndroid Build Coastguard Worker size_t num_uses = instruction->GetUses().SizeSlow();
818*795d594fSAndroid Build Coastguard Worker AddIndent();
819*795d594fSAndroid Build Coastguard Worker output_ << bci << " " << num_uses << " "
820*795d594fSAndroid Build Coastguard Worker << DataType::TypeId(instruction->GetType()) << instruction->GetId() << " ";
821*795d594fSAndroid Build Coastguard Worker PrintInstruction(instruction);
822*795d594fSAndroid Build Coastguard Worker output_ << " " << kEndInstructionMarker << "\n";
823*795d594fSAndroid Build Coastguard Worker }
824*795d594fSAndroid Build Coastguard Worker }
825*795d594fSAndroid Build Coastguard Worker
DumpStartOfDisassemblyBlock(const char * block_name,int predecessor_index,int successor_index)826*795d594fSAndroid Build Coastguard Worker void DumpStartOfDisassemblyBlock(const char* block_name,
827*795d594fSAndroid Build Coastguard Worker int predecessor_index,
828*795d594fSAndroid Build Coastguard Worker int successor_index) {
829*795d594fSAndroid Build Coastguard Worker StartTag("block");
830*795d594fSAndroid Build Coastguard Worker PrintProperty("name", block_name);
831*795d594fSAndroid Build Coastguard Worker PrintInt("from_bci", -1);
832*795d594fSAndroid Build Coastguard Worker PrintInt("to_bci", -1);
833*795d594fSAndroid Build Coastguard Worker if (predecessor_index != -1) {
834*795d594fSAndroid Build Coastguard Worker PrintProperty("predecessors", "B", predecessor_index);
835*795d594fSAndroid Build Coastguard Worker } else {
836*795d594fSAndroid Build Coastguard Worker PrintEmptyProperty("predecessors");
837*795d594fSAndroid Build Coastguard Worker }
838*795d594fSAndroid Build Coastguard Worker if (successor_index != -1) {
839*795d594fSAndroid Build Coastguard Worker PrintProperty("successors", "B", successor_index);
840*795d594fSAndroid Build Coastguard Worker } else {
841*795d594fSAndroid Build Coastguard Worker PrintEmptyProperty("successors");
842*795d594fSAndroid Build Coastguard Worker }
843*795d594fSAndroid Build Coastguard Worker PrintEmptyProperty("xhandlers");
844*795d594fSAndroid Build Coastguard Worker PrintEmptyProperty("flags");
845*795d594fSAndroid Build Coastguard Worker StartTag("states");
846*795d594fSAndroid Build Coastguard Worker StartTag("locals");
847*795d594fSAndroid Build Coastguard Worker PrintInt("size", 0);
848*795d594fSAndroid Build Coastguard Worker PrintProperty("method", "None");
849*795d594fSAndroid Build Coastguard Worker EndTag("locals");
850*795d594fSAndroid Build Coastguard Worker EndTag("states");
851*795d594fSAndroid Build Coastguard Worker StartTag("HIR");
852*795d594fSAndroid Build Coastguard Worker }
853*795d594fSAndroid Build Coastguard Worker
DumpEndOfDisassemblyBlock()854*795d594fSAndroid Build Coastguard Worker void DumpEndOfDisassemblyBlock() {
855*795d594fSAndroid Build Coastguard Worker EndTag("HIR");
856*795d594fSAndroid Build Coastguard Worker EndTag("block");
857*795d594fSAndroid Build Coastguard Worker }
858*795d594fSAndroid Build Coastguard Worker
DumpDisassemblyBlockForFrameEntry()859*795d594fSAndroid Build Coastguard Worker void DumpDisassemblyBlockForFrameEntry() {
860*795d594fSAndroid Build Coastguard Worker DumpStartOfDisassemblyBlock(kDisassemblyBlockFrameEntry,
861*795d594fSAndroid Build Coastguard Worker -1,
862*795d594fSAndroid Build Coastguard Worker GetGraph()->GetEntryBlock()->GetBlockId());
863*795d594fSAndroid Build Coastguard Worker output_ << " 0 0 disasm " << kDisassemblyBlockFrameEntry << " ";
864*795d594fSAndroid Build Coastguard Worker GeneratedCodeInterval frame_entry = disasm_info_->GetFrameEntryInterval();
865*795d594fSAndroid Build Coastguard Worker if (frame_entry.start != frame_entry.end) {
866*795d594fSAndroid Build Coastguard Worker output_ << "\n";
867*795d594fSAndroid Build Coastguard Worker disassembler_->Disassemble(output_, frame_entry.start, frame_entry.end);
868*795d594fSAndroid Build Coastguard Worker }
869*795d594fSAndroid Build Coastguard Worker output_ << kEndInstructionMarker << "\n";
870*795d594fSAndroid Build Coastguard Worker DumpEndOfDisassemblyBlock();
871*795d594fSAndroid Build Coastguard Worker }
872*795d594fSAndroid Build Coastguard Worker
DumpDisassemblyBlockForSlowPaths()873*795d594fSAndroid Build Coastguard Worker void DumpDisassemblyBlockForSlowPaths() {
874*795d594fSAndroid Build Coastguard Worker if (disasm_info_->GetSlowPathIntervals().empty()) {
875*795d594fSAndroid Build Coastguard Worker return;
876*795d594fSAndroid Build Coastguard Worker }
877*795d594fSAndroid Build Coastguard Worker // If the graph has an exit block we attach the block for the slow paths
878*795d594fSAndroid Build Coastguard Worker // after it. Else we just add the block to the graph without linking it to
879*795d594fSAndroid Build Coastguard Worker // any other.
880*795d594fSAndroid Build Coastguard Worker DumpStartOfDisassemblyBlock(
881*795d594fSAndroid Build Coastguard Worker kDisassemblyBlockSlowPaths,
882*795d594fSAndroid Build Coastguard Worker GetGraph()->HasExitBlock() ? GetGraph()->GetExitBlock()->GetBlockId() : -1,
883*795d594fSAndroid Build Coastguard Worker -1);
884*795d594fSAndroid Build Coastguard Worker for (SlowPathCodeInfo info : disasm_info_->GetSlowPathIntervals()) {
885*795d594fSAndroid Build Coastguard Worker output_ << " 0 0 disasm " << info.slow_path->GetDescription() << "\n";
886*795d594fSAndroid Build Coastguard Worker disassembler_->Disassemble(output_, info.code_interval.start, info.code_interval.end);
887*795d594fSAndroid Build Coastguard Worker output_ << kEndInstructionMarker << "\n";
888*795d594fSAndroid Build Coastguard Worker }
889*795d594fSAndroid Build Coastguard Worker DumpEndOfDisassemblyBlock();
890*795d594fSAndroid Build Coastguard Worker }
891*795d594fSAndroid Build Coastguard Worker
Run()892*795d594fSAndroid Build Coastguard Worker void Run() {
893*795d594fSAndroid Build Coastguard Worker StartTag("cfg");
894*795d594fSAndroid Build Coastguard Worker std::ostringstream oss;
895*795d594fSAndroid Build Coastguard Worker oss << pass_name_;
896*795d594fSAndroid Build Coastguard Worker if (!IsDebugDump()) {
897*795d594fSAndroid Build Coastguard Worker oss << " (" << (GetGraph()->IsCompilingBaseline() ? "baseline " : "")
898*795d594fSAndroid Build Coastguard Worker << (is_after_pass_ ? "after" : "before")
899*795d594fSAndroid Build Coastguard Worker << (graph_in_bad_state_ ? ", bad_state" : "") << ")";
900*795d594fSAndroid Build Coastguard Worker }
901*795d594fSAndroid Build Coastguard Worker PrintProperty("name", oss.str().c_str());
902*795d594fSAndroid Build Coastguard Worker if (disasm_info_ != nullptr) {
903*795d594fSAndroid Build Coastguard Worker DumpDisassemblyBlockForFrameEntry();
904*795d594fSAndroid Build Coastguard Worker }
905*795d594fSAndroid Build Coastguard Worker VisitInsertionOrder();
906*795d594fSAndroid Build Coastguard Worker if (disasm_info_ != nullptr) {
907*795d594fSAndroid Build Coastguard Worker DumpDisassemblyBlockForSlowPaths();
908*795d594fSAndroid Build Coastguard Worker }
909*795d594fSAndroid Build Coastguard Worker EndTag("cfg");
910*795d594fSAndroid Build Coastguard Worker Flush();
911*795d594fSAndroid Build Coastguard Worker }
912*795d594fSAndroid Build Coastguard Worker
Run(HInstruction * instruction)913*795d594fSAndroid Build Coastguard Worker void Run(HInstruction* instruction) {
914*795d594fSAndroid Build Coastguard Worker output_ << DataType::TypeId(instruction->GetType()) << instruction->GetId() << " ";
915*795d594fSAndroid Build Coastguard Worker PrintInstruction(instruction);
916*795d594fSAndroid Build Coastguard Worker Flush();
917*795d594fSAndroid Build Coastguard Worker }
918*795d594fSAndroid Build Coastguard Worker
VisitBasicBlock(HBasicBlock * block)919*795d594fSAndroid Build Coastguard Worker void VisitBasicBlock(HBasicBlock* block) override {
920*795d594fSAndroid Build Coastguard Worker StartTag("block");
921*795d594fSAndroid Build Coastguard Worker PrintProperty("name", block);
922*795d594fSAndroid Build Coastguard Worker if (block->GetLifetimeStart() != kNoLifetime) {
923*795d594fSAndroid Build Coastguard Worker // Piggy back on these fields to show the lifetime of the block.
924*795d594fSAndroid Build Coastguard Worker PrintInt("from_bci", block->GetLifetimeStart());
925*795d594fSAndroid Build Coastguard Worker PrintInt("to_bci", block->GetLifetimeEnd());
926*795d594fSAndroid Build Coastguard Worker } else if (!IsDebugDump()) {
927*795d594fSAndroid Build Coastguard Worker // Don't print useless information to logcat.
928*795d594fSAndroid Build Coastguard Worker PrintInt("from_bci", -1);
929*795d594fSAndroid Build Coastguard Worker PrintInt("to_bci", -1);
930*795d594fSAndroid Build Coastguard Worker }
931*795d594fSAndroid Build Coastguard Worker PrintPredecessors(block);
932*795d594fSAndroid Build Coastguard Worker PrintSuccessors(block);
933*795d594fSAndroid Build Coastguard Worker PrintExceptionHandlers(block);
934*795d594fSAndroid Build Coastguard Worker
935*795d594fSAndroid Build Coastguard Worker if (block->IsCatchBlock()) {
936*795d594fSAndroid Build Coastguard Worker PrintProperty("flags", "catch_block");
937*795d594fSAndroid Build Coastguard Worker } else if (block->IsTryBlock()) {
938*795d594fSAndroid Build Coastguard Worker std::stringstream flags_properties;
939*795d594fSAndroid Build Coastguard Worker flags_properties << "try_start "
940*795d594fSAndroid Build Coastguard Worker << namer_.GetName(block->GetTryCatchInformation()->GetTryEntry().GetBlock());
941*795d594fSAndroid Build Coastguard Worker PrintProperty("flags", flags_properties.str().c_str());
942*795d594fSAndroid Build Coastguard Worker } else if (!IsDebugDump()) {
943*795d594fSAndroid Build Coastguard Worker // Don't print useless information to logcat
944*795d594fSAndroid Build Coastguard Worker PrintEmptyProperty("flags");
945*795d594fSAndroid Build Coastguard Worker }
946*795d594fSAndroid Build Coastguard Worker
947*795d594fSAndroid Build Coastguard Worker if (block->GetDominator() != nullptr) {
948*795d594fSAndroid Build Coastguard Worker PrintProperty("dominator", block->GetDominator());
949*795d594fSAndroid Build Coastguard Worker }
950*795d594fSAndroid Build Coastguard Worker
951*795d594fSAndroid Build Coastguard Worker if (!IsDebugDump() || !block->GetPhis().IsEmpty()) {
952*795d594fSAndroid Build Coastguard Worker StartTag("states");
953*795d594fSAndroid Build Coastguard Worker StartTag("locals");
954*795d594fSAndroid Build Coastguard Worker PrintInt("size", 0);
955*795d594fSAndroid Build Coastguard Worker PrintProperty("method", "None");
956*795d594fSAndroid Build Coastguard Worker for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
957*795d594fSAndroid Build Coastguard Worker AddIndent();
958*795d594fSAndroid Build Coastguard Worker HInstruction* instruction = it.Current();
959*795d594fSAndroid Build Coastguard Worker output_ << instruction->GetId() << " " << DataType::TypeId(instruction->GetType())
960*795d594fSAndroid Build Coastguard Worker << instruction->GetId() << "[ ";
961*795d594fSAndroid Build Coastguard Worker for (const HInstruction* input : instruction->GetInputs()) {
962*795d594fSAndroid Build Coastguard Worker output_ << input->GetId() << " ";
963*795d594fSAndroid Build Coastguard Worker }
964*795d594fSAndroid Build Coastguard Worker output_ << "]\n";
965*795d594fSAndroid Build Coastguard Worker }
966*795d594fSAndroid Build Coastguard Worker EndTag("locals");
967*795d594fSAndroid Build Coastguard Worker EndTag("states");
968*795d594fSAndroid Build Coastguard Worker }
969*795d594fSAndroid Build Coastguard Worker
970*795d594fSAndroid Build Coastguard Worker StartTag("HIR");
971*795d594fSAndroid Build Coastguard Worker PrintInstructions(block->GetPhis());
972*795d594fSAndroid Build Coastguard Worker PrintInstructions(block->GetInstructions());
973*795d594fSAndroid Build Coastguard Worker EndTag("HIR");
974*795d594fSAndroid Build Coastguard Worker EndTag("block");
975*795d594fSAndroid Build Coastguard Worker }
976*795d594fSAndroid Build Coastguard Worker
977*795d594fSAndroid Build Coastguard Worker static constexpr const char* const kEndInstructionMarker = "<|@";
978*795d594fSAndroid Build Coastguard Worker static constexpr const char* const kDisassemblyBlockFrameEntry = "FrameEntry";
979*795d594fSAndroid Build Coastguard Worker static constexpr const char* const kDisassemblyBlockSlowPaths = "SlowPaths";
980*795d594fSAndroid Build Coastguard Worker
981*795d594fSAndroid Build Coastguard Worker private:
982*795d594fSAndroid Build Coastguard Worker std::ostream& output_;
983*795d594fSAndroid Build Coastguard Worker const char* pass_name_;
984*795d594fSAndroid Build Coastguard Worker const bool is_after_pass_;
985*795d594fSAndroid Build Coastguard Worker const bool graph_in_bad_state_;
986*795d594fSAndroid Build Coastguard Worker const CodeGenerator* codegen_;
987*795d594fSAndroid Build Coastguard Worker const DisassemblyInformation* disasm_info_;
988*795d594fSAndroid Build Coastguard Worker const BlockNamer& namer_;
989*795d594fSAndroid Build Coastguard Worker std::unique_ptr<HGraphVisualizerDisassembler> disassembler_;
990*795d594fSAndroid Build Coastguard Worker size_t indent_;
991*795d594fSAndroid Build Coastguard Worker
992*795d594fSAndroid Build Coastguard Worker DISALLOW_COPY_AND_ASSIGN(HGraphVisualizerPrinter);
993*795d594fSAndroid Build Coastguard Worker };
994*795d594fSAndroid Build Coastguard Worker
PrintName(std::ostream & os,HBasicBlock * blk) const995*795d594fSAndroid Build Coastguard Worker std::ostream& HGraphVisualizer::OptionalDefaultNamer::PrintName(std::ostream& os,
996*795d594fSAndroid Build Coastguard Worker HBasicBlock* blk) const {
997*795d594fSAndroid Build Coastguard Worker if (namer_) {
998*795d594fSAndroid Build Coastguard Worker return namer_->get().PrintName(os, blk);
999*795d594fSAndroid Build Coastguard Worker } else {
1000*795d594fSAndroid Build Coastguard Worker return BlockNamer::PrintName(os, blk);
1001*795d594fSAndroid Build Coastguard Worker }
1002*795d594fSAndroid Build Coastguard Worker }
1003*795d594fSAndroid Build Coastguard Worker
HGraphVisualizer(std::ostream * output,HGraph * graph,const CodeGenerator * codegen,std::optional<std::reference_wrapper<const BlockNamer>> namer)1004*795d594fSAndroid Build Coastguard Worker HGraphVisualizer::HGraphVisualizer(std::ostream* output,
1005*795d594fSAndroid Build Coastguard Worker HGraph* graph,
1006*795d594fSAndroid Build Coastguard Worker const CodeGenerator* codegen,
1007*795d594fSAndroid Build Coastguard Worker std::optional<std::reference_wrapper<const BlockNamer>> namer)
1008*795d594fSAndroid Build Coastguard Worker : output_(output), graph_(graph), codegen_(codegen), namer_(namer) {}
1009*795d594fSAndroid Build Coastguard Worker
PrintHeader(const char * method_name) const1010*795d594fSAndroid Build Coastguard Worker void HGraphVisualizer::PrintHeader(const char* method_name) const {
1011*795d594fSAndroid Build Coastguard Worker DCHECK(output_ != nullptr);
1012*795d594fSAndroid Build Coastguard Worker HGraphVisualizerPrinter printer(graph_, *output_, "", true, false, codegen_, namer_);
1013*795d594fSAndroid Build Coastguard Worker printer.StartTag("compilation");
1014*795d594fSAndroid Build Coastguard Worker printer.PrintProperty("name", method_name);
1015*795d594fSAndroid Build Coastguard Worker printer.PrintProperty("method", method_name);
1016*795d594fSAndroid Build Coastguard Worker printer.PrintTime("date");
1017*795d594fSAndroid Build Coastguard Worker printer.EndTag("compilation");
1018*795d594fSAndroid Build Coastguard Worker printer.Flush();
1019*795d594fSAndroid Build Coastguard Worker }
1020*795d594fSAndroid Build Coastguard Worker
InsertMetaDataAsCompilationBlock(const std::string & meta_data)1021*795d594fSAndroid Build Coastguard Worker std::string HGraphVisualizer::InsertMetaDataAsCompilationBlock(const std::string& meta_data) {
1022*795d594fSAndroid Build Coastguard Worker std::string time_str = std::to_string(time(nullptr));
1023*795d594fSAndroid Build Coastguard Worker std::string quoted_meta_data = "\"" + meta_data + "\"";
1024*795d594fSAndroid Build Coastguard Worker return StringPrintf("begin_compilation\n"
1025*795d594fSAndroid Build Coastguard Worker " name %s\n"
1026*795d594fSAndroid Build Coastguard Worker " method %s\n"
1027*795d594fSAndroid Build Coastguard Worker " date %s\n"
1028*795d594fSAndroid Build Coastguard Worker "end_compilation\n",
1029*795d594fSAndroid Build Coastguard Worker quoted_meta_data.c_str(),
1030*795d594fSAndroid Build Coastguard Worker quoted_meta_data.c_str(),
1031*795d594fSAndroid Build Coastguard Worker time_str.c_str());
1032*795d594fSAndroid Build Coastguard Worker }
1033*795d594fSAndroid Build Coastguard Worker
DumpGraphDebug() const1034*795d594fSAndroid Build Coastguard Worker void HGraphVisualizer::DumpGraphDebug() const {
1035*795d594fSAndroid Build Coastguard Worker DumpGraph(/* pass_name= */ kDebugDumpGraphName,
1036*795d594fSAndroid Build Coastguard Worker /* is_after_pass= */ false,
1037*795d594fSAndroid Build Coastguard Worker /* graph_in_bad_state= */ true);
1038*795d594fSAndroid Build Coastguard Worker }
1039*795d594fSAndroid Build Coastguard Worker
DumpGraph(const char * pass_name,bool is_after_pass,bool graph_in_bad_state) const1040*795d594fSAndroid Build Coastguard Worker void HGraphVisualizer::DumpGraph(const char* pass_name,
1041*795d594fSAndroid Build Coastguard Worker bool is_after_pass,
1042*795d594fSAndroid Build Coastguard Worker bool graph_in_bad_state) const {
1043*795d594fSAndroid Build Coastguard Worker DCHECK(output_ != nullptr);
1044*795d594fSAndroid Build Coastguard Worker if (!graph_->GetBlocks().empty()) {
1045*795d594fSAndroid Build Coastguard Worker HGraphVisualizerPrinter printer(graph_,
1046*795d594fSAndroid Build Coastguard Worker *output_,
1047*795d594fSAndroid Build Coastguard Worker pass_name,
1048*795d594fSAndroid Build Coastguard Worker is_after_pass,
1049*795d594fSAndroid Build Coastguard Worker graph_in_bad_state,
1050*795d594fSAndroid Build Coastguard Worker codegen_,
1051*795d594fSAndroid Build Coastguard Worker namer_);
1052*795d594fSAndroid Build Coastguard Worker printer.Run();
1053*795d594fSAndroid Build Coastguard Worker }
1054*795d594fSAndroid Build Coastguard Worker }
1055*795d594fSAndroid Build Coastguard Worker
DumpGraphWithDisassembly() const1056*795d594fSAndroid Build Coastguard Worker void HGraphVisualizer::DumpGraphWithDisassembly() const {
1057*795d594fSAndroid Build Coastguard Worker DCHECK(output_ != nullptr);
1058*795d594fSAndroid Build Coastguard Worker if (!graph_->GetBlocks().empty()) {
1059*795d594fSAndroid Build Coastguard Worker HGraphVisualizerPrinter printer(graph_,
1060*795d594fSAndroid Build Coastguard Worker *output_,
1061*795d594fSAndroid Build Coastguard Worker "disassembly",
1062*795d594fSAndroid Build Coastguard Worker /* is_after_pass= */ true,
1063*795d594fSAndroid Build Coastguard Worker /* graph_in_bad_state= */ false,
1064*795d594fSAndroid Build Coastguard Worker codegen_,
1065*795d594fSAndroid Build Coastguard Worker namer_,
1066*795d594fSAndroid Build Coastguard Worker codegen_->GetDisassemblyInformation());
1067*795d594fSAndroid Build Coastguard Worker printer.Run();
1068*795d594fSAndroid Build Coastguard Worker }
1069*795d594fSAndroid Build Coastguard Worker }
1070*795d594fSAndroid Build Coastguard Worker
DumpInstruction(std::ostream * output,HGraph * graph,HInstruction * instruction)1071*795d594fSAndroid Build Coastguard Worker void HGraphVisualizer::DumpInstruction(std::ostream* output,
1072*795d594fSAndroid Build Coastguard Worker HGraph* graph,
1073*795d594fSAndroid Build Coastguard Worker HInstruction* instruction) {
1074*795d594fSAndroid Build Coastguard Worker BlockNamer namer;
1075*795d594fSAndroid Build Coastguard Worker HGraphVisualizerPrinter printer(graph,
1076*795d594fSAndroid Build Coastguard Worker *output,
1077*795d594fSAndroid Build Coastguard Worker /* pass_name= */ kDebugDumpName,
1078*795d594fSAndroid Build Coastguard Worker /* is_after_pass= */ false,
1079*795d594fSAndroid Build Coastguard Worker /* graph_in_bad_state= */ false,
1080*795d594fSAndroid Build Coastguard Worker /* codegen= */ nullptr,
1081*795d594fSAndroid Build Coastguard Worker /* namer= */ namer);
1082*795d594fSAndroid Build Coastguard Worker printer.Run(instruction);
1083*795d594fSAndroid Build Coastguard Worker }
1084*795d594fSAndroid Build Coastguard Worker
1085*795d594fSAndroid Build Coastguard Worker } // namespace art
1086