aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/IR/IntrinsicInst.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/IntrinsicInst.h')
-rw-r--r--include/llvm/IR/IntrinsicInst.h68
1 files changed, 28 insertions, 40 deletions
diff --git a/include/llvm/IR/IntrinsicInst.h b/include/llvm/IR/IntrinsicInst.h
index 169bcc021984..52044e0a0cc8 100644
--- a/include/llvm/IR/IntrinsicInst.h
+++ b/include/llvm/IR/IntrinsicInst.h
@@ -31,16 +31,15 @@
#include "llvm/IR/Metadata.h"
namespace llvm {
- /// IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic
- /// functions. This allows the standard isa/dyncast/cast functionality to
- /// work with calls to intrinsic functions.
+ /// A wrapper class for inspecting calls to intrinsic functions.
+ /// This allows the standard isa/dyncast/cast functionality to work with calls
+ /// to intrinsic functions.
class IntrinsicInst : public CallInst {
IntrinsicInst() = delete;
IntrinsicInst(const IntrinsicInst&) = delete;
void operator=(const IntrinsicInst&) = delete;
public:
- /// getIntrinsicID - Return the intrinsic ID of this intrinsic.
- ///
+ /// Return the intrinsic ID of this intrinsic.
Intrinsic::ID getIntrinsicID() const {
return getCalledFunction()->getIntrinsicID();
}
@@ -56,10 +55,13 @@ namespace llvm {
}
};
- /// DbgInfoIntrinsic - This is the common base class for debug info intrinsics
- ///
+ /// This is the common base class for debug info intrinsics.
class DbgInfoIntrinsic : public IntrinsicInst {
public:
+ /// Get the location corresponding to the variable referenced by the debug
+ /// info intrinsic. Depending on the intrinsic, this could be the
+ /// variable's value or its address.
+ Value *getVariableLocation(bool AllowNullOp = true) const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IntrinsicInst *I) {
@@ -73,15 +75,12 @@ namespace llvm {
static inline bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
-
- static Value *StripCast(Value *C);
};
- /// DbgDeclareInst - This represents the llvm.dbg.declare instruction.
- ///
+ /// This represents the llvm.dbg.declare instruction.
class DbgDeclareInst : public DbgInfoIntrinsic {
public:
- Value *getAddress() const;
+ Value *getAddress() const { return getVariableLocation(); }
DILocalVariable *getVariable() const {
return cast<DILocalVariable>(getRawVariable());
}
@@ -105,12 +104,12 @@ namespace llvm {
}
};
- /// DbgValueInst - This represents the llvm.dbg.value instruction.
- ///
+ /// This represents the llvm.dbg.value instruction.
class DbgValueInst : public DbgInfoIntrinsic {
public:
- const Value *getValue() const;
- Value *getValue();
+ Value *getValue() const {
+ return getVariableLocation(/* AllowNullOp = */ false);
+ }
uint64_t getOffset() const {
return cast<ConstantInt>(
const_cast<Value*>(getArgOperand(1)))->getZExtValue();
@@ -138,8 +137,7 @@ namespace llvm {
}
};
- /// MemIntrinsic - This is the common base class for memset/memcpy/memmove.
- ///
+ /// This is the common base class for memset/memcpy/memmove.
class MemIntrinsic : public IntrinsicInst {
public:
Value *getRawDest() const { return const_cast<Value*>(getArgOperand(0)); }
@@ -169,13 +167,12 @@ namespace llvm {
return cast<PointerType>(getRawDest()->getType())->getAddressSpace();
}
- /// getDest - This is just like getRawDest, but it strips off any cast
+ /// This is just like getRawDest, but it strips off any cast
/// instructions that feed it, giving the original input. The returned
/// value is guaranteed to be a pointer.
Value *getDest() const { return getRawDest()->stripPointerCasts(); }
- /// set* - Set the specified arguments of the instruction.
- ///
+ /// Set the specified arguments of the instruction.
void setDest(Value *Ptr) {
assert(getRawDest()->getType() == Ptr->getType() &&
"setDest called with pointer of wrong type!");
@@ -215,12 +212,10 @@ namespace llvm {
}
};
- /// MemSetInst - This class wraps the llvm.memset intrinsic.
- ///
+ /// This class wraps the llvm.memset intrinsic.
class MemSetInst : public MemIntrinsic {
public:
- /// get* - Return the arguments to the instruction.
- ///
+ /// Return the arguments to the instruction.
Value *getValue() const { return const_cast<Value*>(getArgOperand(1)); }
const Use &getValueUse() const { return getArgOperandUse(1); }
Use &getValueUse() { return getArgOperandUse(1); }
@@ -240,17 +235,15 @@ namespace llvm {
}
};
- /// MemTransferInst - This class wraps the llvm.memcpy/memmove intrinsics.
- ///
+ /// This class wraps the llvm.memcpy/memmove intrinsics.
class MemTransferInst : public MemIntrinsic {
public:
- /// get* - Return the arguments to the instruction.
- ///
+ /// Return the arguments to the instruction.
Value *getRawSource() const { return const_cast<Value*>(getArgOperand(1)); }
const Use &getRawSourceUse() const { return getArgOperandUse(1); }
Use &getRawSourceUse() { return getArgOperandUse(1); }
- /// getSource - This is just like getRawSource, but it strips off any cast
+ /// This is just like getRawSource, but it strips off any cast
/// instructions that feed it, giving the original input. The returned
/// value is guaranteed to be a pointer.
Value *getSource() const { return getRawSource()->stripPointerCasts(); }
@@ -276,8 +269,7 @@ namespace llvm {
};
- /// MemCpyInst - This class wraps the llvm.memcpy intrinsic.
- ///
+ /// This class wraps the llvm.memcpy intrinsic.
class MemCpyInst : public MemTransferInst {
public:
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -289,8 +281,7 @@ namespace llvm {
}
};
- /// MemMoveInst - This class wraps the llvm.memmove intrinsic.
- ///
+ /// This class wraps the llvm.memmove intrinsic.
class MemMoveInst : public MemTransferInst {
public:
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -302,8 +293,7 @@ namespace llvm {
}
};
- /// VAStartInst - This represents the llvm.va_start intrinsic.
- ///
+ /// This represents the llvm.va_start intrinsic.
class VAStartInst : public IntrinsicInst {
public:
static inline bool classof(const IntrinsicInst *I) {
@@ -316,8 +306,7 @@ namespace llvm {
Value *getArgList() const { return const_cast<Value*>(getArgOperand(0)); }
};
- /// VAEndInst - This represents the llvm.va_end intrinsic.
- ///
+ /// This represents the llvm.va_end intrinsic.
class VAEndInst : public IntrinsicInst {
public:
static inline bool classof(const IntrinsicInst *I) {
@@ -330,8 +319,7 @@ namespace llvm {
Value *getArgList() const { return const_cast<Value*>(getArgOperand(0)); }
};
- /// VACopyInst - This represents the llvm.va_copy intrinsic.
- ///
+ /// This represents the llvm.va_copy intrinsic.
class VACopyInst : public IntrinsicInst {
public:
static inline bool classof(const IntrinsicInst *I) {