Path: blob/master/src/hotspot/share/c1/c1_InstructionPrinter.hpp
40930 views
/*1* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_C1_C1_INSTRUCTIONPRINTER_HPP25#define SHARE_C1_C1_INSTRUCTIONPRINTER_HPP2627#include "c1/c1_IR.hpp"28#include "c1/c1_Instruction.hpp"29#include "c1/c1_Runtime1.hpp"3031#ifndef PRODUCT32class InstructionPrinter: public InstructionVisitor {33private:34outputStream* _output;35bool _print_phis;3637enum LayoutConstants {38bci_pos = 2,39use_pos = 7,40temp_pos = 12,41instr_pos = 19,42end_pos = 6043};4445bool is_illegal_phi(Value v);4647public:48InstructionPrinter(bool print_phis = true, outputStream* output = tty)49: _output(output)50, _print_phis(print_phis)51{}5253outputStream* output() { return _output; }5455// helpers56static const char* basic_type_name(BasicType type);57static const char* cond_name(If::Condition cond);58static const char* op_name(Bytecodes::Code op);59bool is_phi_of_block(Value v, BlockBegin* b);6061// type-specific print functions62void print_klass(ciKlass* klass);63void print_object(Value obj);6465// generic print functions66void print_temp(Value value);67void print_field(AccessField* field);68void print_indexed(AccessIndexed* indexed);69void print_monitor(AccessMonitor* monitor);70void print_op2(Op2* instr);71void print_value(Value value);72void print_instr(Instruction* instr);73void print_stack(ValueStack* stack);74void print_inline_level(BlockBegin* block);75void print_unsafe_op(UnsafeOp* op, const char* name);76void print_unsafe_raw_op(UnsafeRawOp* op, const char* name);77void print_unsafe_object_op(UnsafeObjectOp* op, const char* name);78void print_phi(int i, Value v, BlockBegin* b);79void print_alias(Value v);8081// line printing of instructions82void fill_to(int pos, char filler = ' ');83void print_head();84void print_line(Instruction* instr);8586// visitor functionality87virtual void do_Phi (Phi* x);88virtual void do_Local (Local* x);89virtual void do_Constant (Constant* x);90virtual void do_LoadField (LoadField* x);91virtual void do_StoreField (StoreField* x);92virtual void do_ArrayLength (ArrayLength* x);93virtual void do_LoadIndexed (LoadIndexed* x);94virtual void do_StoreIndexed (StoreIndexed* x);95virtual void do_NegateOp (NegateOp* x);96virtual void do_ArithmeticOp (ArithmeticOp* x);97virtual void do_ShiftOp (ShiftOp* x);98virtual void do_LogicOp (LogicOp* x);99virtual void do_CompareOp (CompareOp* x);100virtual void do_IfOp (IfOp* x);101virtual void do_Convert (Convert* x);102virtual void do_NullCheck (NullCheck* x);103virtual void do_TypeCast (TypeCast* x);104virtual void do_Invoke (Invoke* x);105virtual void do_NewInstance (NewInstance* x);106virtual void do_NewTypeArray (NewTypeArray* x);107virtual void do_NewObjectArray (NewObjectArray* x);108virtual void do_NewMultiArray (NewMultiArray* x);109virtual void do_CheckCast (CheckCast* x);110virtual void do_InstanceOf (InstanceOf* x);111virtual void do_MonitorEnter (MonitorEnter* x);112virtual void do_MonitorExit (MonitorExit* x);113virtual void do_Intrinsic (Intrinsic* x);114virtual void do_BlockBegin (BlockBegin* x);115virtual void do_Goto (Goto* x);116virtual void do_If (If* x);117virtual void do_TableSwitch (TableSwitch* x);118virtual void do_LookupSwitch (LookupSwitch* x);119virtual void do_Return (Return* x);120virtual void do_Throw (Throw* x);121virtual void do_Base (Base* x);122virtual void do_OsrEntry (OsrEntry* x);123virtual void do_ExceptionObject(ExceptionObject* x);124virtual void do_RoundFP (RoundFP* x);125virtual void do_UnsafeGetRaw (UnsafeGetRaw* x);126virtual void do_UnsafePutRaw (UnsafePutRaw* x);127virtual void do_UnsafeGetObject(UnsafeGetObject* x);128virtual void do_UnsafePutObject(UnsafePutObject* x);129virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);130virtual void do_ProfileCall (ProfileCall* x);131virtual void do_ProfileReturnType (ProfileReturnType* x);132virtual void do_ProfileInvoke (ProfileInvoke* x);133virtual void do_RuntimeCall (RuntimeCall* x);134virtual void do_MemBar (MemBar* x);135virtual void do_RangeCheckPredicate(RangeCheckPredicate* x);136#ifdef ASSERT137virtual void do_Assert (Assert* x);138#endif139};140#endif // PRODUCT141142#endif // SHARE_C1_C1_INSTRUCTIONPRINTER_HPP143144145