summaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-24 07:54:10 +0000
committerChris Lattner <sabre@nondot.org>2012-01-24 07:54:10 +0000
commitdf39028607ca751f0a3f50a76144464b825ff97a (patch)
treee5304c41cb61ccc983137dd418613ae617f42fe5 /lib/VMCore/Constants.cpp
parentdada586f1677bbc58e07cd186a8b7f8c67ea3025 (diff)
downloadllvm-df39028607ca751f0a3f50a76144464b825ff97a.tar.gz
llvm-df39028607ca751f0a3f50a76144464b825ff97a.tar.bz2
llvm-df39028607ca751f0a3f50a76144464b825ff97a.tar.xz
teach valuetracking about ConstantDataSequential
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index df98d75864..55b97ef706 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -624,6 +624,15 @@ Constant *ConstantAggregateZero::getElementValue(Constant *C) {
return getStructElement(cast<ConstantInt>(C)->getZExtValue());
}
+/// getElementValue - Return a zero of the right value for the specified GEP
+/// index.
+Constant *ConstantAggregateZero::getElementValue(unsigned Idx) {
+ if (isa<SequentialType>(getType()))
+ return getSequentialElement();
+ return getStructElement(Idx);
+}
+
+
//===----------------------------------------------------------------------===//
// UndefValue Implementation
//===----------------------------------------------------------------------===//
@@ -648,6 +657,15 @@ UndefValue *UndefValue::getElementValue(Constant *C) {
return getStructElement(cast<ConstantInt>(C)->getZExtValue());
}
+/// getElementValue - Return an undef of the right value for the specified GEP
+/// index.
+UndefValue *UndefValue::getElementValue(unsigned Idx) {
+ if (isa<SequentialType>(getType()))
+ return getSequentialElement();
+ return getStructElement(Idx);
+}
+
+
//===----------------------------------------------------------------------===//
// ConstantXXX Classes