Changes in directory llvm/lib/Target/CBackend:
CBackend.cpp updated: 1.328 -> 1.329 --- Log message: Make sure that when we store a value it is masked to its correct bit width. This helps CBE work with non-standard integer bit widths. --- Diffs of the changes: (+15 -1) CBackend.cpp | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletion(-) Index: llvm/lib/Target/CBackend/CBackend.cpp diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.328 llvm/lib/Target/CBackend/CBackend.cpp:1.329 --- llvm/lib/Target/CBackend/CBackend.cpp:1.328 Fri Feb 23 16:45:08 2007 +++ llvm/lib/Target/CBackend/CBackend.cpp Sat Mar 3 10:33:33 2007 @@ -2815,7 +2815,21 @@ writeOperand(I.getPointerOperand()); if (I.isVolatile()) Out << ')'; Out << " = "; - writeOperand(I.getOperand(0)); + Value *Operand = I.getOperand(0); + Constant *BitMask = 0; + if (const IntegerType* ITy = dyn_cast<IntegerType>(Operand->getType())) + if (!ITy->isPowerOf2ByteWidth()) + // We have a bit width that doesn't match an even power-of-2 byte + // size. Consequently we must & the value with the type's bit mask + BitMask = ConstantInt::get(ITy, ITy->getBitMask()); + if (BitMask) + Out << "(("; + writeOperand(Operand); + if (BitMask) { + Out << ") & "; + printConstant(BitMask); + Out << ")"; + } } void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits