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 #include "precompiled.hpp" |
31 #include "precompiled.hpp" |
26 #include "c1/c1_CFGPrinter.hpp" |
32 #include "c1/c1_CFGPrinter.hpp" |
27 #include "c1/c1_CodeStubs.hpp" |
33 #include "c1/c1_CodeStubs.hpp" |
28 #include "c1/c1_Compilation.hpp" |
34 #include "c1/c1_Compilation.hpp" |
29 #include "c1/c1_FrameMap.hpp" |
35 #include "c1/c1_FrameMap.hpp" |
32 #include "c1/c1_LinearScan.hpp" |
38 #include "c1/c1_LinearScan.hpp" |
33 #include "c1/c1_ValueStack.hpp" |
39 #include "c1/c1_ValueStack.hpp" |
34 #include "utilities/bitMap.inline.hpp" |
40 #include "utilities/bitMap.inline.hpp" |
35 #ifdef TARGET_ARCH_x86 |
41 #ifdef TARGET_ARCH_x86 |
36 # include "vmreg_x86.inline.hpp" |
42 # include "vmreg_x86.inline.hpp" |
|
43 #endif |
|
44 #ifdef TARGET_ARCH_mips |
|
45 # include "vmreg_mips.inline.hpp" |
37 #endif |
46 #endif |
38 #ifdef TARGET_ARCH_sparc |
47 #ifdef TARGET_ARCH_sparc |
39 # include "vmreg_sparc.inline.hpp" |
48 # include "vmreg_sparc.inline.hpp" |
40 #endif |
49 #endif |
41 #ifdef TARGET_ARCH_zero |
50 #ifdef TARGET_ARCH_zero |
6226 assert(prev_op->as_OpBranch() != NULL, "branch must be of type LIR_OpBranch"); |
6235 assert(prev_op->as_OpBranch() != NULL, "branch must be of type LIR_OpBranch"); |
6227 LIR_OpBranch* prev_branch = (LIR_OpBranch*)prev_op; |
6236 LIR_OpBranch* prev_branch = (LIR_OpBranch*)prev_op; |
6228 |
6237 |
6229 if (prev_branch->stub() == NULL) { |
6238 if (prev_branch->stub() == NULL) { |
6230 |
6239 |
|
6240 #ifndef MIPS64 //MIPS64 not support lir_cmp. same as openjdk6. |
6231 LIR_Op2* prev_cmp = NULL; |
6241 LIR_Op2* prev_cmp = NULL; |
6232 |
6242 |
6233 for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) { |
6243 for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) { |
6234 prev_op = instructions->at(j); |
6244 prev_op = instructions->at(j); |
6235 if (prev_op->code() == lir_cmp) { |
6245 if (prev_op->code() == lir_cmp) { |
6237 prev_cmp = (LIR_Op2*)prev_op; |
6247 prev_cmp = (LIR_Op2*)prev_op; |
6238 assert(prev_branch->cond() == prev_cmp->condition(), "should be the same"); |
6248 assert(prev_branch->cond() == prev_cmp->condition(), "should be the same"); |
6239 } |
6249 } |
6240 } |
6250 } |
6241 assert(prev_cmp != NULL, "should have found comp instruction for branch"); |
6251 assert(prev_cmp != NULL, "should have found comp instruction for branch"); |
|
6252 #endif |
6242 if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) { |
6253 if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) { |
6243 |
6254 |
6244 TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id())); |
6255 TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id())); |
6245 |
6256 |
6246 // eliminate a conditional branch to the immediate successor |
6257 // eliminate a conditional branch to the immediate successor |
6247 prev_branch->change_block(last_branch->block()); |
6258 prev_branch->change_block(last_branch->block()); |
6248 prev_branch->negate_cond(); |
6259 prev_branch->negate_cond(); |
|
6260 #ifndef MIPS64 //MIPS64 not support lir_cmp. same as openjdk6. |
6249 prev_cmp->set_condition(prev_branch->cond()); |
6261 prev_cmp->set_condition(prev_branch->cond()); |
|
6262 #endif |
6250 instructions->truncate(instructions->length() - 1); |
6263 instructions->truncate(instructions->length() - 1); |
6251 } |
6264 } |
6252 } |
6265 } |
6253 } |
6266 } |
6254 } |
6267 } |
6552 ShouldNotReachHere(); |
6565 ShouldNotReachHere(); |
6553 } |
6566 } |
6554 break; |
6567 break; |
6555 } |
6568 } |
6556 |
6569 |
|
6570 #ifndef MIPS64 |
6557 case lir_cmp: inc_counter(counter_cmp); break; |
6571 case lir_cmp: inc_counter(counter_cmp); break; |
6558 |
6572 |
|
6573 #endif |
6559 case lir_branch: |
6574 case lir_branch: |
6560 case lir_cond_float_branch: { |
6575 case lir_cond_float_branch: { |
6561 LIR_OpBranch* branch = op->as_OpBranch(); |
6576 LIR_OpBranch* branch = op->as_OpBranch(); |
6562 if (branch->block() == NULL) { |
6577 if (branch->block() == NULL) { |
6563 inc_counter(counter_stub_branch); |
6578 inc_counter(counter_stub_branch); |