#define LLVM_INTRINSICINST_H
#include "llvm/Constants.h"
+#include "llvm/Metadata.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
case Intrinsic::dbg_region_start:
case Intrinsic::dbg_region_end:
case Intrinsic::dbg_declare:
+ case Intrinsic::dbg_value:
return true;
default: return false;
}
struct DbgStopPointInst : public DbgInfoIntrinsic {
Value *getLineValue() const { return const_cast<Value*>(getOperand(1)); }
Value *getColumnValue() const { return const_cast<Value*>(getOperand(2)); }
- Value *getContext() const {
- return StripCast(getOperand(3));
+ MDNode *getContext() const {
+ return cast<MDNode>(getOperand(3));
}
unsigned getLine() const {
/// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction.
///
struct DbgFuncStartInst : public DbgInfoIntrinsic {
- Value *getSubprogram() const { return StripCast(getOperand(1)); }
+ MDNode *getSubprogram() const { return cast<MDNode>(getOperand(1)); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgFuncStartInst *) { return true; }
/// DbgRegionStartInst - This represents the llvm.dbg.region.start
/// instruction.
struct DbgRegionStartInst : public DbgInfoIntrinsic {
- Value *getContext() const { return StripCast(getOperand(1)); }
+ MDNode *getContext() const { return cast<MDNode>(getOperand(1)); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgRegionStartInst *) { return true; }
/// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction.
///
struct DbgRegionEndInst : public DbgInfoIntrinsic {
- Value *getContext() const { return StripCast(getOperand(1)); }
+ MDNode *getContext() const { return cast<MDNode>(getOperand(1)); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgRegionEndInst *) { return true; }
///
struct DbgDeclareInst : public DbgInfoIntrinsic {
Value *getAddress() const { return getOperand(1); }
- Value *getVariable() const { return StripCast(getOperand(2)); }
+ MDNode *getVariable() const { return cast<MDNode>(getOperand(2)); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgDeclareInst *) { return true; }
}
};
+ /// DbgValueInst - This represents the llvm.dbg.value instruction.
+ ///
+ struct DbgValueInst : public DbgInfoIntrinsic {
+ Value *getValue() const {
+ return cast<MDNode>(getOperand(1))->getElement(0);
+ }
+ Value *getOffset() const { return getOperand(2); }
+ MDNode *getVariable() const { return cast<MDNode>(getOperand(3)); }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const DbgValueInst *) { return true; }
+ static inline bool classof(const IntrinsicInst *I) {
+ return I->getIntrinsicID() == Intrinsic::dbg_value;
+ }
+ static inline bool classof(const Value *V) {
+ return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+ }
+ };
+
/// MemIntrinsic - This is the common base class for memset/memcpy/memmove.
///
struct MemIntrinsic : public IntrinsicInst {
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const EHSelectorInst *) { return true; }
static inline bool classof(const IntrinsicInst *I) {
- return I->getIntrinsicID() == Intrinsic::eh_selector_i32 ||
- I->getIntrinsicID() == Intrinsic::eh_selector_i64;
+ return I->getIntrinsicID() == Intrinsic::eh_selector;
}
static inline bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
};
+ /// MemoryUseIntrinsic - This is the common base class for the memory use
+ /// marker intrinsics.
+ ///
+ struct MemoryUseIntrinsic : public IntrinsicInst {
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const MemoryUseIntrinsic *) { return true; }
+ static inline bool classof(const IntrinsicInst *I) {
+ switch (I->getIntrinsicID()) {
+ case Intrinsic::lifetime_start:
+ case Intrinsic::lifetime_end:
+ case Intrinsic::invariant_start:
+ case Intrinsic::invariant_end:
+ return true;
+ default: return false;
+ }
+ }
+ static inline bool classof(const Value *V) {
+ return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+ }
+ };
+
}
#endif