Path: blob/master/src/hotspot/share/c1/c1_LIRGenerator.hpp
40930 views
/*1* Copyright (c) 2005, 2021, 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_LIRGENERATOR_HPP25#define SHARE_C1_C1_LIRGENERATOR_HPP2627#include "c1/c1_Decorators.hpp"28#include "c1/c1_Instruction.hpp"29#include "c1/c1_LIR.hpp"30#include "ci/ciMethodData.hpp"31#include "gc/shared/barrierSet.hpp"32#include "jfr/support/jfrIntrinsics.hpp"33#include "utilities/macros.hpp"34#include "utilities/sizes.hpp"3536class BarrierSetC1;3738// The classes responsible for code emission and register allocation394041class LIRGenerator;42class LIREmitter;43class Invoke;44class LIRItem;4546typedef GrowableArray<LIRItem*> LIRItemList;4748class C1SwitchRange: public CompilationResourceObj {49private:50int _low_key;51int _high_key;52BlockBegin* _sux;53public:54C1SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}55void set_high_key(int key) { _high_key = key; }5657int high_key() const { return _high_key; }58int low_key() const { return _low_key; }59BlockBegin* sux() const { return _sux; }60};6162typedef GrowableArray<C1SwitchRange*> SwitchRangeArray;63typedef GrowableArray<C1SwitchRange*> SwitchRangeList;6465class ResolveNode;6667typedef GrowableArray<ResolveNode*> NodeList;6869// Node objects form a directed graph of LIR_Opr70// Edges between Nodes represent moves from one Node to its destinations71class ResolveNode: public CompilationResourceObj {72private:73LIR_Opr _operand; // the source or destinaton74NodeList _destinations; // for the operand75bool _assigned; // Value assigned to this Node?76bool _visited; // Node already visited?77bool _start_node; // Start node already visited?7879public:80ResolveNode(LIR_Opr operand)81: _operand(operand)82, _assigned(false)83, _visited(false)84, _start_node(false) {};8586// accessors87LIR_Opr operand() const { return _operand; }88int no_of_destinations() const { return _destinations.length(); }89ResolveNode* destination_at(int i) { return _destinations.at(i); }90bool assigned() const { return _assigned; }91bool visited() const { return _visited; }92bool start_node() const { return _start_node; }9394// modifiers95void append(ResolveNode* dest) { _destinations.append(dest); }96void set_assigned() { _assigned = true; }97void set_visited() { _visited = true; }98void set_start_node() { _start_node = true; }99};100101102// This is shared state to be used by the PhiResolver so the operand103// arrays don't have to be reallocated for each resolution.104class PhiResolverState: public CompilationResourceObj {105friend class PhiResolver;106107private:108NodeList _virtual_operands; // Nodes where the operand is a virtual register109NodeList _other_operands; // Nodes where the operand is not a virtual register110NodeList _vreg_table; // Mapping from virtual register to Node111112public:113PhiResolverState() {}114115void reset();116};117118119// class used to move value of phi operand to phi function120class PhiResolver: public CompilationResourceObj {121private:122LIRGenerator* _gen;123PhiResolverState& _state; // temporary state cached by LIRGenerator124125ResolveNode* _loop;126LIR_Opr _temp;127128// access to shared state arrays129NodeList& virtual_operands() { return _state._virtual_operands; }130NodeList& other_operands() { return _state._other_operands; }131NodeList& vreg_table() { return _state._vreg_table; }132133ResolveNode* create_node(LIR_Opr opr, bool source);134ResolveNode* source_node(LIR_Opr opr) { return create_node(opr, true); }135ResolveNode* destination_node(LIR_Opr opr) { return create_node(opr, false); }136137void emit_move(LIR_Opr src, LIR_Opr dest);138void move_to_temp(LIR_Opr src);139void move_temp_to(LIR_Opr dest);140void move(ResolveNode* src, ResolveNode* dest);141142LIRGenerator* gen() {143return _gen;144}145146public:147PhiResolver(LIRGenerator* _lir_gen);148~PhiResolver();149150void move(LIR_Opr src, LIR_Opr dest);151};152153154// only the classes below belong in the same file155class LIRGenerator: public InstructionVisitor, public BlockClosure {156// LIRGenerator should never get instatiated on the heap.157private:158void* operator new(size_t size) throw();159void* operator new[](size_t size) throw();160void operator delete(void* p) { ShouldNotReachHere(); }161void operator delete[](void* p) { ShouldNotReachHere(); }162163Compilation* _compilation;164ciMethod* _method; // method that we are compiling165PhiResolverState _resolver_state;166BlockBegin* _block;167int _virtual_register_number;168Values _instruction_for_operand;169BitMap2D _vreg_flags; // flags which can be set on a per-vreg basis170LIR_List* _lir;171172LIRGenerator* gen() {173return this;174}175176void print_if_not_loaded(const NewInstance* new_instance) PRODUCT_RETURN;177178public:179#ifdef ASSERT180LIR_List* lir(const char * file, int line) const {181_lir->set_file_and_line(file, line);182return _lir;183}184#endif185LIR_List* lir() const {186return _lir;187}188189private:190// a simple cache of constants used within a block191GrowableArray<LIR_Const*> _constants;192LIR_OprList _reg_for_constants;193Values _unpinned_constants;194195friend class PhiResolver;196197public:198// unified bailout support199void bailout(const char* msg) const { compilation()->bailout(msg); }200bool bailed_out() const { return compilation()->bailed_out(); }201202void block_do_prolog(BlockBegin* block);203void block_do_epilog(BlockBegin* block);204205// register allocation206LIR_Opr rlock(Value instr); // lock a free register207LIR_Opr rlock_result(Value instr);208LIR_Opr rlock_result(Value instr, BasicType type);209LIR_Opr rlock_byte(BasicType type);210LIR_Opr rlock_callee_saved(BasicType type);211212// get a constant into a register and get track of what register was used213LIR_Opr load_constant(Constant* x);214LIR_Opr load_constant(LIR_Const* constant);215216// Given an immediate value, return an operand usable in logical ops.217LIR_Opr load_immediate(int x, BasicType type);218219void set_result(Value x, LIR_Opr opr) {220assert(opr->is_valid(), "must set to valid value");221assert(x->operand()->is_illegal(), "operand should never change");222assert(!opr->is_register() || opr->is_virtual(), "should never set result to a physical register");223x->set_operand(opr);224assert(opr == x->operand(), "must be");225if (opr->is_virtual()) {226_instruction_for_operand.at_put_grow(opr->vreg_number(), x, NULL);227}228}229void set_no_result(Value x) { assert(!x->has_uses(), "can't have use"); x->clear_operand(); }230231friend class LIRItem;232233LIR_Opr round_item(LIR_Opr opr);234LIR_Opr force_to_spill(LIR_Opr value, BasicType t);235236PhiResolverState& resolver_state() { return _resolver_state; }237238void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val);239void move_to_phi(ValueStack* cur_state);240241// platform dependent242LIR_Opr getThreadPointer();243244private:245// code emission246void do_ArithmeticOp_Long(ArithmeticOp* x);247void do_ArithmeticOp_Int (ArithmeticOp* x);248void do_ArithmeticOp_FPU (ArithmeticOp* x);249250void do_RegisterFinalizer(Intrinsic* x);251void do_isInstance(Intrinsic* x);252void do_isPrimitive(Intrinsic* x);253void do_getModifiers(Intrinsic* x);254void do_getClass(Intrinsic* x);255void do_currentThread(Intrinsic* x);256void do_getObjectSize(Intrinsic* x);257void do_FmaIntrinsic(Intrinsic* x);258void do_MathIntrinsic(Intrinsic* x);259void do_LibmIntrinsic(Intrinsic* x);260void do_ArrayCopy(Intrinsic* x);261void do_CompareAndSwap(Intrinsic* x, ValueType* type);262void do_NIOCheckIndex(Intrinsic* x);263void do_FPIntrinsics(Intrinsic* x);264void do_Reference_get(Intrinsic* x);265void do_update_CRC32(Intrinsic* x);266void do_update_CRC32C(Intrinsic* x);267void do_vectorizedMismatch(Intrinsic* x);268void do_blackhole(Intrinsic* x);269270public:271LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info);272LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info);273274// convenience functions275LIR_Opr call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info);276LIR_Opr call_runtime(Value arg1, Value arg2, address entry, ValueType* result_type, CodeEmitInfo* info);277278// Access API279280private:281BarrierSetC1 *_barrier_set;282283public:284void access_store_at(DecoratorSet decorators, BasicType type,285LIRItem& base, LIR_Opr offset, LIR_Opr value,286CodeEmitInfo* patch_info = NULL, CodeEmitInfo* store_emit_info = NULL);287288void access_load_at(DecoratorSet decorators, BasicType type,289LIRItem& base, LIR_Opr offset, LIR_Opr result,290CodeEmitInfo* patch_info = NULL, CodeEmitInfo* load_emit_info = NULL);291292void access_load(DecoratorSet decorators, BasicType type,293LIR_Opr addr, LIR_Opr result);294295LIR_Opr access_atomic_cmpxchg_at(DecoratorSet decorators, BasicType type,296LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value);297298LIR_Opr access_atomic_xchg_at(DecoratorSet decorators, BasicType type,299LIRItem& base, LIRItem& offset, LIRItem& value);300301LIR_Opr access_atomic_add_at(DecoratorSet decorators, BasicType type,302LIRItem& base, LIRItem& offset, LIRItem& value);303304// These need to guarantee JMM volatile semantics are preserved on each platform305// and requires one implementation per architecture.306LIR_Opr atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value);307LIR_Opr atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& new_value);308LIR_Opr atomic_add(BasicType type, LIR_Opr addr, LIRItem& new_value);309310#ifdef CARDTABLEBARRIERSET_POST_BARRIER_HELPER311virtual void CardTableBarrierSet_post_barrier_helper(LIR_OprDesc* addr, LIR_Const* card_table_base);312#endif313314// specific implementations315void array_store_check(LIR_Opr value, LIR_Opr array, CodeEmitInfo* store_check_info, ciMethod* profiled_method, int profiled_bci);316317static LIR_Opr result_register_for(ValueType* type, bool callee = false);318319ciObject* get_jobject_constant(Value value);320321LIRItemList* invoke_visit_arguments(Invoke* x);322void invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list);323324void trace_block_entry(BlockBegin* block);325326// volatile field operations are never patchable because a klass327// must be loaded to know it's volatile which means that the offset328// it always known as well.329void volatile_field_store(LIR_Opr value, LIR_Address* address, CodeEmitInfo* info);330void volatile_field_load(LIR_Address* address, LIR_Opr result, CodeEmitInfo* info);331332void put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, BasicType type, bool is_volatile);333void get_Object_unsafe(LIR_Opr dest, LIR_Opr src, LIR_Opr offset, BasicType type, bool is_volatile);334335void arithmetic_call_op (Bytecodes::Code code, LIR_Opr result, LIR_OprList* args);336337void increment_counter(address counter, BasicType type, int step = 1);338void increment_counter(LIR_Address* addr, int step = 1);339340void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, LIR_Opr tmp, CodeEmitInfo* info = NULL);341// machine dependent. returns true if it emitted code for the multiply342bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp);343344void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);345346void klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve = false);347348// this loads the length and compares against the index349void array_range_check (LIR_Opr array, LIR_Opr index, CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info);350// For java.nio.Buffer.checkIndex351void nio_range_check (LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info);352353void arithmetic_op_int (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, LIR_Opr tmp);354void arithmetic_op_long (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info = NULL);355void arithmetic_op_fpu (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, LIR_Opr tmp = LIR_OprFact::illegalOpr);356357void shift_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr value, LIR_Opr count, LIR_Opr tmp);358359void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right);360361void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info);362void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no);363364void new_instance (LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info);365366// machine dependent367void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info);368void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info);369370void arraycopy_helper(Intrinsic* x, int* flags, ciArrayKlass** expected_type);371372// returns a LIR_Address to address an array location. May also373// emit some code as part of address calculation. If374// needs_card_mark is true then compute the full address for use by375// both the store and the card mark.376LIR_Address* generate_address(LIR_Opr base,377LIR_Opr index, int shift,378int disp,379BasicType type);380LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) {381return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type);382}383LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type);384385// the helper for generate_address386void add_large_constant(LIR_Opr src, int c, LIR_Opr dest);387388// machine preferences and characteristics389bool can_inline_as_constant(Value i S390_ONLY(COMMA int bits = 20)) const;390bool can_inline_as_constant(LIR_Const* c) const;391bool can_store_as_constant(Value i, BasicType type) const;392393LIR_Opr safepoint_poll_register();394395void profile_branch(If* if_instr, If::Condition cond);396void increment_event_counter_impl(CodeEmitInfo* info,397ciMethod *method, LIR_Opr step, int frequency,398int bci, bool backedge, bool notify);399void increment_event_counter(CodeEmitInfo* info, LIR_Opr step, int bci, bool backedge);400void increment_invocation_counter(CodeEmitInfo *info) {401if (compilation()->count_invocations()) {402increment_event_counter(info, LIR_OprFact::intConst(InvocationCounter::count_increment), InvocationEntryBci, false);403}404}405void increment_backedge_counter(CodeEmitInfo* info, int bci) {406if (compilation()->count_backedges()) {407increment_event_counter(info, LIR_OprFact::intConst(InvocationCounter::count_increment), bci, true);408}409}410void increment_backedge_counter_conditionally(LIR_Condition cond, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info, int left_bci, int right_bci, int bci);411void increment_backedge_counter(CodeEmitInfo* info, LIR_Opr step, int bci) {412if (compilation()->count_backedges()) {413increment_event_counter(info, step, bci, true);414}415}416void decrement_age(CodeEmitInfo* info);417CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false);418CodeEmitInfo* state_for(Instruction* x);419420// allocates a virtual register for this instruction if421// one isn't already allocated. Only for Phi and Local.422LIR_Opr operand_for_instruction(Instruction *x);423424void set_block(BlockBegin* block) { _block = block; }425426void block_prolog(BlockBegin* block);427void block_epilog(BlockBegin* block);428429void do_root (Instruction* instr);430void walk (Instruction* instr);431432void bind_block_entry(BlockBegin* block);433void start_block(BlockBegin* block);434435LIR_Opr new_register(BasicType type);436LIR_Opr new_register(Value value) { return new_register(as_BasicType(value->type())); }437LIR_Opr new_register(ValueType* type) { return new_register(as_BasicType(type)); }438439// returns a register suitable for doing pointer math440LIR_Opr new_pointer_register() {441#ifdef _LP64442return new_register(T_LONG);443#else444return new_register(T_INT);445#endif446}447448static LIR_Condition lir_cond(If::Condition cond) {449LIR_Condition l = lir_cond_unknown;450switch (cond) {451case If::eql: l = lir_cond_equal; break;452case If::neq: l = lir_cond_notEqual; break;453case If::lss: l = lir_cond_less; break;454case If::leq: l = lir_cond_lessEqual; break;455case If::geq: l = lir_cond_greaterEqual; break;456case If::gtr: l = lir_cond_greater; break;457case If::aeq: l = lir_cond_aboveEqual; break;458case If::beq: l = lir_cond_belowEqual; break;459default: fatal("You must pass valid If::Condition");460};461return l;462}463464#ifdef __SOFTFP__465void do_soft_float_compare(If *x);466#endif // __SOFTFP__467468SwitchRangeArray* create_lookup_ranges(TableSwitch* x);469SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);470void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);471472#ifdef JFR_HAVE_INTRINSICS473void do_ClassIDIntrinsic(Intrinsic* x);474void do_getEventWriter(Intrinsic* x);475#endif476477void do_RuntimeCall(address routine, Intrinsic* x);478479ciKlass* profile_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k,480Value arg, LIR_Opr& mdp, bool not_null, ciKlass* signature_at_call_k,481ciKlass* callee_signature_k);482void profile_arguments(ProfileCall* x);483void profile_parameters(Base* x);484void profile_parameters_at_call(ProfileCall* x);485LIR_Opr mask_boolean(LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info);486LIR_Opr maybe_mask_boolean(StoreIndexed* x, LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info);487488public:489Compilation* compilation() const { return _compilation; }490FrameMap* frame_map() const { return _compilation->frame_map(); }491ciMethod* method() const { return _method; }492BlockBegin* block() const { return _block; }493IRScope* scope() const { return block()->scope(); }494495int max_virtual_register_number() const { return _virtual_register_number; }496497void block_do(BlockBegin* block);498499// Flags that can be set on vregs500enum VregFlag {501must_start_in_memory = 0 // needs to be assigned a memory location at beginning, but may then be loaded in a register502, callee_saved = 1 // must be in a callee saved register503, byte_reg = 2 // must be in a byte register504, num_vreg_flags505506};507508LIRGenerator(Compilation* compilation, ciMethod* method)509: _compilation(compilation)510, _method(method)511, _virtual_register_number(LIR_OprDesc::vreg_base)512, _vreg_flags(num_vreg_flags)513, _barrier_set(BarrierSet::barrier_set()->barrier_set_c1()) {514}515516// for virtual registers, maps them back to Phi's or Local's517Instruction* instruction_for_opr(LIR_Opr opr);518Instruction* instruction_for_vreg(int reg_num);519520void set_vreg_flag (int vreg_num, VregFlag f);521bool is_vreg_flag_set(int vreg_num, VregFlag f);522void set_vreg_flag (LIR_Opr opr, VregFlag f) { set_vreg_flag(opr->vreg_number(), f); }523bool is_vreg_flag_set(LIR_Opr opr, VregFlag f) { return is_vreg_flag_set(opr->vreg_number(), f); }524525// statics526static LIR_Opr exceptionOopOpr();527static LIR_Opr exceptionPcOpr();528static LIR_Opr divInOpr();529static LIR_Opr divOutOpr();530static LIR_Opr remOutOpr();531#ifdef S390532// On S390 we can do ldiv, lrem without RT call.533static LIR_Opr ldivInOpr();534static LIR_Opr ldivOutOpr();535static LIR_Opr lremOutOpr();536#endif537static LIR_Opr shiftCountOpr();538LIR_Opr syncLockOpr();539LIR_Opr syncTempOpr();540LIR_Opr atomicLockOpr();541542// returns a register suitable for saving the thread in a543// call_runtime_leaf if one is needed.544LIR_Opr getThreadTemp();545546// visitor functionality547virtual void do_Phi (Phi* x);548virtual void do_Local (Local* x);549virtual void do_Constant (Constant* x);550virtual void do_LoadField (LoadField* x);551virtual void do_StoreField (StoreField* x);552virtual void do_ArrayLength (ArrayLength* x);553virtual void do_LoadIndexed (LoadIndexed* x);554virtual void do_StoreIndexed (StoreIndexed* x);555virtual void do_NegateOp (NegateOp* x);556virtual void do_ArithmeticOp (ArithmeticOp* x);557virtual void do_ShiftOp (ShiftOp* x);558virtual void do_LogicOp (LogicOp* x);559virtual void do_CompareOp (CompareOp* x);560virtual void do_IfOp (IfOp* x);561virtual void do_Convert (Convert* x);562virtual void do_NullCheck (NullCheck* x);563virtual void do_TypeCast (TypeCast* x);564virtual void do_Invoke (Invoke* x);565virtual void do_NewInstance (NewInstance* x);566virtual void do_NewTypeArray (NewTypeArray* x);567virtual void do_NewObjectArray (NewObjectArray* x);568virtual void do_NewMultiArray (NewMultiArray* x);569virtual void do_CheckCast (CheckCast* x);570virtual void do_InstanceOf (InstanceOf* x);571virtual void do_MonitorEnter (MonitorEnter* x);572virtual void do_MonitorExit (MonitorExit* x);573virtual void do_Intrinsic (Intrinsic* x);574virtual void do_BlockBegin (BlockBegin* x);575virtual void do_Goto (Goto* x);576virtual void do_If (If* x);577virtual void do_TableSwitch (TableSwitch* x);578virtual void do_LookupSwitch (LookupSwitch* x);579virtual void do_Return (Return* x);580virtual void do_Throw (Throw* x);581virtual void do_Base (Base* x);582virtual void do_OsrEntry (OsrEntry* x);583virtual void do_ExceptionObject(ExceptionObject* x);584virtual void do_RoundFP (RoundFP* x);585virtual void do_UnsafeGetRaw (UnsafeGetRaw* x);586virtual void do_UnsafePutRaw (UnsafePutRaw* x);587virtual void do_UnsafeGetObject(UnsafeGetObject* x);588virtual void do_UnsafePutObject(UnsafePutObject* x);589virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);590virtual void do_ProfileCall (ProfileCall* x);591virtual void do_ProfileReturnType (ProfileReturnType* x);592virtual void do_ProfileInvoke (ProfileInvoke* x);593virtual void do_RuntimeCall (RuntimeCall* x);594virtual void do_MemBar (MemBar* x);595virtual void do_RangeCheckPredicate(RangeCheckPredicate* x);596#ifdef ASSERT597virtual void do_Assert (Assert* x);598#endif599600#ifdef C1_LIRGENERATOR_MD_HPP601#include C1_LIRGENERATOR_MD_HPP602#endif603};604605606class LIRItem: public CompilationResourceObj {607private:608Value _value;609LIRGenerator* _gen;610LIR_Opr _result;611bool _destroys_register;612LIR_Opr _new_result;613614LIRGenerator* gen() const { return _gen; }615616public:617LIRItem(Value value, LIRGenerator* gen) {618_destroys_register = false;619_gen = gen;620set_instruction(value);621}622623LIRItem(LIRGenerator* gen) {624_destroys_register = false;625_gen = gen;626_result = LIR_OprFact::illegalOpr;627set_instruction(NULL);628}629630void set_instruction(Value value) {631_value = value;632_result = LIR_OprFact::illegalOpr;633if (_value != NULL) {634_gen->walk(_value);635_result = _value->operand();636}637_new_result = LIR_OprFact::illegalOpr;638}639640Value value() const { return _value; }641ValueType* type() const { return value()->type(); }642LIR_Opr result() {643assert(!_destroys_register || (!_result->is_register() || _result->is_virtual()),644"shouldn't use set_destroys_register with physical regsiters");645if (_destroys_register && _result->is_register()) {646if (_new_result->is_illegal()) {647_new_result = _gen->new_register(type());648gen()->lir()->move(_result, _new_result);649}650return _new_result;651} else {652return _result;653}654return _result;655}656657void set_result(LIR_Opr opr);658659void load_item();660void load_byte_item();661void load_nonconstant(S390_ONLY(int bits = 20));662// load any values which can't be expressed as part of a single store instruction663void load_for_store(BasicType store_type);664void load_item_force(LIR_Opr reg);665666void dont_load_item() {667// do nothing668}669670void set_destroys_register() {671_destroys_register = true;672}673674bool is_constant() const { return value()->as_Constant() != NULL; }675bool is_stack() { return result()->is_stack(); }676bool is_register() { return result()->is_register(); }677678ciObject* get_jobject_constant() const;679jint get_jint_constant() const;680jlong get_jlong_constant() const;681jfloat get_jfloat_constant() const;682jdouble get_jdouble_constant() const;683jint get_address_constant() const;684};685686#endif // SHARE_C1_C1_LIRGENERATOR_HPP687688689