Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: src/compiler/mips/code-generator-mips.cc

Issue 742243003: MIPS: [turbofan] Clean up and factor out branch generation logic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/mips/macro-assembler-mips.h" 10 #include "src/mips/macro-assembler-mips.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 } 385 }
386 386
387 387
388 #define UNSUPPORTED_COND(opcode, condition) \ 388 #define UNSUPPORTED_COND(opcode, condition) \
389 OFStream out(stdout); \ 389 OFStream out(stdout); \
390 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ 390 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
391 UNIMPLEMENTED(); 391 UNIMPLEMENTED();
392 392
393 // Assembles branches after an instruction. 393 // Assembles branches after an instruction.
394 void CodeGenerator::AssembleArchBranch(Instruction* instr, 394 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
395 FlagsCondition condition) {
396 MipsOperandConverter i(this, instr); 395 MipsOperandConverter i(this, instr);
397 Label* tlabel = branch->true_label; 396 Label* tlabel = branch->true_label;
398 Label* flabel = branch->false_label; 397 Label* flabel = branch->false_label;
399 Condition cc = kNoCondition; 398 Condition cc = kNoCondition;
400 399
401 // MIPS does not have condition code flags, so compare and branch are 400 // MIPS does not have condition code flags, so compare and branch are
402 // implemented differently than on the other arch's. The compare operations 401 // implemented differently than on the other arch's. The compare operations
403 // emit mips pseudo-instructions, which are handled here by branch 402 // emit mips pseudo-instructions, which are handled here by branch
404 // instructions that do the actual comparison. Essential that the input 403 // instructions that do the actual comparison. Essential that the input
405 // registers to compare pseudo-op are not modified before this branch op, as 404 // registers to compare pseudo-op are not modified before this branch op, as
406 // they are tested here. 405 // they are tested here.
407 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were 406 // TODO(plind): Add CHECK() to ensure that test/cmp and this branch were
408 // not separated by other instructions. 407 // not separated by other instructions.
409 408
410 if (instr->arch_opcode() == kMipsTst) { 409 if (instr->arch_opcode() == kMipsTst) {
411 switch (branch->condition) { 410 switch (branch->condition) {
412 case kNotEqual: 411 case kNotEqual:
413 cc = ne; 412 cc = ne;
414 break; 413 break;
415 case kEqual: 414 case kEqual:
416 cc = eq; 415 cc = eq;
417 break; 416 break;
418 default: 417 default:
419 UNSUPPORTED_COND(kMipsTst, condition); 418 UNSUPPORTED_COND(kMipsTst, branch->condition);
420 break; 419 break;
421 } 420 }
422 __ And(at, i.InputRegister(0), i.InputOperand(1)); 421 __ And(at, i.InputRegister(0), i.InputOperand(1));
423 __ Branch(tlabel, cc, at, Operand(zero_reg)); 422 __ Branch(tlabel, cc, at, Operand(zero_reg));
424 423
425 } else if (instr->arch_opcode() == kMipsAddOvf || 424 } else if (instr->arch_opcode() == kMipsAddOvf ||
426 instr->arch_opcode() == kMipsSubOvf) { 425 instr->arch_opcode() == kMipsSubOvf) {
427 // kMipsAddOvf, SubOvf emit negative result to 'kCompareReg' on overflow. 426 // kMipsAddOvf, SubOvf emit negative result to 'kCompareReg' on overflow.
428 switch (branch->condition) { 427 switch (branch->condition) {
429 case kOverflow: 428 case kOverflow:
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 936 }
938 } 937 }
939 MarkLazyDeoptSite(); 938 MarkLazyDeoptSite();
940 } 939 }
941 940
942 #undef __ 941 #undef __
943 942
944 } // namespace compiler 943 } // namespace compiler
945 } // namespace internal 944 } // namespace internal
946 } // namespace v8 945 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698