From 1d86b48a2da0acbe101adaf89a4cf356237edc26 Mon Sep 17 00:00:00 2001 From: Daniel Neilson Date: Thu, 11 Jan 2018 16:28:32 +0000 Subject: [PATCH] [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 --- llvm/include/llvm/IR/IntrinsicInst.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index 2ca0a24cbae1..c22200ba6b08 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -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(getArgOperand(1)); } - const Use &getRawSourceUse() const { return getArgOperandUse(1); } - Use &getRawSourceUse() { return getArgOperandUse(1); } + Value *getRawSource() const { return const_cast(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: