diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-24 07:54:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-24 07:54:10 +0000 |
commit | df39028607ca751f0a3f50a76144464b825ff97a (patch) | |
tree | e5304c41cb61ccc983137dd418613ae617f42fe5 /lib/VMCore | |
parent | dada586f1677bbc58e07cd186a8b7f8c67ea3025 (diff) | |
download | external_llvm-df39028607ca751f0a3f50a76144464b825ff97a.zip external_llvm-df39028607ca751f0a3f50a76144464b825ff97a.tar.gz external_llvm-df39028607ca751f0a3f50a76144464b825ff97a.tar.bz2 |
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')
-rw-r--r-- | lib/VMCore/Constants.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index df98d75..55b97ef 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 |