diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-09 06:14:31 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-09 06:14:31 +0000 |
commit | 91ac04aa86129b1017f04bd0a361b293f0562614 (patch) | |
tree | 49c0b22892665a2321a18456b0e7ca572ebde6e1 /lib/Bytecode/Writer/SlotCalculator.cpp | |
parent | 8129a3921e970a546c8108290dcfa10e050e71f0 (diff) |
For PR1146:
Use ParamAttrsList for writing parameter attributes. Since they are sparse
now, we also write them sparsely (saves a few bytes). Unfortunately, this
is a bytecode file format change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/SlotCalculator.cpp')
-rw-r--r-- | lib/Bytecode/Writer/SlotCalculator.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index 43ad922e2b..85ccad58c5 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -332,6 +332,10 @@ void SlotCalculator::purgeFunction() { SC_DEBUG("end purgeFunction!\n"); } +inline static bool hasImplicitNull(const Type* Ty) { + return Ty != Type::LabelTy && Ty != Type::VoidTy && !isa<OpaqueType>(Ty); +} + void SlotCalculator::CreateFunctionValueSlot(const Value *V) { assert(!NodeMap.count(V) && "Function-local value can't be inserted!"); @@ -353,7 +357,7 @@ void SlotCalculator::CreateFunctionValueSlot(const Value *V) { // to insert the implicit null value. if (Table[TyPlane].empty()) { // Label's and opaque types can't have a null value. - if (Ty != Type::LabelTy && !isa<OpaqueType>(Ty)) { + if (hasImplicitNull(Ty)) { Value *ZeroInitializer = Constant::getNullValue(Ty); // If we are pushing zeroinit, it will be handled below. @@ -370,5 +374,4 @@ void SlotCalculator::CreateFunctionValueSlot(const Value *V) { SC_DEBUG(" Inserting value [" << TyPlane << "] = " << *V << " slot=" << NodeMap[V] << "\n"); -} - +} |