[llvm] r322289 - [NFC] Abstract out source argument index in MemTransferInst.
Daniel Neilson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 08:28:32 PST 2018
Author: dneilson
Date: Thu Jan 11 08:28:32 2018
New Revision: 322289
URL: http://llvm.org/viewvc/llvm-project?rev=322289&view=rev
Log:
[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.
Modified:
llvm/trunk/include/llvm/IR/IntrinsicInst.h
Modified: llvm/trunk/include/llvm/IR/IntrinsicInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=322289&r1=322288&r2=322289&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicInst.h (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicInst.h Thu Jan 11 08:28:32 2018
@@ -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:
More information about the llvm-commits
mailing list