Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstARM32.h - ARM32 machine instructions --*- 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 // This file declares the InstARM32 and OperandARM32 classes and | 10 // This file declares the InstARM32 and OperandARM32 classes and |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 Umull, | 289 Umull, |
| 290 Uxt | 290 Uxt |
| 291 }; | 291 }; |
| 292 | 292 |
| 293 static const char *getWidthString(Type Ty); | 293 static const char *getWidthString(Type Ty); |
| 294 static CondARM32::Cond getOppositeCondition(CondARM32::Cond Cond); | 294 static CondARM32::Cond getOppositeCondition(CondARM32::Cond Cond); |
| 295 | 295 |
| 296 void dump(const Cfg *Func) const override; | 296 void dump(const Cfg *Func) const override; |
| 297 | 297 |
| 298 protected: | 298 protected: |
| 299 InstARM32(Cfg *Func, InstKindARM32 Kind, SizeT Maxsrcs, Variable *Dest) | 299 InstARM32(Cfg *Func, InstKindARM32 Kind, SizeT Maxsrcs, Variable *Dest) |
|
Karl
2015/07/07 17:00:40
Again, I'm not sure what are the rules for naming
John
2015/07/07 17:07:49
I believe the "My" prefix is only added when the p
Jim Stichnoth
2015/07/13 19:33:37
Right. The idea is that you generally name argume
| |
| 300 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} | 300 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} |
| 301 | 301 |
| 302 static bool isClassof(const Inst *Inst, InstKindARM32 MyKind) { | 302 static bool isClassof(const Inst *Inst, InstKindARM32 MyKind) { |
| 303 return Inst->getKind() == static_cast<InstKind>(MyKind); | 303 return Inst->getKind() == static_cast<InstKind>(MyKind); |
| 304 } | 304 } |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 // A predicable ARM instruction. | 307 // A predicable ARM instruction. |
| 308 class InstARM32Pred : public InstARM32 { | 308 class InstARM32Pred : public InstARM32 { |
| 309 InstARM32Pred() = delete; | 309 InstARM32Pred() = delete; |
| 310 InstARM32Pred(const InstARM32Pred &) = delete; | 310 InstARM32Pred(const InstARM32Pred &) = delete; |
| 311 InstARM32Pred &operator=(const InstARM32Pred &) = delete; | 311 InstARM32Pred &operator=(const InstARM32Pred &) = delete; |
| 312 | 312 |
| 313 public: | 313 public: |
| 314 InstARM32Pred(Cfg *Func, InstKindARM32 Kind, SizeT Maxsrcs, Variable *Dest, | 314 InstARM32Pred(Cfg *Func, InstKindARM32 Kind, SizeT Maxsrcs, Variable *Dest, |
| 315 CondARM32::Cond Predicate) | 315 CondARM32::Cond MyPredicate) |
| 316 : InstARM32(Func, Kind, Maxsrcs, Dest), Predicate(Predicate) {} | 316 : InstARM32(Func, Kind, Maxsrcs, Dest), Predicate(MyPredicate) {} |
| 317 | 317 |
| 318 CondARM32::Cond getPredicate() const { return Predicate; } | 318 CondARM32::Cond getPredicate() const { return Predicate; } |
| 319 void setPredicate(CondARM32::Cond Pred) { Predicate = Pred; } | 319 void setPredicate(CondARM32::Cond Pred) { Predicate = Pred; } |
| 320 | 320 |
| 321 static const char *predString(CondARM32::Cond Predicate); | 321 static const char *predString(CondARM32::Cond Predicate); |
| 322 void dumpOpcodePred(Ostream &Str, const char *Opcode, Type Ty) const; | 322 void dumpOpcodePred(Ostream &Str, const char *Opcode, Type Ty) const; |
| 323 | 323 |
| 324 // Shared emit routines for common forms of instructions. | 324 // Shared emit routines for common forms of instructions. |
| 325 static void emitUnaryopGPR(const char *Opcode, const InstARM32Pred *Inst, | 325 static void emitUnaryopGPR(const char *Opcode, const InstARM32Pred *Inst, |
| 326 const Cfg *Func); | 326 const Cfg *Func); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 dumpDest(Func); | 509 dumpDest(Func); |
| 510 Str << " = "; | 510 Str << " = "; |
| 511 dumpOpcodePred(Str, Opcode, getDest()->getType()); | 511 dumpOpcodePred(Str, Opcode, getDest()->getType()); |
| 512 Str << (SetFlags ? ".s " : " "); | 512 Str << (SetFlags ? ".s " : " "); |
| 513 dumpSources(Func); | 513 dumpSources(Func); |
| 514 } | 514 } |
| 515 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 515 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 516 | 516 |
| 517 private: | 517 private: |
| 518 InstARM32ThreeAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0, | 518 InstARM32ThreeAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0, |
| 519 Operand *Src1, CondARM32::Cond Predicate, bool SetFlags) | 519 Operand *Src1, CondARM32::Cond Predicate, |
| 520 : InstARM32Pred(Func, K, 2, Dest, Predicate), SetFlags(SetFlags) { | 520 bool MySetFlags) |
| 521 : InstARM32Pred(Func, K, 2, Dest, Predicate), SetFlags(MySetFlags) { | |
| 521 addSource(Src0); | 522 addSource(Src0); |
| 522 addSource(Src1); | 523 addSource(Src1); |
| 523 } | 524 } |
| 524 | 525 |
| 525 static const char *Opcode; | 526 static const char *Opcode; |
| 526 bool SetFlags; | 527 bool SetFlags; |
| 527 }; | 528 }; |
| 528 | 529 |
| 529 // Instructions of the form x := a op1 (y op2 z). E.g., multiply accumulate. | 530 // Instructions of the form x := a op1 (y op2 z). E.g., multiply accumulate. |
| 530 template <InstARM32::InstKindARM32 K> | 531 template <InstARM32::InstKindARM32 K> |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 965 // Declare partial template specializations of emit() methods that | 966 // Declare partial template specializations of emit() methods that |
| 966 // already have default implementations. Without this, there is the | 967 // already have default implementations. Without this, there is the |
| 967 // possibility of ODR violations and link errors. | 968 // possibility of ODR violations and link errors. |
| 968 | 969 |
| 969 template <> void InstARM32Movw::emit(const Cfg *Func) const; | 970 template <> void InstARM32Movw::emit(const Cfg *Func) const; |
| 970 template <> void InstARM32Movt::emit(const Cfg *Func) const; | 971 template <> void InstARM32Movt::emit(const Cfg *Func) const; |
| 971 | 972 |
| 972 } // end of namespace Ice | 973 } // end of namespace Ice |
| 973 | 974 |
| 974 #endif // SUBZERO_SRC_ICEINSTARM32_H | 975 #endif // SUBZERO_SRC_ICEINSTARM32_H |
| OLD | NEW |