diff options
author | Eduard Burtescu <edy.burt@gmail.com> | 2016-01-19 17:28:00 +0000 |
---|---|---|
committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-01-19 17:28:00 +0000 |
commit | 19eb03106d6042a404f4943f3e9efc74da6865f6 (patch) | |
tree | 77adf285682b322cf27b5955635970a6a0a332dc /llvm/lib/IR/Constants.cpp | |
parent | d9cac592f444c84b63797019975aefbac20e1985 (diff) | |
download | llvm-19eb03106d6042a404f4943f3e9efc74da6865f6.zip llvm-19eb03106d6042a404f4943f3e9efc74da6865f6.tar.gz llvm-19eb03106d6042a404f4943f3e9efc74da6865f6.tar.bz2 |
[opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType.
Summary:
GEPOperator: provide getResultElementType alongside getSourceElementType.
This is made possible by adding a result element type field to GetElementPtrConstantExpr, which GetElementPtrInst already has.
GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType.
Reviewers: mjacob, dblaikie
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D16275
llvm-svn: 258145
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 0898bf6..98151f5 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -2335,7 +2335,8 @@ GetElementPtrConstantExpr::GetElementPtrConstantExpr( OperandTraits<GetElementPtrConstantExpr>::op_end(this) - (IdxList.size() + 1), IdxList.size() + 1), - SrcElementTy(SrcElementTy) { + SrcElementTy(SrcElementTy), + ResElementTy(GetElementPtrInst::getIndexedType(SrcElementTy, IdxList)) { Op<0>() = C; Use *OperandList = getOperandList(); for (unsigned i = 0, E = IdxList.size(); i != E; ++i) @@ -2346,6 +2347,10 @@ Type *GetElementPtrConstantExpr::getSourceElementType() const { return SrcElementTy; } +Type *GetElementPtrConstantExpr::getResultElementType() const { + return ResElementTy; +} + //===----------------------------------------------------------------------===// // ConstantData* implementations |