| OLD | NEW |
| 1 //===- subzero/src/IceInst.h - High-level instructions ----------*- C++ -*-===// | 1 //===- subzero/src/IceInst.h - High-level 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 /// Call instruction. The call target is captured as getSrc(0), and arg I is | 372 /// Call instruction. The call target is captured as getSrc(0), and arg I is |
| 373 /// captured as getSrc(I+1). | 373 /// captured as getSrc(I+1). |
| 374 class InstCall : public InstHighLevel { | 374 class InstCall : public InstHighLevel { |
| 375 InstCall() = delete; | 375 InstCall() = delete; |
| 376 InstCall(const InstCall &) = delete; | 376 InstCall(const InstCall &) = delete; |
| 377 InstCall &operator=(const InstCall &) = delete; | 377 InstCall &operator=(const InstCall &) = delete; |
| 378 | 378 |
| 379 public: | 379 public: |
| 380 static InstCall *create(Cfg *Func, SizeT NumArgs, Variable *Dest, | 380 static InstCall *create(Cfg *Func, SizeT NumArgs, Variable *Dest, |
| 381 Operand *CallTarget, bool HasTailCall) { | 381 Operand *CallTarget, bool HasTailCall, |
| 382 bool IsTargetHelperCall = false) { |
| 382 /// Set HasSideEffects to true so that the call instruction can't be | 383 /// Set HasSideEffects to true so that the call instruction can't be |
| 383 /// dead-code eliminated. IntrinsicCalls can override this if the particular | 384 /// dead-code eliminated. IntrinsicCalls can override this if the particular |
| 384 /// intrinsic is deletable and has no side-effects. | 385 /// intrinsic is deletable and has no side-effects. |
| 385 constexpr bool HasSideEffects = true; | 386 constexpr bool HasSideEffects = true; |
| 386 constexpr InstKind Kind = Inst::Call; | 387 constexpr InstKind Kind = Inst::Call; |
| 387 return new (Func->allocate<InstCall>()) InstCall( | 388 return new (Func->allocate<InstCall>()) |
| 388 Func, NumArgs, Dest, CallTarget, HasTailCall, HasSideEffects, Kind); | 389 InstCall(Func, NumArgs, Dest, CallTarget, HasTailCall, |
| 390 IsTargetHelperCall, HasSideEffects, Kind); |
| 389 } | 391 } |
| 390 void addArg(Operand *Arg) { addSource(Arg); } | 392 void addArg(Operand *Arg) { addSource(Arg); } |
| 391 Operand *getCallTarget() const { return getSrc(0); } | 393 Operand *getCallTarget() const { return getSrc(0); } |
| 392 Operand *getArg(SizeT I) const { return getSrc(I + 1); } | 394 Operand *getArg(SizeT I) const { return getSrc(I + 1); } |
| 393 SizeT getNumArgs() const { return getSrcSize() - 1; } | 395 SizeT getNumArgs() const { return getSrcSize() - 1; } |
| 394 bool isTailcall() const { return HasTailCall; } | 396 bool isTailcall() const { return HasTailCall; } |
| 397 bool isTargetHelperCall() const { return IsTargetHelperCall; } |
| 395 void dump(const Cfg *Func) const override; | 398 void dump(const Cfg *Func) const override; |
| 396 static bool classof(const Inst *Inst) { return Inst->getKind() == Call; } | 399 static bool classof(const Inst *Inst) { return Inst->getKind() == Call; } |
| 397 Type getReturnType() const; | 400 Type getReturnType() const; |
| 398 | 401 |
| 399 protected: | 402 protected: |
| 400 InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget, | 403 InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget, |
| 401 bool HasTailCall, bool HasSideEff, InstKind Kind) | 404 bool HasTailCall, bool IsTargetHelperCall, bool HasSideEff, |
| 402 : InstHighLevel(Func, Kind, NumArgs + 1, Dest), HasTailCall(HasTailCall) { | 405 InstKind Kind) |
| 406 : InstHighLevel(Func, Kind, NumArgs + 1, Dest), HasTailCall(HasTailCall), |
| 407 IsTargetHelperCall(IsTargetHelperCall) { |
| 403 HasSideEffects = HasSideEff; | 408 HasSideEffects = HasSideEff; |
| 404 addSource(CallTarget); | 409 addSource(CallTarget); |
| 405 } | 410 } |
| 406 | 411 |
| 407 private: | 412 private: |
| 408 bool HasTailCall; | 413 const bool HasTailCall; |
| 414 const bool IsTargetHelperCall; |
| 409 }; | 415 }; |
| 410 | 416 |
| 411 /// Cast instruction (a.k.a. conversion operation). | 417 /// Cast instruction (a.k.a. conversion operation). |
| 412 class InstCast : public InstHighLevel { | 418 class InstCast : public InstHighLevel { |
| 413 InstCast() = delete; | 419 InstCast() = delete; |
| 414 InstCast(const InstCast &) = delete; | 420 InstCast(const InstCast &) = delete; |
| 415 InstCast &operator=(const InstCast &) = delete; | 421 InstCast &operator=(const InstCast &) = delete; |
| 416 | 422 |
| 417 public: | 423 public: |
| 418 enum OpKind { | 424 enum OpKind { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 569 } |
| 564 static bool classof(const Inst *Inst) { | 570 static bool classof(const Inst *Inst) { |
| 565 return Inst->getKind() == IntrinsicCall; | 571 return Inst->getKind() == IntrinsicCall; |
| 566 } | 572 } |
| 567 | 573 |
| 568 Intrinsics::IntrinsicInfo getIntrinsicInfo() const { return Info; } | 574 Intrinsics::IntrinsicInfo getIntrinsicInfo() const { return Info; } |
| 569 | 575 |
| 570 private: | 576 private: |
| 571 InstIntrinsicCall(Cfg *Func, SizeT NumArgs, Variable *Dest, | 577 InstIntrinsicCall(Cfg *Func, SizeT NumArgs, Variable *Dest, |
| 572 Operand *CallTarget, const Intrinsics::IntrinsicInfo &Info) | 578 Operand *CallTarget, const Intrinsics::IntrinsicInfo &Info) |
| 573 : InstCall(Func, NumArgs, Dest, CallTarget, false, Info.HasSideEffects, | 579 : InstCall(Func, NumArgs, Dest, CallTarget, false, false, |
| 574 Inst::IntrinsicCall), | 580 Info.HasSideEffects, Inst::IntrinsicCall), |
| 575 Info(Info) {} | 581 Info(Info) {} |
| 576 | 582 |
| 577 const Intrinsics::IntrinsicInfo Info; | 583 const Intrinsics::IntrinsicInfo Info; |
| 578 }; | 584 }; |
| 579 | 585 |
| 580 /// Load instruction. The source address is captured in getSrc(0). | 586 /// Load instruction. The source address is captured in getSrc(0). |
| 581 class InstLoad : public InstHighLevel { | 587 class InstLoad : public InstHighLevel { |
| 582 InstLoad() = delete; | 588 InstLoad() = delete; |
| 583 InstLoad(const InstLoad &) = delete; | 589 InstLoad(const InstLoad &) = delete; |
| 584 InstLoad &operator=(const InstLoad &) = delete; | 590 InstLoad &operator=(const InstLoad &) = delete; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 static void noteHead(Ice::Inst *, Ice::Inst *) {} | 985 static void noteHead(Ice::Inst *, Ice::Inst *) {} |
| 980 void deleteNode(Ice::Inst *) {} | 986 void deleteNode(Ice::Inst *) {} |
| 981 | 987 |
| 982 private: | 988 private: |
| 983 mutable ilist_half_node<Ice::Inst> Sentinel; | 989 mutable ilist_half_node<Ice::Inst> Sentinel; |
| 984 }; | 990 }; |
| 985 | 991 |
| 986 } // end of namespace llvm | 992 } // end of namespace llvm |
| 987 | 993 |
| 988 #endif // SUBZERO_SRC_ICEINST_H | 994 #endif // SUBZERO_SRC_ICEINST_H |
| OLD | NEW |