mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
add a helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30452 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1151,6 +1151,22 @@ bool ShiftInst::isLogicalShift() const {
|
||||
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
|
||||
|
Reference in New Issue
Block a user