forked from OSchip/llvm-project
[NFC] Abstract out source argument index in MemTransferInst.
Summary: References to the source operand within class MemTransferInst are currently by a constant 1. Abstract this out into a named constant. llvm-svn: 322289
This commit is contained in:
parent
0acf13f659
commit
1d86b48a2d
|
@ -462,11 +462,14 @@ namespace llvm {
|
|||
|
||||
/// This class wraps the llvm.memcpy/memmove intrinsics.
|
||||
class MemTransferInst : public MemIntrinsic {
|
||||
private:
|
||||
enum { ARG_SOURCE = 1 };
|
||||
|
||||
public:
|
||||
/// 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); }
|
||||
Value *getRawSource() const { return const_cast<Value*>(getArgOperand(ARG_SOURCE)); }
|
||||
const Use &getRawSourceUse() const { return getArgOperandUse(ARG_SOURCE); }
|
||||
Use &getRawSourceUse() { return getArgOperandUse(ARG_SOURCE); }
|
||||
|
||||
/// This is just like getRawSource, but it strips off any cast
|
||||
/// instructions that feed it, giving the original input. The returned
|
||||
|
@ -480,7 +483,7 @@ namespace llvm {
|
|||
void setSource(Value *Ptr) {
|
||||
assert(getRawSource()->getType() == Ptr->getType() &&
|
||||
"setSource called with pointer of wrong type!");
|
||||
setArgOperand(1, Ptr);
|
||||
setArgOperand(ARG_SOURCE, Ptr);
|
||||
}
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
|
|
Loading…
Reference in New Issue