| 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 15 matching lines...) Expand all Loading... |
| 26 namespace MIPS32 { | 26 namespace MIPS32 { |
| 27 | 27 |
| 28 class TargetMIPS32 : public TargetLowering { | 28 class TargetMIPS32 : public TargetLowering { |
| 29 TargetMIPS32() = delete; | 29 TargetMIPS32() = delete; |
| 30 TargetMIPS32(const TargetMIPS32 &) = delete; | 30 TargetMIPS32(const TargetMIPS32 &) = delete; |
| 31 TargetMIPS32 &operator=(const TargetMIPS32 &) = delete; | 31 TargetMIPS32 &operator=(const TargetMIPS32 &) = delete; |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 ~TargetMIPS32() override = default; | 34 ~TargetMIPS32() override = default; |
| 35 | 35 |
| 36 static void staticInit(); | 36 static void staticInit(const ClFlags &Flags); |
| 37 static std::unique_ptr<::Ice::TargetLowering> create(Cfg *Func) { | 37 static std::unique_ptr<::Ice::TargetLowering> create(Cfg *Func) { |
| 38 return makeUnique<TargetMIPS32>(Func); | 38 return makeUnique<TargetMIPS32>(Func); |
| 39 } | 39 } |
| 40 | 40 |
| 41 std::unique_ptr<::Ice::Assembler> createAssembler() const override { | 41 std::unique_ptr<::Ice::Assembler> createAssembler() const override { |
| 42 return makeUnique<MIPS32::AssemblerMIPS32>(); | 42 return makeUnique<MIPS32::AssemblerMIPS32>(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void translateOm1() override; | 45 void translateOm1() override; |
| 46 void translateO2() override; | 46 void translateO2() override; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return Ty == IceType_i64; | 92 return Ty == IceType_i64; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // TODO(ascull): what is the best size of MIPS? | 95 // TODO(ascull): what is the best size of MIPS? |
| 96 SizeT getMinJumpTableSize() const override { return 3; } | 96 SizeT getMinJumpTableSize() const override { return 3; } |
| 97 void emitJumpTable(const Cfg *Func, | 97 void emitJumpTable(const Cfg *Func, |
| 98 const InstJumpTable *JumpTable) const override; | 98 const InstJumpTable *JumpTable) const override; |
| 99 | 99 |
| 100 void emitVariable(const Variable *Var) const override; | 100 void emitVariable(const Variable *Var) const override; |
| 101 | 101 |
| 102 const char *getConstantPrefix() const final { return ""; } | |
| 103 void emit(const ConstantUndef *C) const final { | |
| 104 (void)C; | |
| 105 llvm::report_fatal_error("Not yet implemented"); | |
| 106 } | |
| 107 void emit(const ConstantInteger32 *C) const final { | 102 void emit(const ConstantInteger32 *C) const final { |
| 108 (void)C; | 103 (void)C; |
| 109 llvm::report_fatal_error("Not yet implemented"); | 104 llvm::report_fatal_error("Not yet implemented"); |
| 110 } | 105 } |
| 111 void emit(const ConstantInteger64 *C) const final { | 106 void emit(const ConstantInteger64 *C) const final { |
| 112 (void)C; | 107 (void)C; |
| 113 llvm::report_fatal_error("Not yet implemented"); | 108 llvm::report_fatal_error("Not yet implemented"); |
| 114 } | 109 } |
| 115 void emit(const ConstantFloat *C) const final { | 110 void emit(const ConstantFloat *C) const final { |
| 116 (void)C; | 111 (void)C; |
| 117 llvm::report_fatal_error("Not yet implemented"); | 112 llvm::report_fatal_error("Not yet implemented"); |
| 118 } | 113 } |
| 119 void emit(const ConstantDouble *C) const final { | 114 void emit(const ConstantDouble *C) const final { |
| 120 (void)C; | 115 (void)C; |
| 121 llvm::report_fatal_error("Not yet implemented"); | 116 llvm::report_fatal_error("Not yet implemented"); |
| 122 } | 117 } |
| 118 void emit(const ConstantUndef *C) const final { |
| 119 (void)C; |
| 120 llvm::report_fatal_error("Not yet implemented"); |
| 121 } |
| 122 void emit(const ConstantRelocatable *C) const final { |
| 123 (void)C; |
| 124 llvm::report_fatal_error("Not yet implemented"); |
| 125 } |
| 123 | 126 |
| 124 // The following are helpers that insert lowered MIPS32 instructions with | 127 // The following are helpers that insert lowered MIPS32 instructions with |
| 125 // minimal syntactic overhead, so that the lowering code can look as close to | 128 // minimal syntactic overhead, so that the lowering code can look as close to |
| 126 // assembly as practical. | 129 // assembly as practical. |
| 127 void _add(Variable *Dest, Variable *Src0, Variable *Src1) { | 130 void _add(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 128 Context.insert<InstMIPS32Add>(Dest, Src0, Src1); | 131 Context.insert<InstMIPS32Add>(Dest, Src0, Src1); |
| 129 } | 132 } |
| 130 | 133 |
| 131 void _and(Variable *Dest, Variable *Src0, Variable *Src1) { | 134 void _and(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 132 Context.insert<InstMIPS32And>(Dest, Src0, Src1); | 135 Context.insert<InstMIPS32And>(Dest, Src0, Src1); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 /// the helpers will create a new Operand and emit instructions that | 189 /// the helpers will create a new Operand and emit instructions that |
| 187 /// guarantee that the Operand kind is one of those indicated by the | 190 /// guarantee that the Operand kind is one of those indicated by the |
| 188 /// LegalMask (a bitmask of allowed kinds). If the input Operand is known | 191 /// LegalMask (a bitmask of allowed kinds). If the input Operand is known |
| 189 /// to already meet the constraints, it may be simply returned as the result, | 192 /// to already meet the constraints, it may be simply returned as the result, |
| 190 /// without creating any new instructions or operands. | 193 /// without creating any new instructions or operands. |
| 191 enum OperandLegalization { | 194 enum OperandLegalization { |
| 192 Legal_None = 0, | 195 Legal_None = 0, |
| 193 Legal_Reg = 1 << 0, // physical register, not stack location | 196 Legal_Reg = 1 << 0, // physical register, not stack location |
| 194 Legal_Imm = 1 << 1, | 197 Legal_Imm = 1 << 1, |
| 195 Legal_Mem = 1 << 2, | 198 Legal_Mem = 1 << 2, |
| 196 Legal_All = ~Legal_None | 199 Legal_Default = ~Legal_None |
| 197 }; | 200 }; |
| 198 typedef uint32_t LegalMask; | 201 typedef uint32_t LegalMask; |
| 199 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All, | 202 Operand *legalize(Operand *From, LegalMask Allowed = Legal_Default, |
| 200 int32_t RegNum = Variable::NoRegister); | 203 int32_t RegNum = Variable::NoRegister); |
| 201 | 204 |
| 202 Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister); | 205 Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister); |
| 203 | 206 |
| 204 Variable *legalizeToReg(Operand *From, int32_t RegNum = Variable::NoRegister); | 207 Variable *legalizeToReg(Operand *From, int32_t RegNum = Variable::NoRegister); |
| 205 | 208 |
| 206 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); | 209 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); |
| 207 static Type stackSlotType(); | 210 static Type stackSlotType(); |
| 208 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); | 211 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); |
| 209 | 212 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 311 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
| 309 | 312 |
| 310 private: | 313 private: |
| 311 ~TargetHeaderMIPS32() = default; | 314 ~TargetHeaderMIPS32() = default; |
| 312 }; | 315 }; |
| 313 | 316 |
| 314 } // end of namespace MIPS32 | 317 } // end of namespace MIPS32 |
| 315 } // end of namespace Ice | 318 } // end of namespace Ice |
| 316 | 319 |
| 317 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 320 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
| OLD | NEW |