Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// | 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 if (!BuildDefs::dump()) | 312 if (!BuildDefs::dump()) |
| 313 return; | 313 return; |
| 314 Ostream &Str = Ctx->getStrEmit(); | 314 Ostream &Str = Ctx->getStrEmit(); |
| 315 const Type FrameSPTy = IceType_i32; | 315 const Type FrameSPTy = IceType_i32; |
| 316 if (Var->hasReg()) { | 316 if (Var->hasReg()) { |
| 317 Str << '$' << getRegName(Var->getRegNum(), Var->getType()); | 317 Str << '$' << getRegName(Var->getRegNum(), Var->getType()); |
| 318 return; | 318 return; |
| 319 } else { | 319 } else { |
| 320 int32_t Offset = Var->getStackOffset(); | 320 int32_t Offset = Var->getStackOffset(); |
| 321 Str << Offset; | 321 Str << Offset; |
| 322 Str << "(" << getRegName(getFrameOrStackReg(), FrameSPTy); | 322 Str << "($" << getRegName(getFrameOrStackReg(), FrameSPTy); |
| 323 Str << ")"; | 323 Str << ")"; |
| 324 } | 324 } |
| 325 UnimplementedError(Func->getContext()->getFlags()); | 325 UnimplementedError(Func->getContext()->getFlags()); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void TargetMIPS32::lowerArguments() { | 328 void TargetMIPS32::lowerArguments() { |
| 329 VarList &Args = Func->getArgs(); | 329 VarList &Args = Func->getArgs(); |
| 330 // We are only handling integer registers for now. The Mips o32 ABI is | 330 // We are only handling integer registers for now. The Mips o32 ABI is |
| 331 // somewhat complex but will be implemented in its totality through follow | 331 // somewhat complex but will be implemented in its totality through follow |
| 332 // on patches. | 332 // on patches. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 // cases. | 511 // cases. |
| 512 NeedsStackAlignment = true; | 512 NeedsStackAlignment = true; |
| 513 (void)Inst; | 513 (void)Inst; |
| 514 UnimplementedError(Func->getContext()->getFlags()); | 514 UnimplementedError(Func->getContext()->getFlags()); |
| 515 } | 515 } |
| 516 | 516 |
| 517 void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { | 517 void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { |
| 518 Variable *Dest = Inst->getDest(); | 518 Variable *Dest = Inst->getDest(); |
| 519 Operand *Src0 = legalizeUndef(Inst->getSrc(0)); | 519 Operand *Src0 = legalizeUndef(Inst->getSrc(0)); |
| 520 Operand *Src1 = legalizeUndef(Inst->getSrc(1)); | 520 Operand *Src1 = legalizeUndef(Inst->getSrc(1)); |
| 521 (void)Src0; | |
| 522 (void)Src1; | |
| 523 if (Dest->getType() == IceType_i64) { | 521 if (Dest->getType() == IceType_i64) { |
| 522 // TODO(reed kotler): fakedef needed for now until all cases are implemented | |
| 523 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); | |
| 524 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); | |
| 525 Context.insert(InstFakeDef::create(Func, DestLo)); | |
| 526 Context.insert(InstFakeDef::create(Func, DestHi)); | |
| 524 UnimplementedError(Func->getContext()->getFlags()); | 527 UnimplementedError(Func->getContext()->getFlags()); |
| 528 return; | |
| 525 } else if (isVectorType(Dest->getType())) { | 529 } else if (isVectorType(Dest->getType())) { |
|
Jim Stichnoth
2015/11/04 14:47:24
Don't use "else if" when the "if" branch ends with
rkotlerimgtec
2015/11/05 01:28:43
Done.
| |
| 526 UnimplementedError(Func->getContext()->getFlags()); | 530 UnimplementedError(Func->getContext()->getFlags()); |
| 527 } else { // Dest->getType() is non-i64 scalar | 531 } else { // Dest->getType() is non-i64 scalar |
| 532 Variable *T = makeReg(Dest->getType()); | |
|
Jim Stichnoth
2015/11/04 14:47:24
Now is the part where I wish I had learned more ab
rkotlerimgtec
2015/11/05 01:28:43
Done.
| |
| 533 Variable *Src0R = legalizeToReg(Src0); | |
| 534 Operand *Src1R = legalize(Src1, Legal_Reg); | |
| 535 // TODO(reed kotler): | |
| 536 // fakedef and fakeuse needed for now until all cases are implemented | |
| 537 Context.insert(InstFakeUse::create(Func, Src0R)); | |
|
Jim Stichnoth
2015/11/04 14:47:24
I think the FakeUse and FakeDef instructions shoul
rkotlerimgtec
2015/11/05 01:28:43
Done.
| |
| 538 if (auto *S1 = llvm::dyn_cast<Variable>(Src1R)) { | |
| 539 Context.insert(InstFakeUse::create(Func, S1)); | |
| 540 } | |
| 541 Context.insert(InstFakeDef::create(Func, Dest)); | |
| 528 switch (Inst->getOp()) { | 542 switch (Inst->getOp()) { |
| 529 case InstArithmetic::_num: | 543 case InstArithmetic::_num: |
| 530 UnimplementedError(Func->getContext()->getFlags()); | 544 UnimplementedError(Func->getContext()->getFlags()); |
| 531 break; | 545 break; |
| 532 case InstArithmetic::Add: | 546 case InstArithmetic::Add: |
| 533 UnimplementedError(Func->getContext()->getFlags()); | 547 _add(T, Src0R, Src1R); |
| 534 // Variable *T = makeReg(Dest->getType()); | 548 _mov(Dest, T); |
| 535 // _add(T, Src0, Src1); | |
| 536 // _mov(Dest, T); | |
| 537 return; | 549 return; |
| 538 case InstArithmetic::And: | 550 case InstArithmetic::And: |
| 539 UnimplementedError(Func->getContext()->getFlags()); | 551 _and(T, Src0R, Src1R); |
| 540 break; | 552 _mov(Dest, T); |
| 553 return; | |
| 541 case InstArithmetic::Or: | 554 case InstArithmetic::Or: |
| 542 UnimplementedError(Func->getContext()->getFlags()); | 555 _or(T, Src0R, Src1R); |
| 543 break; | 556 _mov(Dest, T); |
| 557 return; | |
| 544 case InstArithmetic::Xor: | 558 case InstArithmetic::Xor: |
| 545 UnimplementedError(Func->getContext()->getFlags()); | 559 _xor(T, Src0R, Src1R); |
| 546 break; | 560 _mov(Dest, T); |
| 561 return; | |
| 547 case InstArithmetic::Sub: | 562 case InstArithmetic::Sub: |
| 548 UnimplementedError(Func->getContext()->getFlags()); | 563 _sub(T, Src0R, Src1R); |
| 549 break; | 564 _mov(Dest, T); |
| 550 case InstArithmetic::Mul: | 565 return; |
| 551 UnimplementedError(Func->getContext()->getFlags()); | 566 case InstArithmetic::Mul: { |
| 552 break; | 567 Variable *Src1R_ = legalizeToReg(Src1R); |
|
Jim Stichnoth
2015/11/04 14:47:24
If you follow the comment above and declare Src1R
rkotlerimgtec
2015/11/05 01:28:43
Done.
| |
| 568 _mul(T, Src0R, Src1R_); | |
| 569 _mov(Dest, T); | |
| 570 return; | |
| 571 } | |
| 553 case InstArithmetic::Shl: | 572 case InstArithmetic::Shl: |
| 554 UnimplementedError(Func->getContext()->getFlags()); | 573 UnimplementedError(Func->getContext()->getFlags()); |
| 555 break; | 574 break; |
| 556 case InstArithmetic::Lshr: | 575 case InstArithmetic::Lshr: |
| 557 UnimplementedError(Func->getContext()->getFlags()); | 576 UnimplementedError(Func->getContext()->getFlags()); |
| 558 break; | 577 break; |
| 559 case InstArithmetic::Ashr: | 578 case InstArithmetic::Ashr: |
| 560 UnimplementedError(Func->getContext()->getFlags()); | 579 UnimplementedError(Func->getContext()->getFlags()); |
| 561 break; | 580 break; |
| 562 case InstArithmetic::Udiv: | 581 case InstArithmetic::Udiv: |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1049 : TargetHeaderLowering(Ctx) {} | 1068 : TargetHeaderLowering(Ctx) {} |
| 1050 | 1069 |
| 1051 void TargetHeaderMIPS32::lower() { | 1070 void TargetHeaderMIPS32::lower() { |
| 1052 OstreamLocker L(Ctx); | 1071 OstreamLocker L(Ctx); |
| 1053 Ostream &Str = Ctx->getStrEmit(); | 1072 Ostream &Str = Ctx->getStrEmit(); |
| 1054 Str << "\t.set\tnomicromips\n"; | 1073 Str << "\t.set\tnomicromips\n"; |
| 1055 Str << "\t.set\tnomips16\n"; | 1074 Str << "\t.set\tnomips16\n"; |
| 1056 } | 1075 } |
| 1057 | 1076 |
| 1058 } // end of namespace Ice | 1077 } // end of namespace Ice |
| OLD | NEW |