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 |
462 protected: | 470 protected: |
463 explicit TargetMIPS32(Cfg *Func); | 471 explicit TargetMIPS32(Cfg *Func); |
464 | 472 |
465 void postLower() override; | 473 void postLower() override; |
466 | 474 |
467 void lowerAlloca(const InstAlloca *Instr) override; | 475 void lowerAlloca(const InstAlloca *Instr) override; |
468 void lowerArithmetic(const InstArithmetic *Instr) override; | 476 void lowerArithmetic(const InstArithmetic *Instr) override; |
469 void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest, | 477 void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest, |
(...skipping 29 matching lines...) Expand all Loading... |
499 RandomNumberGenerator &RNG) override; | 507 RandomNumberGenerator &RNG) override; |
500 void | 508 void |
501 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, | 509 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, |
502 const SmallBitVector &ExcludeRegisters, | 510 const SmallBitVector &ExcludeRegisters, |
503 uint64_t Salt) const override; | 511 uint64_t Salt) const override; |
504 | 512 |
505 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); | 513 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); |
506 | 514 |
507 bool UsesFramePointer = false; | 515 bool UsesFramePointer = false; |
508 bool NeedsStackAlignment = false; | 516 bool NeedsStackAlignment = false; |
| 517 bool MaybeLeafFunc = true; |
| 518 bool PrologEmitsFixedAllocas = false; |
| 519 uint32_t MaxOutArgsSizeBytes = 0; |
509 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; | 520 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; |
510 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 521 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
511 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; | 522 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; |
512 SmallBitVector RegsUsed; | 523 SmallBitVector RegsUsed; |
513 VarList PhysicalRegisters[IceType_NUM]; | 524 VarList PhysicalRegisters[IceType_NUM]; |
| 525 VarList PreservedGPRs; |
514 static constexpr uint32_t CHAR_BITS = 8; | 526 static constexpr uint32_t CHAR_BITS = 8; |
515 static constexpr uint32_t INT32_BITS = 32; | 527 static constexpr uint32_t INT32_BITS = 32; |
| 528 size_t SpillAreaSizeBytes = 0; |
516 | 529 |
517 private: | 530 private: |
518 ENABLE_MAKE_UNIQUE; | 531 ENABLE_MAKE_UNIQUE; |
519 | 532 |
520 class ComputationTracker { | 533 class ComputationTracker { |
521 public: | 534 public: |
522 ComputationTracker() = default; | 535 ComputationTracker() = default; |
523 ~ComputationTracker() = default; | 536 ~ComputationTracker() = default; |
524 | 537 |
525 void forgetProducers() { KnownComputations.clear(); } | 538 void forgetProducers() { KnownComputations.clear(); } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 630 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
618 | 631 |
619 private: | 632 private: |
620 ~TargetHeaderMIPS32() = default; | 633 ~TargetHeaderMIPS32() = default; |
621 }; | 634 }; |
622 | 635 |
623 } // end of namespace MIPS32 | 636 } // end of namespace MIPS32 |
624 } // end of namespace Ice | 637 } // end of namespace Ice |
625 | 638 |
626 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 639 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
OLD | NEW |