| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 llvm::report_fatal_error("Not yet implemented"); | 84 llvm::report_fatal_error("Not yet implemented"); |
| 85 } | 85 } |
| 86 void emit(const ConstantFloat *C) const final { | 86 void emit(const ConstantFloat *C) const final { |
| 87 (void)C; | 87 (void)C; |
| 88 llvm::report_fatal_error("Not yet implemented"); | 88 llvm::report_fatal_error("Not yet implemented"); |
| 89 } | 89 } |
| 90 void emit(const ConstantDouble *C) const final { | 90 void emit(const ConstantDouble *C) const final { |
| 91 (void)C; | 91 (void)C; |
| 92 llvm::report_fatal_error("Not yet implemented"); | 92 llvm::report_fatal_error("Not yet implemented"); |
| 93 } | 93 } |
| 94 |
| 95 // The following are helpers that insert lowered MIPS32 instructions with |
| 96 // minimal syntactic overhead, so that the lowering code can look as close to |
| 97 // assembly as practical. |
| 98 void _add(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 99 Context.insert(InstMIPS32Add::create(Func, Dest, Src0, Src1)); |
| 100 } |
| 101 |
| 102 void _and(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 103 Context.insert(InstMIPS32And::create(Func, Dest, Src0, Src1)); |
| 104 } |
| 105 |
| 94 void _ret(Variable *RA, Variable *Src0 = nullptr) { | 106 void _ret(Variable *RA, Variable *Src0 = nullptr) { |
| 95 Context.insert(InstMIPS32Ret::create(Func, RA, Src0)); | 107 Context.insert(InstMIPS32Ret::create(Func, RA, Src0)); |
| 96 } | 108 } |
| 97 | 109 |
| 98 void _addiu(Variable *Dest, Variable *Src, uint32_t Imm) { | 110 void _addiu(Variable *Dest, Variable *Src, uint32_t Imm) { |
| 99 Context.insert(InstMIPS32Addiu::create(Func, Dest, Src, Imm)); | 111 Context.insert(InstMIPS32Addiu::create(Func, Dest, Src, Imm)); |
| 100 } | 112 } |
| 101 | 113 |
| 102 void _lui(Variable *Dest, uint32_t Imm) { | 114 void _lui(Variable *Dest, uint32_t Imm) { |
| 103 Context.insert(InstMIPS32Lui::create(Func, Dest, Imm)); | 115 Context.insert(InstMIPS32Lui::create(Func, Dest, Imm)); |
| 104 } | 116 } |
| 105 | 117 |
| 106 void _mov(Variable *Dest, Operand *Src0) { | 118 void _mov(Variable *Dest, Operand *Src0) { |
| 107 assert(Dest != nullptr); | 119 assert(Dest != nullptr); |
| 108 // Variable* Src0_ = llvm::dyn_cast<Variable>(Src0); | 120 // Variable* Src0_ = llvm::dyn_cast<Variable>(Src0); |
| 109 if (llvm::isa<ConstantRelocatable>(Src0)) { | 121 if (llvm::isa<ConstantRelocatable>(Src0)) { |
| 110 Context.insert(InstMIPS32La::create(Func, Dest, Src0)); | 122 Context.insert(InstMIPS32La::create(Func, Dest, Src0)); |
| 111 } else { | 123 } else { |
| 112 auto *Instr = InstMIPS32Mov::create(Func, Dest, Src0); | 124 auto *Instr = InstMIPS32Mov::create(Func, Dest, Src0); |
| 113 Context.insert(Instr); | 125 Context.insert(Instr); |
| 114 if (Instr->isMultiDest()) { | 126 if (Instr->isMultiDest()) { |
| 115 // If Instr is multi-dest, then Dest must be a Variable64On32. We add a | 127 // If Instr is multi-dest, then Dest must be a Variable64On32. We add a |
| 116 // fake-def for Instr.DestHi here. | 128 // fake-def for Instr.DestHi here. |
| 117 assert(llvm::isa<Variable64On32>(Dest)); | 129 assert(llvm::isa<Variable64On32>(Dest)); |
| 118 Context.insert(InstFakeDef::create(Func, Instr->getDestHi())); | 130 Context.insert(InstFakeDef::create(Func, Instr->getDestHi())); |
| 119 } | 131 } |
| 120 } | 132 } |
| 121 } | 133 } |
| 122 | 134 |
| 135 void _mul(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 136 Context.insert(InstMIPS32Mul::create(Func, Dest, Src0, Src1)); |
| 137 } |
| 138 |
| 139 void _or(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 140 Context.insert(InstMIPS32Or::create(Func, Dest, Src0, Src1)); |
| 141 } |
| 142 |
| 123 void _ori(Variable *Dest, Variable *Src, uint32_t Imm) { | 143 void _ori(Variable *Dest, Variable *Src, uint32_t Imm) { |
| 124 Context.insert(InstMIPS32Ori::create(Func, Dest, Src, Imm)); | 144 Context.insert(InstMIPS32Ori::create(Func, Dest, Src, Imm)); |
| 125 } | 145 } |
| 126 | 146 |
| 147 void _sub(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 148 Context.insert(InstMIPS32Sub::create(Func, Dest, Src0, Src1)); |
| 149 } |
| 150 |
| 151 void _xor(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 152 Context.insert(InstMIPS32Xor::create(Func, Dest, Src0, Src1)); |
| 153 } |
| 154 |
| 127 void lowerArguments() override; | 155 void lowerArguments() override; |
| 128 | 156 |
| 129 /// Operand legalization helpers. To deal with address mode constraints, | 157 /// Operand legalization helpers. To deal with address mode constraints, |
| 130 /// the helpers will create a new Operand and emit instructions that | 158 /// the helpers will create a new Operand and emit instructions that |
| 131 /// guarantee that the Operand kind is one of those indicated by the | 159 /// guarantee that the Operand kind is one of those indicated by the |
| 132 /// LegalMask (a bitmask of allowed kinds). If the input Operand is known | 160 /// LegalMask (a bitmask of allowed kinds). If the input Operand is known |
| 133 /// to already meet the constraints, it may be simply returned as the result, | 161 /// to already meet the constraints, it may be simply returned as the result, |
| 134 /// without creating any new instructions or operands. | 162 /// without creating any new instructions or operands. |
| 135 enum OperandLegalization { | 163 enum OperandLegalization { |
| 136 Legal_None = 0, | 164 Legal_None = 0, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 protected: | 274 protected: |
| 247 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 275 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
| 248 | 276 |
| 249 private: | 277 private: |
| 250 ~TargetHeaderMIPS32() = default; | 278 ~TargetHeaderMIPS32() = default; |
| 251 }; | 279 }; |
| 252 | 280 |
| 253 } // end of namespace Ice | 281 } // end of namespace Ice |
| 254 | 282 |
| 255 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 283 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
| OLD | NEW |