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 | 32351fa820d3e9ecd4822efa064d49072fe1d2c8 (patch) | |
tree | 331436ef4b2321bc5825874b87dd5ef0dd14fd09 /llvm/include/llvm/Support/ConstantFolder.h | |
parent | 14c7ed4b0b0560acbbe37b010ad0b700193e6d44 (diff) | |
download | bcm5719-llvm-32351fa820d3e9ecd4822efa064d49072fe1d2c8.tar.gz bcm5719-llvm-32351fa820d3e9ecd4822efa064d49072fe1d2c8.zip |
Convert ConstantFolder APIs to use ArrayRef.
llvm-svn: 135671
Diffstat (limited to 'llvm/include/llvm/Support/ConstantFolder.h')
-rw-r--r-- | llvm/include/llvm/Support/ConstantFolder.h | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/llvm/include/llvm/Support/ConstantFolder.h b/llvm/include/llvm/Support/ConstantFolder.h index 699c6281b34..771784b4f9c 100644 --- a/llvm/include/llvm/Support/ConstantFolder.h +++ b/llvm/include/llvm/Support/ConstantFolder.h @@ -118,22 +118,36 @@ public: // Memory Instructions //===--------------------------------------------------------------------===// - Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, - unsigned NumIdx) const { - return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); - } - Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList, - unsigned NumIdx) const { - return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); - } - - Constant *CreateInBoundsGetElementPtr(Constant *C, Constant* const *IdxList, - unsigned NumIdx) const { - return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx); - } - Constant *CreateInBoundsGetElementPtr(Constant *C, Value* const *IdxList, - unsigned NumIdx) const { - return ConstantExpr::getInBoundsGetElementPtr(C, IdxList, NumIdx); + Constant *CreateGetElementPtr(Constant *C, + ArrayRef<Constant *> IdxList) const { + return 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 ConstantExpr::getGetElementPtr(C, &Idx, 1); + } + Constant *CreateGetElementPtr(Constant *C, + ArrayRef<Value *> IdxList) const { + return ConstantExpr::getGetElementPtr(C, IdxList.data(), IdxList.size()); + } + + Constant *CreateInBoundsGetElementPtr(Constant *C, + ArrayRef<Constant *> IdxList) const { + return ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(), + IdxList.size()); + } + Constant *CreateInBoundsGetElementPtr(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 ConstantExpr::getInBoundsGetElementPtr(C, &Idx, 1); + } + Constant *CreateInBoundsGetElementPtr(Constant *C, + ArrayRef<Value *> IdxList) const { + return ConstantExpr::getInBoundsGetElementPtr(C, IdxList.data(), + IdxList.size()); } //===--------------------------------------------------------------------===// |