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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 RegNumT getStackReg() const override { return RegMIPS32::Reg_SP; } | 82 RegNumT getStackReg() const override { return RegMIPS32::Reg_SP; } |
83 RegNumT getFrameReg() const override { return RegMIPS32::Reg_FP; } | 83 RegNumT getFrameReg() const override { return RegMIPS32::Reg_FP; } |
84 RegNumT getFrameOrStackReg() const override { | 84 RegNumT getFrameOrStackReg() const override { |
85 return UsesFramePointer ? getFrameReg() : getStackReg(); | 85 return UsesFramePointer ? getFrameReg() : getStackReg(); |
86 } | 86 } |
87 size_t typeWidthInBytesOnStack(Type Ty) const override { | 87 size_t typeWidthInBytesOnStack(Type Ty) const override { |
88 // Round up to the next multiple of 4 bytes. In particular, i1, i8, and i16 | 88 // Round up to the next multiple of 4 bytes. In particular, i1, i8, and i16 |
89 // are rounded up to 4 bytes. | 89 // are rounded up to 4 bytes. |
90 return (typeWidthInBytes(Ty) + 3) & ~3; | 90 return (typeWidthInBytes(Ty) + 3) & ~3; |
91 } | 91 } |
92 uint32_t getStackAlignment() const override { | 92 uint32_t getStackAlignment() const override; |
93 // TODO(sehr): what is the stack alignment? | |
94 return 1; | |
95 } | |
96 void reserveFixedAllocaArea(size_t Size, size_t Align) override { | 93 void reserveFixedAllocaArea(size_t Size, size_t Align) override { |
97 // TODO(sehr): Implement fixed stack layout. | 94 FixedAllocaSizeBytes = Size; |
98 (void)Size; | 95 assert(llvm::isPowerOf2_32(Align)); |
99 (void)Align; | 96 FixedAllocaAlignBytes = Align; |
100 llvm::report_fatal_error("Not yet implemented"); | 97 PrologEmitsFixedAllocas = true; |
101 } | 98 } |
102 int32_t getFrameFixedAllocaOffset() const override { | 99 int32_t getFrameFixedAllocaOffset() const override { |
103 // TODO(sehr): Implement fixed stack layout. | 100 // TODO(sehr): Implement fixed stack layout. |
104 llvm::report_fatal_error("Not yet implemented"); | 101 llvm::report_fatal_error("Not yet implemented"); |
105 return 0; | 102 return 0; |
106 } | 103 } |
107 | 104 |
| 105 uint32_t maxOutArgsSizeBytes() const override { return MaxOutArgsSizeBytes; } |
| 106 |
108 bool shouldSplitToVariable64On32(Type Ty) const override { | 107 bool shouldSplitToVariable64On32(Type Ty) const override { |
109 return Ty == IceType_i64; | 108 return Ty == IceType_i64; |
110 } | 109 } |
111 | 110 |
112 // TODO(ascull): what is the best size of MIPS? | 111 // TODO(ascull): what is the best size of MIPS? |
113 SizeT getMinJumpTableSize() const override { return 3; } | 112 SizeT getMinJumpTableSize() const override { return 3; } |
114 void emitJumpTable(const Cfg *Func, | 113 void emitJumpTable(const Cfg *Func, |
115 const InstJumpTable *JumpTable) const override; | 114 const InstJumpTable *JumpTable) const override; |
116 | 115 |
117 void emitVariable(const Variable *Var) const override; | 116 void emitVariable(const Variable *Var) const override; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 return getPhysicalRegister(RegMIPS32::Reg_ZERO, IceType_i32); | 439 return getPhysicalRegister(RegMIPS32::Reg_ZERO, IceType_i32); |
441 } | 440 } |
442 | 441 |
443 Variable *I32Reg(RegNumT RegNum = RegNumT()) { | 442 Variable *I32Reg(RegNumT RegNum = RegNumT()) { |
444 return makeReg(IceType_i32, RegNum); | 443 return makeReg(IceType_i32, RegNum); |
445 } | 444 } |
446 | 445 |
447 static Type stackSlotType(); | 446 static Type stackSlotType(); |
448 Variable *copyToReg(Operand *Src, RegNumT RegNum = RegNumT()); | 447 Variable *copyToReg(Operand *Src, RegNumT RegNum = RegNumT()); |
449 | 448 |
| 449 void unsetIfNonLeafFunc(); |
| 450 |
450 // Iterates over the CFG and determines the maximum outgoing stack arguments | 451 // Iterates over the CFG and determines the maximum outgoing stack arguments |
451 // bytes. This information is later used during addProlog() to pre-allocate | 452 // bytes. This information is later used during addProlog() to pre-allocate |
452 // the outargs area | 453 // the outargs area |
453 void findMaxStackOutArgsSize(); | 454 void findMaxStackOutArgsSize(); |
454 | 455 |
455 void addProlog(CfgNode *Node) override; | 456 void addProlog(CfgNode *Node) override; |
456 void addEpilog(CfgNode *Node) override; | 457 void addEpilog(CfgNode *Node) override; |
457 | 458 |
458 // Ensure that a 64-bit Variable has been split into 2 32-bit | 459 // Ensure that a 64-bit Variable has been split into 2 32-bit |
459 // Variables, creating them if necessary. This is needed for all | 460 // Variables, creating them if necessary. This is needed for all |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 uint32_t MaxOutArgsSizeBytes = 0; | 557 uint32_t MaxOutArgsSizeBytes = 0; |
557 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; | 558 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; |
558 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 559 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
559 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; | 560 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; |
560 SmallBitVector RegsUsed; | 561 SmallBitVector RegsUsed; |
561 VarList PhysicalRegisters[IceType_NUM]; | 562 VarList PhysicalRegisters[IceType_NUM]; |
562 VarList PreservedGPRs; | 563 VarList PreservedGPRs; |
563 static constexpr uint32_t CHAR_BITS = 8; | 564 static constexpr uint32_t CHAR_BITS = 8; |
564 static constexpr uint32_t INT32_BITS = 32; | 565 static constexpr uint32_t INT32_BITS = 32; |
565 size_t SpillAreaSizeBytes = 0; | 566 size_t SpillAreaSizeBytes = 0; |
| 567 size_t FixedAllocaSizeBytes = 0; |
| 568 size_t FixedAllocaAlignBytes = 0; |
566 | 569 |
567 private: | 570 private: |
568 ENABLE_MAKE_UNIQUE; | 571 ENABLE_MAKE_UNIQUE; |
569 | 572 |
570 class ComputationTracker { | 573 class ComputationTracker { |
571 public: | 574 public: |
572 ComputationTracker() = default; | 575 ComputationTracker() = default; |
573 ~ComputationTracker() = default; | 576 ~ComputationTracker() = default; |
574 | 577 |
575 void forgetProducers() { KnownComputations.clear(); } | 578 void forgetProducers() { KnownComputations.clear(); } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 670 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
668 | 671 |
669 private: | 672 private: |
670 ~TargetHeaderMIPS32() = default; | 673 ~TargetHeaderMIPS32() = default; |
671 }; | 674 }; |
672 | 675 |
673 } // end of namespace MIPS32 | 676 } // end of namespace MIPS32 |
674 } // end of namespace Ice | 677 } // end of namespace Ice |
675 | 678 |
676 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 679 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
OLD | NEW |