Index: src/IceInst.h |
diff --git a/src/IceInst.h b/src/IceInst.h |
index a465edae4773d95e138947ebc1e9f83586c6deec..28258098798310d3b623a1fb0f35912d71b61640 100644 |
--- a/src/IceInst.h |
+++ b/src/IceInst.h |
@@ -18,6 +18,7 @@ |
#include "IceDefs.h" |
#include "IceInst.def" |
+#include "IceIntrinsics.h" |
#include "IceTypes.h" |
// TODO: The Cfg structure, and instructions in particular, need to be |
@@ -42,6 +43,7 @@ public: |
Cast, |
Fcmp, |
Icmp, |
+ IntrinsicCall, |
Load, |
Phi, |
Ret, |
@@ -296,18 +298,21 @@ public: |
virtual void dump(const Cfg *Func) const; |
static bool classof(const Inst *Inst) { return Inst->getKind() == Call; } |
-private: |
- InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget) |
- : Inst(Func, Inst::Call, NumArgs + 1, Dest) { |
+protected: |
+ InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget, |
+ InstKind Kind=Inst::Call) |
JF
2014/06/10 03:50:41
I think it's better to avoid default arguments in
jvoung (off chromium)
2014/06/12 05:48:30
Done.
|
+ : Inst(Func, Kind, NumArgs + 1, Dest) { |
// Set HasSideEffects so that the call instruction can't be |
- // dead-code eliminated. Don't set this for a deletable intrinsic |
- // call. |
+ // dead-code eliminated. IntrinsicCalls can override this if the |
+ // particular intrinsic is deletable and has no side-effects. |
HasSideEffects = true; |
addSource(CallTarget); |
} |
+ virtual ~InstCall() {} |
+ |
+private: |
InstCall(const InstCall &) LLVM_DELETED_FUNCTION; |
InstCall &operator=(const InstCall &) LLVM_DELETED_FUNCTION; |
- virtual ~InstCall() {} |
}; |
// Cast instruction (a.k.a. conversion operation). |
@@ -395,6 +400,34 @@ private: |
const ICond Condition; |
}; |
+// Call to an intrinsic funciton. The call target is captured as getSrc(0), |
JF
2014/06/10 03:50:41
s/funciton/function/
jvoung (off chromium)
2014/06/12 05:48:30
Done.
|
+// and arg I is captured as getSrc(I+1). |
+class InstIntrinsicCall : public InstCall { |
+public: |
+ static InstIntrinsicCall *create(Cfg *Func, SizeT NumArgs, Variable *Dest, |
+ Operand *CallTarget, |
+ const IntrinsicInfo &Info) { |
+ return new (Func->allocateInst<InstIntrinsicCall>()) |
+ InstIntrinsicCall(Func, NumArgs, Dest, CallTarget, Info); |
+ } |
+ static bool classof(const Inst *Inst) { |
+ return Inst->getKind() == IntrinsicCall; |
+ } |
+ |
+ IntrinsicInfo getIntrinsicInfo() const { return Info; } |
+private: |
+ InstIntrinsicCall(Cfg *Func, SizeT NumArgs, Variable *Dest, |
+ Operand *CallTarget, const IntrinsicInfo &Info) |
+ : InstCall(Func, NumArgs, Dest, CallTarget, Inst::IntrinsicCall), |
+ Info(Info) { |
+ HasSideEffects = Info.HasSideEffects; |
Jim Stichnoth
2014/06/10 22:58:28
I think I'd be more comfortable if the InstCall ct
jvoung (off chromium)
2014/06/12 05:48:30
Done.
|
+ } |
+ InstIntrinsicCall(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION; |
+ InstIntrinsicCall &operator=(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION; |
+ virtual ~InstIntrinsicCall() {} |
+ const IntrinsicInfo Info; |
+}; |
+ |
// Load instruction. The source address is captured in getSrc(0). |
class InstLoad : public Inst { |
public: |