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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return getPhysicalRegister(RegMIPS32::Reg_ZERO, IceType_i32); | 384 return getPhysicalRegister(RegMIPS32::Reg_ZERO, IceType_i32); |
385 } | 385 } |
386 | 386 |
387 Variable *I32Reg(RegNumT RegNum = RegNumT()) { | 387 Variable *I32Reg(RegNumT RegNum = RegNumT()) { |
388 return makeReg(IceType_i32, RegNum); | 388 return makeReg(IceType_i32, RegNum); |
389 } | 389 } |
390 | 390 |
391 static Type stackSlotType(); | 391 static Type stackSlotType(); |
392 Variable *copyToReg(Operand *Src, RegNumT RegNum = RegNumT()); | 392 Variable *copyToReg(Operand *Src, RegNumT RegNum = RegNumT()); |
393 | 393 |
| 394 // Iterates over the CFG and determines the maximum outgoing stack arguments |
| 395 // bytes. This information is later used during addProlog() to pre-allocate |
| 396 // the outargs area |
| 397 void findMaxStackOutArgsSize(); |
| 398 |
394 void addProlog(CfgNode *Node) override; | 399 void addProlog(CfgNode *Node) override; |
395 void addEpilog(CfgNode *Node) override; | 400 void addEpilog(CfgNode *Node) override; |
396 | 401 |
397 // Ensure that a 64-bit Variable has been split into 2 32-bit | 402 // Ensure that a 64-bit Variable has been split into 2 32-bit |
398 // Variables, creating them if necessary. This is needed for all | 403 // Variables, creating them if necessary. This is needed for all |
399 // I64 operations. | 404 // I64 operations. |
400 void split64(Variable *Var); | 405 void split64(Variable *Var); |
401 Operand *loOperand(Operand *Operand); | 406 Operand *loOperand(Operand *Operand); |
402 Operand *hiOperand(Operand *Operand); | 407 Operand *hiOperand(Operand *Operand); |
403 | 408 |
| 409 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, |
| 410 size_t BasicFrameOffset, size_t *InArgsSizeBytes); |
| 411 |
404 Operand *legalizeUndef(Operand *From, RegNumT RegNum = RegNumT()); | 412 Operand *legalizeUndef(Operand *From, RegNumT RegNum = RegNumT()); |
405 | 413 |
406 protected: | 414 protected: |
407 explicit TargetMIPS32(Cfg *Func); | 415 explicit TargetMIPS32(Cfg *Func); |
408 | 416 |
409 void postLower() override; | 417 void postLower() override; |
410 | 418 |
411 void lowerAlloca(const InstAlloca *Instr) override; | 419 void lowerAlloca(const InstAlloca *Instr) override; |
412 void lowerArithmetic(const InstArithmetic *Instr) override; | 420 void lowerArithmetic(const InstArithmetic *Instr) override; |
413 void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest, | 421 void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest, |
(...skipping 29 matching lines...) Expand all Loading... |
443 RandomNumberGenerator &RNG) override; | 451 RandomNumberGenerator &RNG) override; |
444 void | 452 void |
445 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, | 453 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, |
446 const SmallBitVector &ExcludeRegisters, | 454 const SmallBitVector &ExcludeRegisters, |
447 uint64_t Salt) const override; | 455 uint64_t Salt) const override; |
448 | 456 |
449 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); | 457 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); |
450 | 458 |
451 bool UsesFramePointer = false; | 459 bool UsesFramePointer = false; |
452 bool NeedsStackAlignment = false; | 460 bool NeedsStackAlignment = false; |
| 461 bool MaybeLeafFunc = true; |
| 462 bool PrologEmitsFixedAllocas = false; |
| 463 uint32_t MaxOutArgsSizeBytes = 0; |
453 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; | 464 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; |
454 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 465 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
455 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; | 466 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; |
456 SmallBitVector RegsUsed; | 467 SmallBitVector RegsUsed; |
457 VarList PhysicalRegisters[IceType_NUM]; | 468 VarList PhysicalRegisters[IceType_NUM]; |
| 469 VarList PreservedGPRs; |
458 static constexpr uint32_t CHAR_BITS = 8; | 470 static constexpr uint32_t CHAR_BITS = 8; |
459 static constexpr uint32_t INT32_BITS = 32; | 471 static constexpr uint32_t INT32_BITS = 32; |
| 472 size_t SpillAreaSizeBytes = 0; |
460 | 473 |
461 private: | 474 private: |
462 ENABLE_MAKE_UNIQUE; | 475 ENABLE_MAKE_UNIQUE; |
463 | 476 |
464 class ComputationTracker { | 477 class ComputationTracker { |
465 public: | 478 public: |
466 ComputationTracker() = default; | 479 ComputationTracker() = default; |
467 ~ComputationTracker() = default; | 480 ~ComputationTracker() = default; |
468 | 481 |
469 void forgetProducers() { KnownComputations.clear(); } | 482 void forgetProducers() { KnownComputations.clear(); } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 574 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
562 | 575 |
563 private: | 576 private: |
564 ~TargetHeaderMIPS32() = default; | 577 ~TargetHeaderMIPS32() = default; |
565 }; | 578 }; |
566 | 579 |
567 } // end of namespace MIPS32 | 580 } // end of namespace MIPS32 |
568 } // end of namespace Ice | 581 } // end of namespace Ice |
569 | 582 |
570 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 583 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
OLD | NEW |