| 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 /// \file | 10 /// \file |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 k__Start = Inst::Target, | 255 k__Start = Inst::Target, |
| 256 Adc, | 256 Adc, |
| 257 Add, | 257 Add, |
| 258 Adjuststack, | 258 Adjuststack, |
| 259 And, | 259 And, |
| 260 Asr, | 260 Asr, |
| 261 Bic, | 261 Bic, |
| 262 Br, | 262 Br, |
| 263 Call, | 263 Call, |
| 264 Cmp, | 264 Cmp, |
| 265 Clz, |
| 265 Eor, | 266 Eor, |
| 266 Label, | 267 Label, |
| 267 Ldr, | 268 Ldr, |
| 268 Lsl, | 269 Lsl, |
| 269 Lsr, | 270 Lsr, |
| 270 Mla, | 271 Mla, |
| 271 Mls, | 272 Mls, |
| 272 Mov, | 273 Mov, |
| 273 Movt, | 274 Movt, |
| 274 Movw, | 275 Movw, |
| 275 Mul, | 276 Mul, |
| 276 Mvn, | 277 Mvn, |
| 277 Orr, | 278 Orr, |
| 278 Pop, | 279 Pop, |
| 279 Push, | 280 Push, |
| 281 Rbit, |
| 280 Ret, | 282 Ret, |
| 283 Rev, |
| 281 Rsb, | 284 Rsb, |
| 282 Sbc, | 285 Sbc, |
| 283 Sdiv, | 286 Sdiv, |
| 284 Str, | 287 Str, |
| 285 Sub, | 288 Sub, |
| 286 Sxt, | 289 Sxt, |
| 287 Trap, | 290 Trap, |
| 288 Tst, | 291 Tst, |
| 289 Udiv, | 292 Udiv, |
| 290 Umull, | 293 Umull, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 317 : InstARM32(Func, Kind, Maxsrcs, Dest), Predicate(Predicate) {} | 320 : InstARM32(Func, Kind, Maxsrcs, Dest), Predicate(Predicate) {} |
| 318 | 321 |
| 319 CondARM32::Cond getPredicate() const { return Predicate; } | 322 CondARM32::Cond getPredicate() const { return Predicate; } |
| 320 void setPredicate(CondARM32::Cond Pred) { Predicate = Pred; } | 323 void setPredicate(CondARM32::Cond Pred) { Predicate = Pred; } |
| 321 | 324 |
| 322 static const char *predString(CondARM32::Cond Predicate); | 325 static const char *predString(CondARM32::Cond Predicate); |
| 323 void dumpOpcodePred(Ostream &Str, const char *Opcode, Type Ty) const; | 326 void dumpOpcodePred(Ostream &Str, const char *Opcode, Type Ty) const; |
| 324 | 327 |
| 325 /// Shared emit routines for common forms of instructions. | 328 /// Shared emit routines for common forms of instructions. |
| 326 static void emitUnaryopGPR(const char *Opcode, const InstARM32Pred *Inst, | 329 static void emitUnaryopGPR(const char *Opcode, const InstARM32Pred *Inst, |
| 327 const Cfg *Func); | 330 const Cfg *Func, bool NeedsWidthSuffix); |
| 328 static void emitTwoAddr(const char *Opcode, const InstARM32Pred *Inst, | 331 static void emitTwoAddr(const char *Opcode, const InstARM32Pred *Inst, |
| 329 const Cfg *Func); | 332 const Cfg *Func); |
| 330 static void emitThreeAddr(const char *Opcode, const InstARM32Pred *Inst, | 333 static void emitThreeAddr(const char *Opcode, const InstARM32Pred *Inst, |
| 331 const Cfg *Func, bool SetFlags); | 334 const Cfg *Func, bool SetFlags); |
| 332 static void emitFourAddr(const char *Opcode, const InstARM32Pred *Inst, | 335 static void emitFourAddr(const char *Opcode, const InstARM32Pred *Inst, |
| 333 const Cfg *Func); | 336 const Cfg *Func); |
| 334 static void emitCmpLike(const char *Opcode, const InstARM32Pred *Inst, | 337 static void emitCmpLike(const char *Opcode, const InstARM32Pred *Inst, |
| 335 const Cfg *Func); | 338 const Cfg *Func); |
| 336 | 339 |
| 337 protected: | 340 protected: |
| 338 CondARM32::Cond Predicate; | 341 CondARM32::Cond Predicate; |
| 339 }; | 342 }; |
| 340 | 343 |
| 341 template <typename StreamType> | 344 template <typename StreamType> |
| 342 inline StreamType &operator<<(StreamType &Stream, CondARM32::Cond Predicate) { | 345 inline StreamType &operator<<(StreamType &Stream, CondARM32::Cond Predicate) { |
| 343 Stream << InstARM32Pred::predString(Predicate); | 346 Stream << InstARM32Pred::predString(Predicate); |
| 344 return Stream; | 347 return Stream; |
| 345 } | 348 } |
| 346 | 349 |
| 347 /// Instructions of the form x := op(y). | 350 /// Instructions of the form x := op(y). |
| 348 template <InstARM32::InstKindARM32 K> | 351 template <InstARM32::InstKindARM32 K, bool NeedsWidthSuffix> |
| 349 class InstARM32UnaryopGPR : public InstARM32Pred { | 352 class InstARM32UnaryopGPR : public InstARM32Pred { |
| 350 InstARM32UnaryopGPR() = delete; | 353 InstARM32UnaryopGPR() = delete; |
| 351 InstARM32UnaryopGPR(const InstARM32UnaryopGPR &) = delete; | 354 InstARM32UnaryopGPR(const InstARM32UnaryopGPR &) = delete; |
| 352 InstARM32UnaryopGPR &operator=(const InstARM32UnaryopGPR &) = delete; | 355 InstARM32UnaryopGPR &operator=(const InstARM32UnaryopGPR &) = delete; |
| 353 | 356 |
| 354 public: | 357 public: |
| 355 static InstARM32UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src, | 358 static InstARM32UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src, |
| 356 CondARM32::Cond Predicate) { | 359 CondARM32::Cond Predicate) { |
| 357 return new (Func->allocate<InstARM32UnaryopGPR>()) | 360 return new (Func->allocate<InstARM32UnaryopGPR>()) |
| 358 InstARM32UnaryopGPR(Func, Dest, Src, Predicate); | 361 InstARM32UnaryopGPR(Func, Dest, Src, Predicate); |
| 359 } | 362 } |
| 360 void emit(const Cfg *Func) const override { | 363 void emit(const Cfg *Func) const override { |
| 361 if (!BuildDefs::dump()) | 364 if (!BuildDefs::dump()) |
| 362 return; | 365 return; |
| 363 emitUnaryopGPR(Opcode, this, Func); | 366 emitUnaryopGPR(Opcode, this, Func, NeedsWidthSuffix); |
| 364 } | 367 } |
| 365 void emitIAS(const Cfg *Func) const override { | 368 void emitIAS(const Cfg *Func) const override { |
| 366 (void)Func; | 369 (void)Func; |
| 367 llvm_unreachable("Not yet implemented"); | 370 llvm_unreachable("Not yet implemented"); |
| 368 } | 371 } |
| 369 void dump(const Cfg *Func) const override { | 372 void dump(const Cfg *Func) const override { |
| 370 if (!BuildDefs::dump()) | 373 if (!BuildDefs::dump()) |
| 371 return; | 374 return; |
| 372 Ostream &Str = Func->getContext()->getStrDump(); | 375 Ostream &Str = Func->getContext()->getStrDump(); |
| 373 dumpDest(Func); | 376 dumpDest(Func); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 typedef InstARM32ThreeAddrGPR<InstARM32::Sdiv> InstARM32Sdiv; | 637 typedef InstARM32ThreeAddrGPR<InstARM32::Sdiv> InstARM32Sdiv; |
| 635 typedef InstARM32ThreeAddrGPR<InstARM32::Sub> InstARM32Sub; | 638 typedef InstARM32ThreeAddrGPR<InstARM32::Sub> InstARM32Sub; |
| 636 typedef InstARM32ThreeAddrGPR<InstARM32::Udiv> InstARM32Udiv; | 639 typedef InstARM32ThreeAddrGPR<InstARM32::Udiv> InstARM32Udiv; |
| 637 /// Move instruction (variable <- flex). This is more of a pseudo-inst. | 640 /// Move instruction (variable <- flex). This is more of a pseudo-inst. |
| 638 /// If var is a register, then we use "mov". If var is stack, then we use | 641 /// If var is a register, then we use "mov". If var is stack, then we use |
| 639 /// "str" to store to the stack. | 642 /// "str" to store to the stack. |
| 640 typedef InstARM32Movlike<InstARM32::Mov> InstARM32Mov; | 643 typedef InstARM32Movlike<InstARM32::Mov> InstARM32Mov; |
| 641 /// MovT leaves the bottom bits alone so dest is also a source. | 644 /// MovT leaves the bottom bits alone so dest is also a source. |
| 642 /// This helps indicate that a previous MovW setting dest is not dead code. | 645 /// This helps indicate that a previous MovW setting dest is not dead code. |
| 643 typedef InstARM32TwoAddrGPR<InstARM32::Movt> InstARM32Movt; | 646 typedef InstARM32TwoAddrGPR<InstARM32::Movt> InstARM32Movt; |
| 644 typedef InstARM32UnaryopGPR<InstARM32::Movw> InstARM32Movw; | 647 typedef InstARM32UnaryopGPR<InstARM32::Movw, false> InstARM32Movw; |
| 645 typedef InstARM32UnaryopGPR<InstARM32::Mvn> InstARM32Mvn; | 648 typedef InstARM32UnaryopGPR<InstARM32::Clz, false> InstARM32Clz; |
| 649 typedef InstARM32UnaryopGPR<InstARM32::Mvn, false> InstARM32Mvn; |
| 650 typedef InstARM32UnaryopGPR<InstARM32::Rbit, false> InstARM32Rbit; |
| 651 typedef InstARM32UnaryopGPR<InstARM32::Rev, false> InstARM32Rev; |
| 646 // Technically, the uxt{b,h} and sxt{b,h} instructions have a rotation | 652 // Technically, the uxt{b,h} and sxt{b,h} instructions have a rotation |
| 647 // operand as well (rotate source by 8, 16, 24 bits prior to extending), | 653 // operand as well (rotate source by 8, 16, 24 bits prior to extending), |
| 648 // but we aren't using that for now, so just model as a Unaryop. | 654 // but we aren't using that for now, so just model as a Unaryop. |
| 649 typedef InstARM32UnaryopGPR<InstARM32::Sxt> InstARM32Sxt; | 655 typedef InstARM32UnaryopGPR<InstARM32::Sxt, true> InstARM32Sxt; |
| 650 typedef InstARM32UnaryopGPR<InstARM32::Uxt> InstARM32Uxt; | 656 typedef InstARM32UnaryopGPR<InstARM32::Uxt, true> InstARM32Uxt; |
| 651 typedef InstARM32FourAddrGPR<InstARM32::Mla> InstARM32Mla; | 657 typedef InstARM32FourAddrGPR<InstARM32::Mla> InstARM32Mla; |
| 652 typedef InstARM32FourAddrGPR<InstARM32::Mls> InstARM32Mls; | 658 typedef InstARM32FourAddrGPR<InstARM32::Mls> InstARM32Mls; |
| 653 typedef InstARM32CmpLike<InstARM32::Cmp> InstARM32Cmp; | 659 typedef InstARM32CmpLike<InstARM32::Cmp> InstARM32Cmp; |
| 654 typedef InstARM32CmpLike<InstARM32::Tst> InstARM32Tst; | 660 typedef InstARM32CmpLike<InstARM32::Tst> InstARM32Tst; |
| 655 | 661 |
| 656 // InstARM32Label represents an intra-block label that is the target | 662 // InstARM32Label represents an intra-block label that is the target |
| 657 // of an intra-block branch. The offset between the label and the | 663 // of an intra-block branch. The offset between the label and the |
| 658 // branch must be fit in the instruction immediate (considered "near"). | 664 // branch must be fit in the instruction immediate (considered "near"). |
| 659 class InstARM32Label : public InstARM32 { | 665 class InstARM32Label : public InstARM32 { |
| 660 InstARM32Label() = delete; | 666 InstARM32Label() = delete; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 // Declare partial template specializations of emit() methods that | 972 // Declare partial template specializations of emit() methods that |
| 967 // already have default implementations. Without this, there is the | 973 // already have default implementations. Without this, there is the |
| 968 // possibility of ODR violations and link errors. | 974 // possibility of ODR violations and link errors. |
| 969 | 975 |
| 970 template <> void InstARM32Movw::emit(const Cfg *Func) const; | 976 template <> void InstARM32Movw::emit(const Cfg *Func) const; |
| 971 template <> void InstARM32Movt::emit(const Cfg *Func) const; | 977 template <> void InstARM32Movt::emit(const Cfg *Func) const; |
| 972 | 978 |
| 973 } // end of namespace Ice | 979 } // end of namespace Ice |
| 974 | 980 |
| 975 #endif // SUBZERO_SRC_ICEINSTARM32_H | 981 #endif // SUBZERO_SRC_ICEINSTARM32_H |
| OLD | NEW |