Changes in directory llvm/lib/VMCore:
Instructions.cpp updated: 1.40 -> 1.41 --- Log message: add a helper method --- Diffs of the changes: (+16 -0) Instructions.cpp | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.40 llvm/lib/VMCore/Instructions.cpp:1.41 --- llvm/lib/VMCore/Instructions.cpp:1.40 Sun Sep 17 14:29:56 2006 +++ llvm/lib/VMCore/Instructions.cpp Sun Sep 17 23:54:57 2006 @@ -1151,6 +1151,22 @@ return getOpcode() == Instruction::Shl || getType()->isUnsigned(); } +//===----------------------------------------------------------------------===// +// CastInst Class +//===----------------------------------------------------------------------===// + +/// isTruncIntCast - Return true if this is a truncating integer cast +/// instruction, e.g. a cast from long to uint. +bool CastInst::isTruncIntCast() const { + // The dest type has to be integral, the input has to be integer. + if (!getType()->isIntegral() || !getOperand(0)->getType()->isInteger()) + return false; + + // Has to be large to smaller. + return getOperand(0)->getType()->getPrimitiveSizeInBits() > + getType()->getPrimitiveSizeInBits(); +} + //===----------------------------------------------------------------------===// // SetCondInst Class _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits