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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 int32_t getFrameFixedAllocaOffset() const override { | 104 int32_t getFrameFixedAllocaOffset() const override { |
105 return FixedAllocaSizeBytes - (SpillAreaSizeBytes - MaxOutArgsSizeBytes); | 105 return FixedAllocaSizeBytes - (SpillAreaSizeBytes - MaxOutArgsSizeBytes); |
106 } | 106 } |
107 | 107 |
108 uint32_t maxOutArgsSizeBytes() const override { return MaxOutArgsSizeBytes; } | 108 uint32_t maxOutArgsSizeBytes() const override { return MaxOutArgsSizeBytes; } |
109 | 109 |
110 bool shouldSplitToVariable64On32(Type Ty) const override { | 110 bool shouldSplitToVariable64On32(Type Ty) const override { |
111 return Ty == IceType_i64; | 111 return Ty == IceType_i64; |
112 } | 112 } |
113 | 113 |
| 114 bool shouldSplitToVariableVecOn32(Type Ty) const override { |
| 115 return isVectorType(Ty); |
| 116 } |
| 117 |
114 // TODO(ascull): what is the best size of MIPS? | 118 // TODO(ascull): what is the best size of MIPS? |
115 SizeT getMinJumpTableSize() const override { return 3; } | 119 SizeT getMinJumpTableSize() const override { return 3; } |
116 void emitJumpTable(const Cfg *Func, | 120 void emitJumpTable(const Cfg *Func, |
117 const InstJumpTable *JumpTable) const override; | 121 const InstJumpTable *JumpTable) const override; |
118 | 122 |
119 void emitVariable(const Variable *Var) const override; | 123 void emitVariable(const Variable *Var) const override; |
120 | 124 |
121 void emit(const ConstantInteger32 *C) const final { | 125 void emit(const ConstantInteger32 *C) const final { |
122 if (!BuildDefs::dump()) | 126 if (!BuildDefs::dump()) |
123 return; | 127 return; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 606 |
603 void addProlog(CfgNode *Node) override; | 607 void addProlog(CfgNode *Node) override; |
604 void addEpilog(CfgNode *Node) override; | 608 void addEpilog(CfgNode *Node) override; |
605 | 609 |
606 // Ensure that a 64-bit Variable has been split into 2 32-bit | 610 // Ensure that a 64-bit Variable has been split into 2 32-bit |
607 // Variables, creating them if necessary. This is needed for all | 611 // Variables, creating them if necessary. This is needed for all |
608 // I64 operations. | 612 // I64 operations. |
609 void split64(Variable *Var); | 613 void split64(Variable *Var); |
610 Operand *loOperand(Operand *Operand); | 614 Operand *loOperand(Operand *Operand); |
611 Operand *hiOperand(Operand *Operand); | 615 Operand *hiOperand(Operand *Operand); |
| 616 Operand *getOperandAtIndex(Operand *Operand, Type BaseType, uint32_t Index); |
612 | 617 |
613 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, | 618 void finishArgumentLowering(Variable *Arg, bool PartialOnStack, |
614 size_t BasicFrameOffset, size_t *InArgsSizeBytes); | 619 Variable *FramePtr, size_t BasicFrameOffset, |
| 620 size_t *InArgsSizeBytes); |
615 | 621 |
616 Operand *legalizeUndef(Operand *From, RegNumT RegNum = RegNumT()); | 622 Operand *legalizeUndef(Operand *From, RegNumT RegNum = RegNumT()); |
617 | 623 |
618 /// Helper class that understands the Calling Convention and register | 624 /// Helper class that understands the Calling Convention and register |
619 /// assignments as per MIPS O32 abi. | 625 /// assignments as per MIPS O32 abi. |
620 class CallingConv { | 626 class CallingConv { |
621 CallingConv(const CallingConv &) = delete; | 627 CallingConv(const CallingConv &) = delete; |
622 CallingConv &operator=(const CallingConv &) = delete; | 628 CallingConv &operator=(const CallingConv &) = delete; |
623 | 629 |
624 public: | 630 public: |
625 CallingConv(); | 631 CallingConv(); |
626 ~CallingConv() = default; | 632 ~CallingConv() = default; |
627 | 633 |
628 /// argInReg returns true if there is a Register available for the requested | 634 /// argInReg returns true if there is a Register available for the requested |
629 /// type, and false otherwise. If it returns true, Reg is set to the | 635 /// type, and false otherwise. If it returns true, Reg is set to the |
630 /// appropriate register number. Note that, when Ty == IceType_i64, Reg will | 636 /// appropriate register number. Note that, when Ty == IceType_i64, Reg will |
631 /// be an I64 register pair. | 637 /// be an I64 register pair. |
632 bool argInReg(Type Ty, uint32_t ArgNo, RegNumT *Reg); | 638 bool argInReg(Type Ty, uint32_t ArgNo, RegNumT *Reg); |
| 639 void discardReg(RegNumT Reg) { GPRegsUsed |= RegisterAliases[Reg]; } |
633 | 640 |
634 private: | 641 private: |
635 // argInGPR is used to find if any GPR register is available for argument of | 642 // argInGPR is used to find if any GPR register is available for argument of |
636 // type Ty | 643 // type Ty |
637 bool argInGPR(Type Ty, RegNumT *Reg); | 644 bool argInGPR(Type Ty, RegNumT *Reg); |
638 /// argInVFP is to floating-point/vector types what argInGPR is for integer | 645 /// argInVFP is to floating-point/vector types what argInGPR is for integer |
639 /// types. | 646 /// types. |
640 bool argInVFP(Type Ty, RegNumT *Reg); | 647 bool argInVFP(Type Ty, RegNumT *Reg); |
641 inline void discardNextGPRAndItsAliases(CfgVector<RegNumT> *Regs); | 648 inline void discardNextGPRAndItsAliases(CfgVector<RegNumT> *Regs); |
642 inline void alignGPR(CfgVector<RegNumT> *Regs); | 649 inline void alignGPR(CfgVector<RegNumT> *Regs); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 856 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
850 | 857 |
851 private: | 858 private: |
852 ~TargetHeaderMIPS32() = default; | 859 ~TargetHeaderMIPS32() = default; |
853 }; | 860 }; |
854 | 861 |
855 } // end of namespace MIPS32 | 862 } // end of namespace MIPS32 |
856 } // end of namespace Ice | 863 } // end of namespace Ice |
857 | 864 |
858 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 865 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
OLD | NEW |