diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-07-21 07:52:17 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-07-21 07:52:17 +0000 |
commit | 12fc16f1950796486988dc91ba69797efa5bdb64 (patch) | |
tree | 56bcac728655a7730190747977d3e77c57e1eff1 /include/llvm/Support/TargetFolder.h | |
parent | c30a38f34bdfecb99ce49e3ffa479039c9bf0209 (diff) | |
download | llvm-12fc16f1950796486988dc91ba69797efa5bdb64.tar.gz llvm-12fc16f1950796486988dc91ba69797efa5bdb64.tar.bz2 llvm-12fc16f1950796486988dc91ba69797efa5bdb64.tar.xz |
Convert ConstantFolder APIs to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135671 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/TargetFolder.h')
-rw-r--r-- | include/llvm/Support/TargetFolder.h | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h index c13e741739..2be8b74eb6 100644 --- a/include/llvm/Support/TargetFolder.h +++ b/include/llvm/Support/TargetFolder.h @@ -130,22 +130,32 @@ public: // Memory Instructions //===--------------------------------------------------------------------===// - Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, - unsigned NumIdx) const { - return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx)); - } - Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList, - unsigned NumIdx) const { - return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx)); - } - - Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList, - unsigned NumIdx) const { - return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); - } - Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, - unsigned NumIdx) const { - return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx)); + Constant *CreateGetElementPtr(Constant *C, + ArrayRef<Constant *> IdxList) const { + return Fold(ConstantExpr::getGetElementPtr(C, IdxList.data(), + IdxList.size())); + } + Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const { + // This form of the function only exists to avoid ambiguous overload + // warnings about whether to convert Idx to ArrayRef<Constant *> or + // ArrayRef<Value *>. + return Fold(ConstantExpr::getGetElementPtr(C, &Idx, 1)); + } + Constant *CreateGetElementPtr(Constant *C, + ArrayRef<Value *> IdxList) const { + return Fold(ConstantExpr::getGetElementPtr(C, IdxList.data(), + IdxList.size())); + } + + Constant *CreateInBoundsGetElementPtr(Constant *C, + ArrayRef<Constant *> IdxList) const { + return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(), + IdxList.size())); + } + Constant *CreateInBoundsGetElementPtr(Constant *C, + ArrayRef<Value *> IdxList) const { + return Fold(ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(), + IdxList.size())); } //===--------------------------------------------------------------------===// |