OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 #include "src/compiler/code-generator-impl.h" | 6 #include "src/compiler/code-generator-impl.h" |
7 #include "src/compiler/gap-resolver.h" | 7 #include "src/compiler/gap-resolver.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/mips/macro-assembler-mips.h" | 9 #include "src/mips/macro-assembler-mips.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 // instructions that do the actual comparison. Essential that the input | 900 // instructions that do the actual comparison. Essential that the input |
901 // registers to compare pseudo-op are not modified before this branch op, as | 901 // registers to compare pseudo-op are not modified before this branch op, as |
902 // they are tested here. | 902 // they are tested here. |
903 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were | 903 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were |
904 // not separated by other instructions. | 904 // not separated by other instructions. |
905 | 905 |
906 if (instr->arch_opcode() == kMipsTst) { | 906 if (instr->arch_opcode() == kMipsTst) { |
907 cc = FlagsConditionToConditionTst(branch->condition); | 907 cc = FlagsConditionToConditionTst(branch->condition); |
908 __ And(at, i.InputRegister(0), i.InputOperand(1)); | 908 __ And(at, i.InputRegister(0), i.InputOperand(1)); |
909 __ Branch(tlabel, cc, at, Operand(zero_reg)); | 909 __ Branch(tlabel, cc, at, Operand(zero_reg)); |
910 | |
911 } else if (instr->arch_opcode() == kMipsAddOvf || | 910 } else if (instr->arch_opcode() == kMipsAddOvf || |
912 instr->arch_opcode() == kMipsSubOvf) { | 911 instr->arch_opcode() == kMipsSubOvf) { |
913 // kMipsAddOvf, SubOvf emit negative result to 'kCompareReg' on overflow. | 912 // kMipsAddOvf, SubOvf emit negative result to 'kCompareReg' on overflow. |
914 cc = FlagsConditionToConditionOvf(branch->condition); | 913 cc = FlagsConditionToConditionOvf(branch->condition); |
915 __ Branch(tlabel, cc, kCompareReg, Operand(zero_reg)); | 914 __ Branch(tlabel, cc, kCompareReg, Operand(zero_reg)); |
916 | |
917 } else if (instr->arch_opcode() == kMipsCmp) { | 915 } else if (instr->arch_opcode() == kMipsCmp) { |
918 cc = FlagsConditionToConditionCmp(branch->condition); | 916 cc = FlagsConditionToConditionCmp(branch->condition); |
919 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 917 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
920 | |
921 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | |
922 | |
923 } else if (instr->arch_opcode() == kMipsCmpS) { | 918 } else if (instr->arch_opcode() == kMipsCmpS) { |
924 if (!convertCondition(branch->condition, cc)) { | 919 if (!convertCondition(branch->condition, cc)) { |
925 UNSUPPORTED_COND(kMips64CmpS, branch->condition); | 920 UNSUPPORTED_COND(kMips64CmpS, branch->condition); |
926 } | 921 } |
927 __ BranchF32(tlabel, NULL, cc, i.InputSingleRegister(0), | 922 __ BranchF32(tlabel, NULL, cc, i.InputSingleRegister(0), |
928 i.InputSingleRegister(1)); | 923 i.InputSingleRegister(1)); |
929 | |
930 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | |
931 | |
932 } else if (instr->arch_opcode() == kMipsCmpD) { | 924 } else if (instr->arch_opcode() == kMipsCmpD) { |
933 if (!convertCondition(branch->condition, cc)) { | 925 if (!convertCondition(branch->condition, cc)) { |
934 UNSUPPORTED_COND(kMips64CmpD, branch->condition); | 926 UNSUPPORTED_COND(kMips64CmpD, branch->condition); |
935 } | 927 } |
936 __ BranchF64(tlabel, NULL, cc, i.InputDoubleRegister(0), | 928 __ BranchF64(tlabel, NULL, cc, i.InputDoubleRegister(0), |
937 i.InputDoubleRegister(1)); | 929 i.InputDoubleRegister(1)); |
938 | |
939 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | |
940 | |
941 } else { | 930 } else { |
942 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", | 931 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", |
943 instr->arch_opcode()); | 932 instr->arch_opcode()); |
944 UNIMPLEMENTED(); | 933 UNIMPLEMENTED(); |
945 } | 934 } |
| 935 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
946 } | 936 } |
947 | 937 |
948 | 938 |
949 void CodeGenerator::AssembleArchJump(RpoNumber target) { | 939 void CodeGenerator::AssembleArchJump(RpoNumber target) { |
950 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); | 940 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); |
951 } | 941 } |
952 | 942 |
953 | 943 |
954 // Assembles boolean materializations after an instruction. | 944 // Assembles boolean materializations after an instruction. |
955 void CodeGenerator::AssembleArchBoolean(Instruction* instr, | 945 void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 } | 1373 } |
1384 } | 1374 } |
1385 } | 1375 } |
1386 } | 1376 } |
1387 | 1377 |
1388 #undef __ | 1378 #undef __ |
1389 | 1379 |
1390 } // namespace compiler | 1380 } // namespace compiler |
1391 } // namespace internal | 1381 } // namespace internal |
1392 } // namespace v8 | 1382 } // namespace v8 |
OLD | NEW |