20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
|
25 /* |
|
26 * This file has been modified by Loongson Technology in 2015. These |
|
27 * modifications are Copyright (c) 2015 Loongson Technology, and are made |
|
28 * available on the same license terms set forth above. |
|
29 */ |
|
30 |
25 #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP |
31 #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP |
26 #define SHARE_VM_C1_C1_LIRGENERATOR_HPP |
32 #define SHARE_VM_C1_C1_LIRGENERATOR_HPP |
27 |
33 |
28 #include "c1/c1_Instruction.hpp" |
34 #include "c1/c1_Instruction.hpp" |
29 #include "c1/c1_LIR.hpp" |
35 #include "c1/c1_LIR.hpp" |
184 // a simple cache of constants used within a block |
190 // a simple cache of constants used within a block |
185 GrowableArray<LIR_Const*> _constants; |
191 GrowableArray<LIR_Const*> _constants; |
186 LIR_OprList _reg_for_constants; |
192 LIR_OprList _reg_for_constants; |
187 Values _unpinned_constants; |
193 Values _unpinned_constants; |
188 |
194 |
|
195 #ifdef MIPS64 |
|
196 LIR_Const* _card_table_base; |
|
197 #endif |
189 friend class PhiResolver; |
198 friend class PhiResolver; |
190 |
199 |
191 // unified bailout support |
200 // unified bailout support |
192 void bailout(const char* msg) const { compilation()->bailout(msg); } |
201 void bailout(const char* msg) const { compilation()->bailout(msg); } |
193 bool bailed_out() const { return compilation()->bailed_out(); } |
202 bool bailed_out() const { return compilation()->bailed_out(); } |
204 |
213 |
205 // get a constant into a register and get track of what register was used |
214 // get a constant into a register and get track of what register was used |
206 LIR_Opr load_constant(Constant* x); |
215 LIR_Opr load_constant(Constant* x); |
207 LIR_Opr load_constant(LIR_Const* constant); |
216 LIR_Opr load_constant(LIR_Const* constant); |
208 |
217 |
|
218 #ifdef MIPS64 |
|
219 LIR_Const* card_table_base() const { |
|
220 return _card_table_base; |
|
221 } |
|
222 #endif |
209 // Given an immediate value, return an operand usable in logical ops. |
223 // Given an immediate value, return an operand usable in logical ops. |
210 LIR_Opr load_immediate(int x, BasicType type); |
224 LIR_Opr load_immediate(int x, BasicType type); |
211 |
225 |
212 void set_result(Value x, LIR_Opr opr) { |
226 void set_result(Value x, LIR_Opr opr) { |
213 assert(opr->is_valid(), "must set to valid value"); |
227 assert(opr->is_valid(), "must set to valid value"); |
224 friend class LIRItem; |
238 friend class LIRItem; |
225 |
239 |
226 LIR_Opr round_item(LIR_Opr opr); |
240 LIR_Opr round_item(LIR_Opr opr); |
227 LIR_Opr force_to_spill(LIR_Opr value, BasicType t); |
241 LIR_Opr force_to_spill(LIR_Opr value, BasicType t); |
228 |
242 |
|
243 #ifdef MIPS64 |
|
244 void profile_branch(If* if_instr, If::Condition cond, LIR_Opr left, LIR_Opr right); |
|
245 #endif |
229 PhiResolverState& resolver_state() { return _resolver_state; } |
246 PhiResolverState& resolver_state() { return _resolver_state; } |
230 |
247 |
231 void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val); |
248 void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val); |
232 void move_to_phi(ValueStack* cur_state); |
249 void move_to_phi(ValueStack* cur_state); |
233 |
250 |
328 void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right); |
345 void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right); |
329 |
346 |
330 void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info); |
347 void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info); |
331 void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no); |
348 void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no); |
332 |
349 |
|
350 #ifndef MIPS64 |
333 void 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); |
351 void 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); |
|
352 #else |
|
353 void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr scratch5, LIR_Opr scratch6, LIR_Opr klass_reg, CodeEmitInfo* info); |
|
354 #endif |
334 |
355 |
335 // machine dependent |
356 // machine dependent |
336 void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); |
357 void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); |
337 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info); |
358 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info); |
338 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info); |
359 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info); |
350 LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) { |
371 LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) { |
351 return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type); |
372 return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type); |
352 } |
373 } |
353 LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark); |
374 LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark); |
354 |
375 |
|
376 #ifdef MIPS64 |
|
377 void write_barrier(LIR_Opr addr); |
|
378 #endif |
355 // the helper for generate_address |
379 // the helper for generate_address |
356 void add_large_constant(LIR_Opr src, int c, LIR_Opr dest); |
380 void add_large_constant(LIR_Opr src, int c, LIR_Opr dest); |
357 |
381 |
358 // machine preferences and characteristics |
382 // machine preferences and characteristics |
359 bool can_inline_as_constant(Value i) const; |
383 bool can_inline_as_constant(Value i) const; |