Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1091)

Side by Side Diff: src/IceInstMIPS32.h

Issue 1993993004: Subzero, MIPS32: Introduction of floating point registers (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Register allocation works, some code is removed Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceInstMIPS32.cpp » ('j') | src/IceInstMIPS32.def » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceInstMIPS32.h - MIPS32 machine instrs --*- C++ -*-=== // 1 //===- subzero/src/IceInstMIPS32.h - MIPS32 machine instrs --*- 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Add, 120 Add,
121 Addiu, 121 Addiu,
122 Addu, 122 Addu,
123 And, 123 And,
124 Andi, 124 Andi,
125 Br, 125 Br,
126 Call, 126 Call,
127 La, 127 La,
128 Label, 128 Label,
129 Lui, 129 Lui,
130 Mfc1,
130 Mfhi, 131 Mfhi,
131 Mflo, 132 Mflo,
132 Mov, // actually a pseudo op for addi rd, rs, 0 133 Mov, // actually a pseudo op for addi rd, rs, 0
134 Mtc1,
133 Mthi, 135 Mthi,
134 Mtlo, 136 Mtlo,
135 Mul, 137 Mul,
136 Mult, 138 Mult,
137 Multu, 139 Multu,
138 Or, 140 Or,
139 Ori, 141 Ori,
140 Ret, 142 Ret,
141 Sll, 143 Sll,
142 Sllv, 144 Sllv,
(...skipping 22 matching lines...) Expand all
165 // TODO(rkotler): while branching is not implemented 167 // TODO(rkotler): while branching is not implemented
166 bool repointEdges(CfgNode *, CfgNode *) override { return true; } 168 bool repointEdges(CfgNode *, CfgNode *) override { return true; }
167 169
168 /// Shared emit routines for common forms of instructions. 170 /// Shared emit routines for common forms of instructions.
169 static void emitUnaryopGPR(const char *Opcode, const InstMIPS32 *Inst, 171 static void emitUnaryopGPR(const char *Opcode, const InstMIPS32 *Inst,
170 const Cfg *Func); 172 const Cfg *Func);
171 static void emitUnaryopGPRFLoHi(const char *Opcode, const InstMIPS32 *Inst, 173 static void emitUnaryopGPRFLoHi(const char *Opcode, const InstMIPS32 *Inst,
172 const Cfg *Func); 174 const Cfg *Func);
173 static void emitUnaryopGPRTLoHi(const char *Opcode, const InstMIPS32 *Inst, 175 static void emitUnaryopGPRTLoHi(const char *Opcode, const InstMIPS32 *Inst,
174 const Cfg *Func); 176 const Cfg *Func);
177 static void emitTwoAddr(const char *Opcode, const InstMIPS32 *Inst,
178 const Cfg *Func);
175 static void emitThreeAddr(const char *Opcode, const InstMIPS32 *Inst, 179 static void emitThreeAddr(const char *Opcode, const InstMIPS32 *Inst,
176 const Cfg *Func); 180 const Cfg *Func);
177 static void emitThreeAddrLoHi(const char *Opcode, const InstMIPS32 *Inst, 181 static void emitThreeAddrLoHi(const char *Opcode, const InstMIPS32 *Inst,
178 const Cfg *Func); 182 const Cfg *Func);
179 183
180 protected: 184 protected:
181 InstMIPS32(Cfg *Func, InstKindMIPS32 Kind, SizeT Maxsrcs, Variable *Dest) 185 InstMIPS32(Cfg *Func, InstKindMIPS32 Kind, SizeT Maxsrcs, Variable *Dest)
182 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} 186 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
183 static bool isClassof(const Inst *Inst, InstKindMIPS32 MyKind) { 187 static bool isClassof(const Inst *Inst, InstKindMIPS32 MyKind) {
184 return Inst->getKind() == static_cast<InstKind>(MyKind); 188 return Inst->getKind() == static_cast<InstKind>(MyKind);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 protected: 253 protected:
250 InstMIPS32UnaryopGPR(Cfg *Func, Variable *Dest, Operand *Src) 254 InstMIPS32UnaryopGPR(Cfg *Func, Variable *Dest, Operand *Src)
251 : InstMIPS32(Func, K, 1, Dest) { 255 : InstMIPS32(Func, K, 1, Dest) {
252 addSource(Src); 256 addSource(Src);
253 } 257 }
254 258
255 private: 259 private:
256 static const char *Opcode; 260 static const char *Opcode;
257 }; 261 };
258 262
263 /// Instructions of the form opcode reg, reg.
264 template <InstMIPS32::InstKindMIPS32 K>
265 class InstMIPS32TwoAddrGPR : public InstMIPS32 {
266 InstMIPS32TwoAddrGPR() = delete;
267 InstMIPS32TwoAddrGPR(const InstMIPS32TwoAddrGPR &) = delete;
268 InstMIPS32TwoAddrGPR &operator=(const InstMIPS32TwoAddrGPR &) = delete;
269
270 public:
271 static InstMIPS32TwoAddrGPR *create(Cfg *Func, Variable *Dest,
272 Variable *Src0) {
273 return new (Func->allocate<InstMIPS32TwoAddrGPR>())
274 InstMIPS32TwoAddrGPR(Func, Dest, Src0);
275 }
276 void emit(const Cfg *Func) const override {
277 if (!BuildDefs::dump())
278 return;
279 emitTwoAddr(Opcode, this, Func);
280 }
281 void emitIAS(const Cfg *Func) const override {
282 (void)Func;
283 llvm_unreachable("Not yet implemented");
284 }
285
286 void dump(const Cfg *Func) const override {
287 if (!BuildDefs::dump())
288 return;
289 Ostream &Str = Func->getContext()->getStrDump();
290 dumpDest(Func);
291 Str << " = ";
292 dumpOpcode(Str, Opcode, getDest()->getType());
293 Str << " ";
294 dumpSources(Func);
295 }
296 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
297
298 private:
299 InstMIPS32TwoAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0)
300 : InstMIPS32(Func, K, 2, Dest) {
Jim Stichnoth 2016/05/19 23:12:25 The "2" is the max number of src operands. I thin
obucinac 2016/05/27 11:13:18 Done.
301 addSource(Src0);
302 }
303
304 static const char *Opcode;
305 };
306
259 /// Instructions of the form x := y op z. May have the side-effect of setting 307 /// Instructions of the form x := y op z. May have the side-effect of setting
260 /// status flags. 308 /// status flags.
261 template <InstMIPS32::InstKindMIPS32 K> 309 template <InstMIPS32::InstKindMIPS32 K>
262 class InstMIPS32ThreeAddrGPR : public InstMIPS32 { 310 class InstMIPS32ThreeAddrGPR : public InstMIPS32 {
263 InstMIPS32ThreeAddrGPR() = delete; 311 InstMIPS32ThreeAddrGPR() = delete;
264 InstMIPS32ThreeAddrGPR(const InstMIPS32ThreeAddrGPR &) = delete; 312 InstMIPS32ThreeAddrGPR(const InstMIPS32ThreeAddrGPR &) = delete;
265 InstMIPS32ThreeAddrGPR &operator=(const InstMIPS32ThreeAddrGPR &) = delete; 313 InstMIPS32ThreeAddrGPR &operator=(const InstMIPS32ThreeAddrGPR &) = delete;
266 314
267 public: 315 public:
268 /// Create an ordinary binary-op instruction like add, and sub. Dest and Src1 316 /// Create an ordinary binary-op instruction like add, and sub. Dest and Src1
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 const uint32_t Imm; 513 const uint32_t Imm;
466 }; 514 };
467 515
468 using InstMIPS32Add = InstMIPS32ThreeAddrGPR<InstMIPS32::Add>; 516 using InstMIPS32Add = InstMIPS32ThreeAddrGPR<InstMIPS32::Add>;
469 using InstMIPS32Addu = InstMIPS32ThreeAddrGPR<InstMIPS32::Addu>; 517 using InstMIPS32Addu = InstMIPS32ThreeAddrGPR<InstMIPS32::Addu>;
470 using InstMIPS32Addiu = InstMIPS32Imm16<InstMIPS32::Addiu, true>; 518 using InstMIPS32Addiu = InstMIPS32Imm16<InstMIPS32::Addiu, true>;
471 using InstMIPS32And = InstMIPS32ThreeAddrGPR<InstMIPS32::And>; 519 using InstMIPS32And = InstMIPS32ThreeAddrGPR<InstMIPS32::And>;
472 using InstMIPS32Andi = InstMIPS32Imm16<InstMIPS32::Andi>; 520 using InstMIPS32Andi = InstMIPS32Imm16<InstMIPS32::Andi>;
473 using InstMIPS32Lui = InstMIPS32Imm16<InstMIPS32::Lui>; 521 using InstMIPS32Lui = InstMIPS32Imm16<InstMIPS32::Lui>;
474 using InstMIPS32La = InstMIPS32UnaryopGPR<InstMIPS32::La>; 522 using InstMIPS32La = InstMIPS32UnaryopGPR<InstMIPS32::La>;
523 using InstMIPS32Mfc1 = InstMIPS32TwoAddrGPR<InstMIPS32::Mfc1>;
475 using InstMIPS32Mfhi = InstMIPS32UnaryopGPR<InstMIPS32::Mfhi>; 524 using InstMIPS32Mfhi = InstMIPS32UnaryopGPR<InstMIPS32::Mfhi>;
476 using InstMIPS32Mflo = InstMIPS32UnaryopGPR<InstMIPS32::Mflo>; 525 using InstMIPS32Mflo = InstMIPS32UnaryopGPR<InstMIPS32::Mflo>;
526 using InstMIPS32Mtc1 = InstMIPS32TwoAddrGPR<InstMIPS32::Mtc1>;
477 using InstMIPS32Mthi = InstMIPS32UnaryopGPR<InstMIPS32::Mthi>; 527 using InstMIPS32Mthi = InstMIPS32UnaryopGPR<InstMIPS32::Mthi>;
478 using InstMIPS32Mtlo = InstMIPS32UnaryopGPR<InstMIPS32::Mtlo>; 528 using InstMIPS32Mtlo = InstMIPS32UnaryopGPR<InstMIPS32::Mtlo>;
479 using InstMIPS32Mul = InstMIPS32ThreeAddrGPR<InstMIPS32::Mul>; 529 using InstMIPS32Mul = InstMIPS32ThreeAddrGPR<InstMIPS32::Mul>;
480 using InstMIPS32Mult = InstMIPS32ThreeAddrGPR<InstMIPS32::Mult>; 530 using InstMIPS32Mult = InstMIPS32ThreeAddrGPR<InstMIPS32::Mult>;
481 using InstMIPS32Multu = InstMIPS32ThreeAddrGPR<InstMIPS32::Multu>; 531 using InstMIPS32Multu = InstMIPS32ThreeAddrGPR<InstMIPS32::Multu>;
482 using InstMIPS32Or = InstMIPS32ThreeAddrGPR<InstMIPS32::Or>; 532 using InstMIPS32Or = InstMIPS32ThreeAddrGPR<InstMIPS32::Or>;
483 using InstMIPS32Ori = InstMIPS32Imm16<InstMIPS32::Ori>; 533 using InstMIPS32Ori = InstMIPS32Imm16<InstMIPS32::Ori>;
484 using InstMIPS32Sll = InstMIPS32Imm16<InstMIPS32::Sll>; 534 using InstMIPS32Sll = InstMIPS32Imm16<InstMIPS32::Sll>;
485 using InstMIPS32Sllv = InstMIPS32ThreeAddrGPR<InstMIPS32::Sllv>; 535 using InstMIPS32Sllv = InstMIPS32ThreeAddrGPR<InstMIPS32::Sllv>;
486 using InstMIPS32Slt = InstMIPS32ThreeAddrGPR<InstMIPS32::Slt>; 536 using InstMIPS32Slt = InstMIPS32ThreeAddrGPR<InstMIPS32::Slt>;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 template <> void InstMIPS32Mfhi::emit(const Cfg *Func) const; 594 template <> void InstMIPS32Mfhi::emit(const Cfg *Func) const;
545 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const; 595 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const;
546 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const; 596 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const;
547 template <> void InstMIPS32Mult::emit(const Cfg *Func) const; 597 template <> void InstMIPS32Mult::emit(const Cfg *Func) const;
548 template <> void InstMIPS32Multu::emit(const Cfg *Func) const; 598 template <> void InstMIPS32Multu::emit(const Cfg *Func) const;
549 599
550 } // end of namespace MIPS32 600 } // end of namespace MIPS32
551 } // end of namespace Ice 601 } // end of namespace Ice
552 602
553 #endif // SUBZERO_SRC_ICEINSTMIPS32_H 603 #endif // SUBZERO_SRC_ICEINSTMIPS32_H
OLDNEW
« no previous file with comments | « no previous file | src/IceInstMIPS32.cpp » ('j') | src/IceInstMIPS32.def » ('J')

Powered by Google App Engine
This is Rietveld 408576698