| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 void emit(const ConstantDouble *C) const final { | 110 void emit(const ConstantDouble *C) const final { |
| 111 (void)C; | 111 (void)C; |
| 112 llvm::report_fatal_error("Not yet implemented"); | 112 llvm::report_fatal_error("Not yet implemented"); |
| 113 } | 113 } |
| 114 | 114 |
| 115 // The following are helpers that insert lowered MIPS32 instructions with | 115 // The following are helpers that insert lowered MIPS32 instructions with |
| 116 // minimal syntactic overhead, so that the lowering code can look as close to | 116 // minimal syntactic overhead, so that the lowering code can look as close to |
| 117 // assembly as practical. | 117 // assembly as practical. |
| 118 void _add(Variable *Dest, Variable *Src0, Variable *Src1) { | 118 void _add(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 119 Context.insert(InstMIPS32Add::create(Func, Dest, Src0, Src1)); | 119 Context.insert<InstMIPS32Add>(Dest, Src0, Src1); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void _and(Variable *Dest, Variable *Src0, Variable *Src1) { | 122 void _and(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 123 Context.insert(InstMIPS32And::create(Func, Dest, Src0, Src1)); | 123 Context.insert<InstMIPS32And>(Dest, Src0, Src1); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void _ret(Variable *RA, Variable *Src0 = nullptr) { | 126 void _ret(Variable *RA, Variable *Src0 = nullptr) { |
| 127 Context.insert(InstMIPS32Ret::create(Func, RA, Src0)); | 127 Context.insert<InstMIPS32Ret>(RA, Src0); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void _addiu(Variable *Dest, Variable *Src, uint32_t Imm) { | 130 void _addiu(Variable *Dest, Variable *Src, uint32_t Imm) { |
| 131 Context.insert(InstMIPS32Addiu::create(Func, Dest, Src, Imm)); | 131 Context.insert<InstMIPS32Addiu>(Dest, Src, Imm); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void _lui(Variable *Dest, uint32_t Imm) { | 134 void _lui(Variable *Dest, uint32_t Imm) { |
| 135 Context.insert(InstMIPS32Lui::create(Func, Dest, Imm)); | 135 Context.insert<InstMIPS32Lui>(Dest, Imm); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void _mov(Variable *Dest, Operand *Src0) { | 138 void _mov(Variable *Dest, Operand *Src0) { |
| 139 assert(Dest != nullptr); | 139 assert(Dest != nullptr); |
| 140 // Variable* Src0_ = llvm::dyn_cast<Variable>(Src0); | 140 // Variable* Src0_ = llvm::dyn_cast<Variable>(Src0); |
| 141 if (llvm::isa<ConstantRelocatable>(Src0)) { | 141 if (llvm::isa<ConstantRelocatable>(Src0)) { |
| 142 Context.insert(InstMIPS32La::create(Func, Dest, Src0)); | 142 Context.insert<InstMIPS32La>(Dest, Src0); |
| 143 } else { | 143 } else { |
| 144 auto *Instr = InstMIPS32Mov::create(Func, Dest, Src0); | 144 auto *Instr = Context.insert<InstMIPS32Mov>(Dest, Src0); |
| 145 Context.insert(Instr); | |
| 146 if (Instr->isMultiDest()) { | 145 if (Instr->isMultiDest()) { |
| 147 // If Instr is multi-dest, then Dest must be a Variable64On32. We add a | 146 // If Instr is multi-dest, then Dest must be a Variable64On32. We add a |
| 148 // fake-def for Instr.DestHi here. | 147 // fake-def for Instr.DestHi here. |
| 149 assert(llvm::isa<Variable64On32>(Dest)); | 148 assert(llvm::isa<Variable64On32>(Dest)); |
| 150 Context.insert(InstFakeDef::create(Func, Instr->getDestHi())); | 149 Context.insert<InstFakeDef>(Instr->getDestHi()); |
| 151 } | 150 } |
| 152 } | 151 } |
| 153 } | 152 } |
| 154 | 153 |
| 155 void _mul(Variable *Dest, Variable *Src0, Variable *Src1) { | 154 void _mul(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 156 Context.insert(InstMIPS32Mul::create(Func, Dest, Src0, Src1)); | 155 Context.insert<InstMIPS32Mul>(Dest, Src0, Src1); |
| 157 } | 156 } |
| 158 | 157 |
| 159 void _or(Variable *Dest, Variable *Src0, Variable *Src1) { | 158 void _or(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 160 Context.insert(InstMIPS32Or::create(Func, Dest, Src0, Src1)); | 159 Context.insert<InstMIPS32Or>(Dest, Src0, Src1); |
| 161 } | 160 } |
| 162 | 161 |
| 163 void _ori(Variable *Dest, Variable *Src, uint32_t Imm) { | 162 void _ori(Variable *Dest, Variable *Src, uint32_t Imm) { |
| 164 Context.insert(InstMIPS32Ori::create(Func, Dest, Src, Imm)); | 163 Context.insert<InstMIPS32Ori>(Dest, Src, Imm); |
| 165 } | 164 } |
| 166 | 165 |
| 167 void _sub(Variable *Dest, Variable *Src0, Variable *Src1) { | 166 void _sub(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 168 Context.insert(InstMIPS32Sub::create(Func, Dest, Src0, Src1)); | 167 Context.insert<InstMIPS32Sub>(Dest, Src0, Src1); |
| 169 } | 168 } |
| 170 | 169 |
| 171 void _xor(Variable *Dest, Variable *Src0, Variable *Src1) { | 170 void _xor(Variable *Dest, Variable *Src0, Variable *Src1) { |
| 172 Context.insert(InstMIPS32Xor::create(Func, Dest, Src0, Src1)); | 171 Context.insert<InstMIPS32Xor>(Dest, Src0, Src1); |
| 173 } | 172 } |
| 174 | 173 |
| 175 void lowerArguments() override; | 174 void lowerArguments() override; |
| 176 | 175 |
| 177 /// Operand legalization helpers. To deal with address mode constraints, | 176 /// Operand legalization helpers. To deal with address mode constraints, |
| 178 /// the helpers will create a new Operand and emit instructions that | 177 /// the helpers will create a new Operand and emit instructions that |
| 179 /// guarantee that the Operand kind is one of those indicated by the | 178 /// guarantee that the Operand kind is one of those indicated by the |
| 180 /// LegalMask (a bitmask of allowed kinds). If the input Operand is known | 179 /// LegalMask (a bitmask of allowed kinds). If the input Operand is known |
| 181 /// to already meet the constraints, it may be simply returned as the result, | 180 /// to already meet the constraints, it may be simply returned as the result, |
| 182 /// without creating any new instructions or operands. | 181 /// without creating any new instructions or operands. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 protected: | 298 protected: |
| 300 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 299 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
| 301 | 300 |
| 302 private: | 301 private: |
| 303 ~TargetHeaderMIPS32() = default; | 302 ~TargetHeaderMIPS32() = default; |
| 304 }; | 303 }; |
| 305 | 304 |
| 306 } // end of namespace Ice | 305 } // end of namespace Ice |
| 307 | 306 |
| 308 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 307 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
| OLD | NEW |