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

Side by Side Diff: src/IceInstMIPS32.h

Issue 1418523002: Add hybrid assembler concept to ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 2 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 | « src/IceInstARM32.cpp ('k') | src/IceInstMIPS32.cpp » ('j') | no next file with comments »
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 26 matching lines...) Expand all
37 enum OperandKindMIPS32 { 37 enum OperandKindMIPS32 {
38 k__Start = Operand::kTarget, 38 k__Start = Operand::kTarget,
39 kMem, 39 kMem,
40 }; 40 };
41 41
42 using Operand::dump; 42 using Operand::dump;
43 void dump(const Cfg *, Ostream &Str) const override { 43 void dump(const Cfg *, Ostream &Str) const override {
44 if (BuildDefs::dump()) 44 if (BuildDefs::dump())
45 Str << "<OperandMIPS32>"; 45 Str << "<OperandMIPS32>";
46 } 46 }
47
47 protected: 48 protected:
48 OperandMIPS32(OperandKindMIPS32 Kind, Type Ty) 49 OperandMIPS32(OperandKindMIPS32 Kind, Type Ty)
49 : Operand(static_cast<OperandKind>(Kind), Ty) {} 50 : Operand(static_cast<OperandKind>(Kind), Ty) {}
50 }; 51 };
51 52
52 class OperandMIPS32Mem : public OperandMIPS32 { 53 class OperandMIPS32Mem : public OperandMIPS32 {
53 OperandMIPS32Mem() = delete; 54 OperandMIPS32Mem() = delete;
54 OperandMIPS32Mem(const OperandMIPS32Mem &) = delete; 55 OperandMIPS32Mem(const OperandMIPS32Mem &) = delete;
55 OperandMIPS32Mem &operator=(const OperandMIPS32Mem &) = delete; 56 OperandMIPS32Mem &operator=(const OperandMIPS32Mem &) = delete;
56 57
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 Str << (int32_t)Imm; 266 Str << (int32_t)Imm;
266 else 267 else
267 Str << Imm; 268 Str << Imm;
268 Str << "\n"; 269 Str << "\n";
269 } 270 }
270 271
271 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } 272 static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
272 273
273 private: 274 private:
274 InstMIPS32Imm16(Cfg *Func, Variable *Dest, Operand *Source, uint32_t Imm) 275 InstMIPS32Imm16(Cfg *Func, Variable *Dest, Operand *Source, uint32_t Imm)
275 : InstMIPS32(Func, K, 1, Dest), Imm(Imm){ 276 : InstMIPS32(Func, K, 1, Dest), Imm(Imm) {
276 addSource(Source); 277 addSource(Source);
277 } 278 }
278 279
279 InstMIPS32Imm16(Cfg *Func, Variable *Dest, uint32_t Imm) 280 InstMIPS32Imm16(Cfg *Func, Variable *Dest, uint32_t Imm)
280 : InstMIPS32(Func, K, 0, Dest), Imm(Imm) { 281 : InstMIPS32(Func, K, 0, Dest), Imm(Imm) {}
281 }
282 282
283 static const char *Opcode; 283 static const char *Opcode;
284 284
285 const uint32_t Imm; 285 const uint32_t Imm;
286 }; 286 };
287 287
288 typedef InstMIPS32Imm16<InstMIPS32::Addiu, true> InstMIPS32Addiu; 288 typedef InstMIPS32Imm16<InstMIPS32::Addiu, true> InstMIPS32Addiu;
289 typedef InstMIPS32Imm16<InstMIPS32::Lui> InstMIPS32Lui; 289 typedef InstMIPS32Imm16<InstMIPS32::Lui> InstMIPS32Lui;
290 typedef InstMIPS32UnaryopGPR<InstMIPS32::La> InstMIPS32La; 290 typedef InstMIPS32UnaryopGPR<InstMIPS32::La> InstMIPS32La;
291 typedef InstMIPS32Imm16<InstMIPS32::Ori> InstMIPS32Ori; 291 typedef InstMIPS32Imm16<InstMIPS32::Ori> InstMIPS32Ori;
292 292
293 /// Handles (some of) vmov's various formats. 293 /// Handles (some of) vmov's various formats.
294 class InstMIPS32Mov final : public InstMIPS32 { 294 class InstMIPS32Mov final : public InstMIPS32 {
295 InstMIPS32Mov() = delete; 295 InstMIPS32Mov() = delete;
296 InstMIPS32Mov(const InstMIPS32Mov &) = delete; 296 InstMIPS32Mov(const InstMIPS32Mov &) = delete;
297 InstMIPS32Mov &operator=(const InstMIPS32Mov &) = delete; 297 InstMIPS32Mov &operator=(const InstMIPS32Mov &) = delete;
298 298
299 public: 299 public:
300 static InstMIPS32Mov *create(Cfg *Func, Variable *Dest, Operand *Src) { 300 static InstMIPS32Mov *create(Cfg *Func, Variable *Dest, Operand *Src) {
301 return new (Func->allocate<InstMIPS32Mov>()) InstMIPS32Mov(Func, Dest, Src); 301 return new (Func->allocate<InstMIPS32Mov>()) InstMIPS32Mov(Func, Dest, Src);
302 } 302 }
303 bool isRedundantAssign() const override { 303 bool isRedundantAssign() const override {
304 return !isMultiDest() && !isMultiSource() && 304 return !isMultiDest() && !isMultiSource() &&
305 checkForRedundantAssign(getDest(), getSrc(0)); 305 checkForRedundantAssign(getDest(), getSrc(0));
306 } 306 }
307 //bool isSimpleAssign() const override { return true; } 307 // bool isSimpleAssign() const override { return true; }
308 void emit(const Cfg *Func) const override; 308 void emit(const Cfg *Func) const override;
309 void emitIAS(const Cfg *Func) const override; 309 void emitIAS(const Cfg *Func) const override;
310 void dump(const Cfg *Func) const override; 310 void dump(const Cfg *Func) const override;
311 static bool classof(const Inst *Inst) { return isClassof(Inst, Mov); } 311 static bool classof(const Inst *Inst) { return isClassof(Inst, Mov); }
312 312
313 bool isMultiDest() const { return DestHi != nullptr; } 313 bool isMultiDest() const { return DestHi != nullptr; }
314 314
315 bool isMultiSource() const { 315 bool isMultiSource() const {
316 assert(getSrcSize() == 1 || getSrcSize() == 2); 316 assert(getSrcSize() == 1 || getSrcSize() == 2);
317 return getSrcSize() == 2; 317 return getSrcSize() == 2;
318 } 318 }
319 319
320 Variable *getDestHi() const { return DestHi; } 320 Variable *getDestHi() const { return DestHi; }
321 321
322 private: 322 private:
323 InstMIPS32Mov(Cfg *Func, Variable *Dest, Operand *Src); 323 InstMIPS32Mov(Cfg *Func, Variable *Dest, Operand *Src);
324 324
325 void emitMultiDestSingleSource(const Cfg *Func) const; 325 void emitMultiDestSingleSource(const Cfg *Func) const;
326 void emitSingleDestMultiSource(const Cfg *Func) const; 326 void emitSingleDestMultiSource(const Cfg *Func) const;
327 void emitSingleDestSingleSource(const Cfg *Func) const; 327 void emitSingleDestSingleSource(const Cfg *Func) const;
328 328
329 Variable *DestHi = nullptr; 329 Variable *DestHi = nullptr;
330 }; 330 };
331 331
332 } // end of namespace Ice 332 } // end of namespace Ice
333 333
334 #endif // SUBZERO_SRC_ICEINSTMIPS32_H 334 #endif // SUBZERO_SRC_ICEINSTMIPS32_H
OLDNEW
« no previous file with comments | « src/IceInstARM32.cpp ('k') | src/IceInstMIPS32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698