aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/SlotCalculator.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-18 04:01:05 +0000
committerChris Lattner <sabre@nondot.org>2001-09-18 04:01:05 +0000
commitd70684f7585a85c4248c1c224059478108741c70 (patch)
tree17d40698895d1c3efb8655ec7059be714bb940e7 /lib/VMCore/SlotCalculator.cpp
parent1781acab34447ad679c5c952ec12c942fb63f887 (diff)
downloadexternal_llvm-d70684f7585a85c4248c1c224059478108741c70.zip
external_llvm-d70684f7585a85c4248c1c224059478108741c70.tar.gz
external_llvm-d70684f7585a85c4248c1c224059478108741c70.tar.bz2
Add support for global constants, and for initializers for constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/SlotCalculator.cpp')
-rw-r--r--lib/VMCore/SlotCalculator.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp
index cc7d4e5..0ac371c 100644
--- a/lib/VMCore/SlotCalculator.cpp
+++ b/lib/VMCore/SlotCalculator.cpp
@@ -223,11 +223,13 @@ int SlotCalculator::getValSlot(const Value *D) const {
int SlotCalculator::insertValue(const Value *D) {
- if (const ConstPoolVal *CPV = D->castConstant()) {
+ if (D->isConstant() || D->isGlobal()) {
+ const User *U = (const User *)D;
// This makes sure that if a constant has uses (for example an array
- // of const ints), that they are inserted also.
+ // of const ints), that they are inserted also. Same for global variable
+ // initializers.
//
- for_each(CPV->op_begin(), CPV->op_end(),
+ for_each(U->op_begin(), U->op_end(),
bind_obj(this, &SlotCalculator::insertValue));
}