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