[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp
Reid Spencer
reid at x10sys.com
Fri Jan 12 16:10:17 PST 2007
Changes in directory llvm/lib/Bytecode/Writer:
Writer.cpp updated: 1.148 -> 1.149
---
Log message:
Make sure that GEP indices are only 32 or 64 bits. We're not ready for
indices with other bit sizes yet.
---
Diffs of the changes: (+10 -6)
Writer.cpp | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.148 llvm/lib/Bytecode/Writer/Writer.cpp:1.149
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.148 Fri Jan 12 17:26:17 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Fri Jan 12 18:10:02 2007
@@ -486,9 +486,11 @@
// These should be either 32-bits or 64-bits, however, with bit
// accurate types we just distinguish between less than or equal to
// 32-bits or greater than 32-bits.
- const IntegerType *IdxTy =
- cast<IntegerType>(I->getOperand(Idx)->getType());
- unsigned IdxId = IdxTy->getBitWidth() <= 32 ? 0 : 1;
+ unsigned BitWidth =
+ cast<IntegerType>(I->getOperand(Idx)->getType())->getBitWidth();
+ assert(BitWidth == 32 || BitWidth == 64 &&
+ "Invalid bitwidth for GEP index");
+ unsigned IdxId = BitWidth == 32 ? 0 : 1;
Slot = (Slot << 1) | IdxId;
}
output_vbr(unsigned(Slot));
@@ -737,9 +739,11 @@
// These should be either 32-bits or 64-bits, however, with bit
// accurate types we just distinguish between less than or equal to
// 32-bits or greater than 32-bits.
- const IntegerType *IdxTy =
- cast<IntegerType>(GEP->getOperand(Idx)->getType());
- unsigned IdxId = IdxTy->getBitWidth() <= 32 ? 0 : 1;
+ unsigned BitWidth =
+ cast<IntegerType>(GEP->getOperand(Idx)->getType())->getBitWidth();
+ assert(BitWidth == 32 || BitWidth == 64 &&
+ "Invalid bitwidth for GEP index");
+ unsigned IdxId = BitWidth == 32 ? 0 : 1;
Slots[Idx] = (Slots[Idx] << 1) | IdxId;
if (Slots[Idx] > MaxOpSlot) MaxOpSlot = Slots[Idx];
}
More information about the llvm-commits
mailing list