| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringMIPS32.h - MIPS32 lowering ---*- C++-*-===// | 1 //===- subzero/src/IceTargetLoweringMIPS32.h - MIPS32 lowering ---*- C++-*-===// |
| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 return getPhysicalRegister(RegMIPS32::Reg_ZERO, IceType_i32); | 440 return getPhysicalRegister(RegMIPS32::Reg_ZERO, IceType_i32); |
| 441 } | 441 } |
| 442 | 442 |
| 443 Variable *I32Reg(RegNumT RegNum = RegNumT()) { | 443 Variable *I32Reg(RegNumT RegNum = RegNumT()) { |
| 444 return makeReg(IceType_i32, RegNum); | 444 return makeReg(IceType_i32, RegNum); |
| 445 } | 445 } |
| 446 | 446 |
| 447 static Type stackSlotType(); | 447 static Type stackSlotType(); |
| 448 Variable *copyToReg(Operand *Src, RegNumT RegNum = RegNumT()); | 448 Variable *copyToReg(Operand *Src, RegNumT RegNum = RegNumT()); |
| 449 | 449 |
| 450 // Iterates over the CFG and determines the maximum outgoing stack arguments |
| 451 // bytes. This information is later used during addProlog() to pre-allocate |
| 452 // the outargs area |
| 453 void findMaxStackOutArgsSize(); |
| 454 |
| 450 void addProlog(CfgNode *Node) override; | 455 void addProlog(CfgNode *Node) override; |
| 451 void addEpilog(CfgNode *Node) override; | 456 void addEpilog(CfgNode *Node) override; |
| 452 | 457 |
| 453 // Ensure that a 64-bit Variable has been split into 2 32-bit | 458 // Ensure that a 64-bit Variable has been split into 2 32-bit |
| 454 // Variables, creating them if necessary. This is needed for all | 459 // Variables, creating them if necessary. This is needed for all |
| 455 // I64 operations. | 460 // I64 operations. |
| 456 void split64(Variable *Var); | 461 void split64(Variable *Var); |
| 457 Operand *loOperand(Operand *Operand); | 462 Operand *loOperand(Operand *Operand); |
| 458 Operand *hiOperand(Operand *Operand); | 463 Operand *hiOperand(Operand *Operand); |
| 459 | 464 |
| 465 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, |
| 466 size_t BasicFrameOffset, size_t *InArgsSizeBytes); |
| 467 |
| 460 Operand *legalizeUndef(Operand *From, RegNumT RegNum = RegNumT()); | 468 Operand *legalizeUndef(Operand *From, RegNumT RegNum = RegNumT()); |
| 461 | 469 |
| 470 /// Helper class that understands the Calling Convention and register |
| 471 /// assignments as per MIPS O32 abi. |
| 472 class CallingConv { |
| 473 CallingConv(const CallingConv &) = delete; |
| 474 CallingConv &operator=(const CallingConv &) = delete; |
| 475 |
| 476 public: |
| 477 CallingConv(); |
| 478 ~CallingConv() = default; |
| 479 |
| 480 /// argInReg returns true if there is a Register available for the requested |
| 481 /// type, and false otherwise. If it returns true, Reg is set to the |
| 482 /// appropriate register number. Note that, when Ty == IceType_i64, Reg will |
| 483 /// be an I64 register pair. |
| 484 bool argInReg(Type Ty, uint32_t ArgNo, RegNumT *Reg); |
| 485 |
| 486 private: |
| 487 // argInGPR is used to find if any GPR register is available for argument of |
| 488 // type Ty |
| 489 bool argInGPR(Type Ty, RegNumT *Reg); |
| 490 /// argInVFP is to floating-point/vector types what argInGPR is for integer |
| 491 /// types. |
| 492 bool argInVFP(Type Ty, RegNumT *Reg); |
| 493 inline void discardNextGPRAndItsAliases(CfgVector<RegNumT> *Regs); |
| 494 void discardUnavailableGPRsAndTheirAliases(CfgVector<RegNumT> *Regs); |
| 495 SmallBitVector GPRegsUsed; |
| 496 CfgVector<RegNumT> GPRArgs; |
| 497 CfgVector<RegNumT> I64Args; |
| 498 |
| 499 void discardUnavailableVFPRegsAndTheirAliases(CfgVector<RegNumT> *Regs); |
| 500 SmallBitVector VFPRegsUsed; |
| 501 CfgVector<RegNumT> FP32Args; |
| 502 CfgVector<RegNumT> FP64Args; |
| 503 // UseFPRegs is a flag indicating if FP registers can be used |
| 504 bool UseFPRegs = false; |
| 505 }; |
| 506 |
| 462 protected: | 507 protected: |
| 463 explicit TargetMIPS32(Cfg *Func); | 508 explicit TargetMIPS32(Cfg *Func); |
| 464 | 509 |
| 465 void postLower() override; | 510 void postLower() override; |
| 466 | 511 |
| 467 void lowerAlloca(const InstAlloca *Instr) override; | 512 void lowerAlloca(const InstAlloca *Instr) override; |
| 468 void lowerArithmetic(const InstArithmetic *Instr) override; | 513 void lowerArithmetic(const InstArithmetic *Instr) override; |
| 469 void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest, | 514 void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest, |
| 470 Operand *Src0, Operand *Src1); | 515 Operand *Src0, Operand *Src1); |
| 471 void lowerAssign(const InstAssign *Instr) override; | 516 void lowerAssign(const InstAssign *Instr) override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 499 RandomNumberGenerator &RNG) override; | 544 RandomNumberGenerator &RNG) override; |
| 500 void | 545 void |
| 501 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, | 546 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, |
| 502 const SmallBitVector &ExcludeRegisters, | 547 const SmallBitVector &ExcludeRegisters, |
| 503 uint64_t Salt) const override; | 548 uint64_t Salt) const override; |
| 504 | 549 |
| 505 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); | 550 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); |
| 506 | 551 |
| 507 bool UsesFramePointer = false; | 552 bool UsesFramePointer = false; |
| 508 bool NeedsStackAlignment = false; | 553 bool NeedsStackAlignment = false; |
| 554 bool MaybeLeafFunc = true; |
| 555 bool PrologEmitsFixedAllocas = false; |
| 556 uint32_t MaxOutArgsSizeBytes = 0; |
| 509 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; | 557 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; |
| 510 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 558 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
| 511 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; | 559 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; |
| 512 SmallBitVector RegsUsed; | 560 SmallBitVector RegsUsed; |
| 513 VarList PhysicalRegisters[IceType_NUM]; | 561 VarList PhysicalRegisters[IceType_NUM]; |
| 562 VarList PreservedGPRs; |
| 514 static constexpr uint32_t CHAR_BITS = 8; | 563 static constexpr uint32_t CHAR_BITS = 8; |
| 515 static constexpr uint32_t INT32_BITS = 32; | 564 static constexpr uint32_t INT32_BITS = 32; |
| 565 size_t SpillAreaSizeBytes = 0; |
| 516 | 566 |
| 517 private: | 567 private: |
| 518 ENABLE_MAKE_UNIQUE; | 568 ENABLE_MAKE_UNIQUE; |
| 519 | 569 |
| 520 class ComputationTracker { | 570 class ComputationTracker { |
| 521 public: | 571 public: |
| 522 ComputationTracker() = default; | 572 ComputationTracker() = default; |
| 523 ~ComputationTracker() = default; | 573 ~ComputationTracker() = default; |
| 524 | 574 |
| 525 void forgetProducers() { KnownComputations.clear(); } | 575 void forgetProducers() { KnownComputations.clear(); } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 667 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
| 618 | 668 |
| 619 private: | 669 private: |
| 620 ~TargetHeaderMIPS32() = default; | 670 ~TargetHeaderMIPS32() = default; |
| 621 }; | 671 }; |
| 622 | 672 |
| 623 } // end of namespace MIPS32 | 673 } // end of namespace MIPS32 |
| 624 } // end of namespace Ice | 674 } // end of namespace Ice |
| 625 | 675 |
| 626 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 676 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
| OLD | NEW |