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" |
182 // a simple cache of constants used within a block |
188 // a simple cache of constants used within a block |
183 GrowableArray<LIR_Const*> _constants; |
189 GrowableArray<LIR_Const*> _constants; |
184 LIR_OprList _reg_for_constants; |
190 LIR_OprList _reg_for_constants; |
185 Values _unpinned_constants; |
191 Values _unpinned_constants; |
186 |
192 |
|
193 #ifdef MIPS64 |
|
194 LIR_Const* _card_table_base; |
|
195 #endif |
187 friend class PhiResolver; |
196 friend class PhiResolver; |
188 |
197 |
189 // unified bailout support |
198 // unified bailout support |
190 void bailout(const char* msg) const { compilation()->bailout(msg); } |
199 void bailout(const char* msg) const { compilation()->bailout(msg); } |
191 bool bailed_out() const { return compilation()->bailed_out(); } |
200 bool bailed_out() const { return compilation()->bailed_out(); } |
202 |
211 |
203 // get a constant into a register and get track of what register was used |
212 // get a constant into a register and get track of what register was used |
204 LIR_Opr load_constant(Constant* x); |
213 LIR_Opr load_constant(Constant* x); |
205 LIR_Opr load_constant(LIR_Const* constant); |
214 LIR_Opr load_constant(LIR_Const* constant); |
206 |
215 |
|
216 #ifdef MIPS64 |
|
217 LIR_Const* card_table_base() const { |
|
218 return _card_table_base; |
|
219 } |
|
220 #endif |
207 // Given an immediate value, return an operand usable in logical ops. |
221 // Given an immediate value, return an operand usable in logical ops. |
208 LIR_Opr load_immediate(int x, BasicType type); |
222 LIR_Opr load_immediate(int x, BasicType type); |
209 |
223 |
210 void set_result(Value x, LIR_Opr opr) { |
224 void set_result(Value x, LIR_Opr opr) { |
211 assert(opr->is_valid(), "must set to valid value"); |
225 assert(opr->is_valid(), "must set to valid value"); |
222 friend class LIRItem; |
236 friend class LIRItem; |
223 |
237 |
224 LIR_Opr round_item(LIR_Opr opr); |
238 LIR_Opr round_item(LIR_Opr opr); |
225 LIR_Opr force_to_spill(LIR_Opr value, BasicType t); |
239 LIR_Opr force_to_spill(LIR_Opr value, BasicType t); |
226 |
240 |
|
241 #ifdef MIPS64 |
|
242 void profile_branch(If* if_instr, If::Condition cond, LIR_Opr left, LIR_Opr right); |
|
243 #endif |
227 PhiResolverState& resolver_state() { return _resolver_state; } |
244 PhiResolverState& resolver_state() { return _resolver_state; } |
228 |
245 |
229 void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val); |
246 void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val); |
230 void move_to_phi(ValueStack* cur_state); |
247 void move_to_phi(ValueStack* cur_state); |
231 |
248 |
322 |
339 |
323 void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right); |
340 void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right); |
324 |
341 |
325 void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info); |
342 void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info); |
326 void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no); |
343 void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no); |
327 |
344 #ifndef MIPS64 |
328 void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); |
345 void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); |
329 |
346 #else |
|
347 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); |
|
348 #endif |
330 // machine dependent |
349 // machine dependent |
331 void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); |
350 void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); |
332 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info); |
351 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info); |
333 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info); |
352 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info); |
334 |
353 |
345 LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) { |
364 LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) { |
346 return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type); |
365 return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type); |
347 } |
366 } |
348 LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark); |
367 LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark); |
349 |
368 |
|
369 #ifdef MIPS64 |
|
370 void write_barrier(LIR_Opr addr); |
|
371 #endif |
350 // the helper for generate_address |
372 // the helper for generate_address |
351 void add_large_constant(LIR_Opr src, int c, LIR_Opr dest); |
373 void add_large_constant(LIR_Opr src, int c, LIR_Opr dest); |
352 |
374 |
353 // machine preferences and characteristics |
375 // machine preferences and characteristics |
354 bool can_inline_as_constant(Value i) const; |
376 bool can_inline_as_constant(Value i) const; |