rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.

rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-01-15 02:27:26 +00:00
parent b25c4ca9d8
commit 42a7551725
33 changed files with 241 additions and 247 deletions

View File

@ -60,7 +60,7 @@ namespace llvm {
/// loop (inserting one if there is none). A canonical induction variable
/// starts at zero and steps by one on each iteration.
Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty){
assert((Ty->isIntegral() || Ty->isFloatingPoint()) &&
assert((Ty->isInteger() || Ty->isFloatingPoint()) &&
"Can only insert integer or floating point induction variables!");
SCEVHandle H = SCEVAddRecExpr::get(SCEVUnknown::getIntegerSCEV(0, Ty),
SCEVUnknown::getIntegerSCEV(1, Ty), L);
@ -106,9 +106,9 @@ namespace llvm {
Value *expandInTy(SCEV *S, const Type *Ty) {
Value *V = expand(S);
if (Ty && V->getType() != Ty) {
if (isa<PointerType>(Ty) && V->getType()->isIntegral())
if (isa<PointerType>(Ty) && V->getType()->isInteger())
return InsertCastOfTo(Instruction::IntToPtr, V, Ty);
else if (Ty->isIntegral() && isa<PointerType>(V->getType()))
else if (Ty->isInteger() && isa<PointerType>(V->getType()))
return InsertCastOfTo(Instruction::PtrToInt, V, Ty);
else if (Ty->getPrimitiveSizeInBits() ==
V->getType()->getPrimitiveSizeInBits())

View File

@ -534,7 +534,7 @@ namespace llvm {
}
MachOSection *getConstSection(const Type *Ty) {
// FIXME: support cstring literals and pointer literal
if (Ty->isPrimitiveType() || Ty->isIntegral()) {
if (Ty->isPrimitiveType() || Ty->isInteger()) {
unsigned Size = TM.getTargetData()->getTypeSize(Ty);
switch(Size) {
default: break; // Fall through to __TEXT,__const

View File

@ -160,14 +160,9 @@ public:
/// getDescription - Return the string representation of the type...
const std::string &getDescription() const;
/// isInteger - Equivalent to isSigned() || isUnsigned()
/// isInteger - True if this is an instance of IntegerType.
///
bool isInteger() const { return ID == IntegerTyID && this != Int1Ty; }
/// isIntegral - Returns true if this is an integral type, which is either
/// Int1Ty or one of the Integer types.
///
bool isIntegral() const { return ID == IntegerTyID; }
bool isInteger() const { return ID == IntegerTyID; }
/// isFloatingPoint - Return true if this is one of the two floating point
/// types
@ -209,8 +204,7 @@ public:
///
bool isSized() const {
// If it's a primitive, it is always sized.
if (ID == IntegerTyID || (ID >= FloatTyID && ID <= DoubleTyID) ||
ID == PointerTyID)
if (ID == IntegerTyID || isFloatingPoint() || ID == PointerTyID)
return true;
// If it is not something that can have a size (e.g. a function or label),
// it doesn't have a size.
@ -228,11 +222,11 @@ public:
///
unsigned getPrimitiveSizeInBits() const;
/// getIntegralTypeMask - Return a bitmask with ones set for all of the bits
/// getIntegerTypeMask - Return a bitmask with ones set for all of the bits
/// that can be set by an unsigned version of this type. This is 0xFF for
/// sbyte/ubyte, 0xFFFF for shorts, etc.
uint64_t getIntegralTypeMask() const {
assert(isIntegral() && "This only works for integral types!");
uint64_t getIntegerTypeMask() const {
assert(isInteger() && "This only works for integer types!");
return ~uint64_t(0UL) >> (64-getPrimitiveSizeInBits());
}

View File

@ -31,7 +31,7 @@
using namespace llvm;
static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
if (Ty->isIntegral()) {
if (Ty->isInteger()) {
if (isSigned) {
// Calculate 011111111111111...
unsigned TypeBits = Ty->getPrimitiveSizeInBits();
@ -46,7 +46,7 @@ static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
// Static constructor to create the minimum constant for an integral type...
static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) {
if (Ty->isIntegral()) {
if (Ty->isInteger()) {
if (isSigned) {
// Calculate 1111111111000000000000
unsigned TypeBits = Ty->getPrimitiveSizeInBits();
@ -93,7 +93,7 @@ static ConstantInt *Max(ConstantInt *A, ConstantInt *B,
/// Initialize a full (the default) or empty set for the specified type.
///
ConstantRange::ConstantRange(const Type *Ty, bool Full) {
assert(Ty->isIntegral() &&
assert(Ty->isInteger() &&
"Cannot make constant range of non-integral type!");
if (Full)
Lower = Upper = getMaxValue(Ty);
@ -225,7 +225,7 @@ bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const {
/// subtract - Subtract the specified constant from the endpoints of this
/// constant range.
ConstantRange ConstantRange::subtract(ConstantInt *CI) const {
assert(CI->getType() == getType() && getType()->isIntegral() &&
assert(CI->getType() == getType() && getType()->isInteger() &&
"Cannot subtract from different type range or non-integer!");
// If the set is empty or full, don't modify the endpoints.
if (Lower == Upper) return *this;

View File

@ -122,7 +122,7 @@ void SCEV::dump() const {
/// known to have. This method is only valid on integer SCEV objects.
ConstantRange SCEV::getValueRange() const {
const Type *Ty = getType();
assert(Ty->isIntegral() && "Can't get range for a non-integer SCEV!");
assert(Ty->isInteger() && "Can't get range for a non-integer SCEV!");
// Default to a full range if no better information is available.
return ConstantRange(getType());
}
@ -194,7 +194,7 @@ static ManagedStatic<std::map<std::pair<SCEV*, const Type*>,
SCEVTruncateExpr::SCEVTruncateExpr(const SCEVHandle &op, const Type *ty)
: SCEV(scTruncate), Op(op), Ty(ty) {
assert(Op->getType()->isIntegral() && Ty->isIntegral() &&
assert(Op->getType()->isInteger() && Ty->isInteger() &&
"Cannot truncate non-integer value!");
assert(Op->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits()
&& "This is not a truncating conversion!");
@ -220,7 +220,7 @@ static ManagedStatic<std::map<std::pair<SCEV*, const Type*>,
SCEVZeroExtendExpr::SCEVZeroExtendExpr(const SCEVHandle &op, const Type *ty)
: SCEV(scZeroExtend), Op(op), Ty(ty) {
assert(Op->getType()->isIntegral() && Ty->isIntegral() &&
assert(Op->getType()->isInteger() && Ty->isInteger() &&
"Cannot zero extend non-integer value!");
assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()
&& "This is not an extending conversion!");
@ -459,7 +459,7 @@ SCEVHandle SCEVUnknown::getIntegerSCEV(int Val, const Type *Ty) {
/// extended.
static SCEVHandle getTruncateOrZeroExtend(const SCEVHandle &V, const Type *Ty) {
const Type *SrcTy = V->getType();
assert(SrcTy->isIntegral() && Ty->isIntegral() &&
assert(SrcTy->isInteger() && Ty->isInteger() &&
"Cannot truncate or zero extend with non-integer arguments!");
if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
return V; // No conversion
@ -1333,7 +1333,7 @@ static uint64_t GetConstantFactor(SCEVHandle S) {
if (SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(S))
return GetConstantFactor(T->getOperand()) &
T->getType()->getIntegralTypeMask();
T->getType()->getIntegerTypeMask();
if (SCEVZeroExtendExpr *E = dyn_cast<SCEVZeroExtendExpr>(S))
return GetConstantFactor(E->getOperand());
@ -1421,8 +1421,8 @@ SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) {
case Instruction::BitCast:
// BitCasts are no-op casts so we just eliminate the cast.
if (I->getType()->isIntegral() &&
I->getOperand(0)->getType()->isIntegral())
if (I->getType()->isInteger() &&
I->getOperand(0)->getType()->isInteger())
return getSCEV(I->getOperand(0));
break;
@ -2186,7 +2186,7 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) {
}
}
}
} else if (AddRec->isQuadratic() && AddRec->getType()->isIntegral()) {
} else if (AddRec->isQuadratic() && AddRec->getType()->isInteger()) {
// If this is a quadratic (3-term) AddRec {L,+,M,+,N}, find the roots of
// the quadratic equation to solve it.
std::pair<SCEVHandle,SCEVHandle> Roots = SolveQuadraticEquation(AddRec);
@ -2314,7 +2314,7 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L) {
}
if (Cond == ICmpInst::ICMP_SLT) {
if (PreCondLHS->getType()->isIntegral()) {
if (PreCondLHS->getType()->isInteger()) {
if (RHS != getSCEV(PreCondRHS))
return UnknownValue; // Not a comparison against 'm'.
@ -2567,14 +2567,14 @@ void ScalarEvolution::print(std::ostream &OS, const Module* ) const {
OS << "Classifying expressions for: " << F.getName() << "\n";
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
if (I->getType()->isIntegral()) {
if (I->getType()->isInteger()) {
OS << *I;
OS << " --> ";
SCEVHandle SV = getSCEV(&*I);
SV->print(OS);
OS << "\t\t";
if ((*I).getType()->isIntegral()) {
if ((*I).getType()->isInteger()) {
ConstantRange Bounds = SV->getValueRange();
if (!Bounds.isFullSet())
OS << "Bounds: " << Bounds << " ";

View File

@ -92,7 +92,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
const Type *Ty = S->getType();
const Loop *L = S->getLoop();
// We cannot yet do fp recurrences, e.g. the xform of {X,+,F} --> X+{0,+,F}
assert(Ty->isIntegral() && "Cannot expand fp recurrences yet!");
assert(Ty->isInteger() && "Cannot expand fp recurrences yet!");
// {X,+,F} --> X + {0,+,F}
if (!isa<SCEVConstant>(S->getStart()) ||

View File

@ -2791,7 +2791,7 @@ case 118:
const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
GEN_ERROR("Unsigned result not equal to signed result");
if (!ElemTy->isFloatingPoint() && !ElemTy->isIntegral())
if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
GEN_ERROR("Element type of a PackedType must be primitive");
if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
GEN_ERROR("Vector length should be a power of 2!");
@ -3359,9 +3359,9 @@ case 156:
{
if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
GEN_ERROR("Logical operator types must match!");
if (!yyvsp[-3].ConstVal->getType()->isIntegral()) {
if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) ||
!cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral())
!cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands!");
}
yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
@ -3389,7 +3389,7 @@ case 159:
{
if (yyvsp[-1].ConstVal->getType() != Type::Int8Ty)
GEN_ERROR("Shift count for shift constant must be i8 type!");
if (!yyvsp[-3].ConstVal->getType()->isIntegral())
if (!yyvsp[-3].ConstVal->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
@ -4371,7 +4371,7 @@ case 261:
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
if (!(*yyvsp[-3].TypeVal)->isIntegral() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
!isa<PackedType>((*yyvsp[-3].TypeVal).get()))
GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands!");
@ -4395,9 +4395,9 @@ case 262:
{
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
if (!(*yyvsp[-3].TypeVal)->isIntegral()) {
if (!(*yyvsp[-3].TypeVal)->isInteger()) {
if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) ||
!cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral())
!cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands!");
}
Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
@ -4447,7 +4447,7 @@ case 265:
{
if (yyvsp[0].ValueVal->getType() != Type::Int8Ty)
GEN_ERROR("Shift amount must be i8 type!");
if (!yyvsp[-2].ValueVal->getType()->isIntegral())
if (!yyvsp[-2].ValueVal->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);

View File

@ -1274,7 +1274,7 @@ Types
const llvm::Type* ElemTy = $4->get();
if ((unsigned)$2 != $2)
GEN_ERROR("Unsigned result not equal to signed result");
if (!ElemTy->isFloatingPoint() && !ElemTy->isIntegral())
if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
GEN_ERROR("Element type of a PackedType must be primitive");
if (!isPowerOf2_32($2))
GEN_ERROR("Vector length should be a power of 2!");
@ -1756,9 +1756,9 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
| LogicalOps '(' ConstVal ',' ConstVal ')' {
if ($3->getType() != $5->getType())
GEN_ERROR("Logical operator types must match!");
if (!$3->getType()->isIntegral()) {
if (!$3->getType()->isInteger()) {
if (!isa<PackedType>($3->getType()) ||
!cast<PackedType>($3->getType())->getElementType()->isIntegral())
!cast<PackedType>($3->getType())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands!");
}
$$ = ConstantExpr::get($1, $3, $5);
@ -1777,7 +1777,7 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
| ShiftOps '(' ConstVal ',' ConstVal ')' {
if ($5->getType() != Type::Int8Ty)
GEN_ERROR("Shift count for shift constant must be i8 type!");
if (!$3->getType()->isIntegral())
if (!$3->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
$$ = ConstantExpr::get($1, $3, $5);
@ -2573,7 +2573,7 @@ OptTailCall : TAIL CALL {
InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isIntegral() && !(*$2)->isFloatingPoint() &&
if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() &&
!isa<PackedType>((*$2).get()))
GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands!");
@ -2594,9 +2594,9 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| LogicalOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isIntegral()) {
if (!(*$2)->isInteger()) {
if (!isa<PackedType>($2->get()) ||
!cast<PackedType>($2->get())->getElementType()->isIntegral())
!cast<PackedType>($2->get())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands!");
}
Value* tmpVal1 = getVal(*$2, $3);
@ -2637,7 +2637,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| ShiftOps ResolvedVal ',' ResolvedVal {
if ($4->getType() != Type::Int8Ty)
GEN_ERROR("Shift amount must be i8 type!");
if (!$2->getType()->isIntegral())
if (!$2->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
$$ = new ShiftInst($1, $2, $4);

View File

@ -1274,7 +1274,7 @@ Types
const llvm::Type* ElemTy = $4->get();
if ((unsigned)$2 != $2)
GEN_ERROR("Unsigned result not equal to signed result");
if (!ElemTy->isFloatingPoint() && !ElemTy->isIntegral())
if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
GEN_ERROR("Element type of a PackedType must be primitive");
if (!isPowerOf2_32($2))
GEN_ERROR("Vector length should be a power of 2!");
@ -1756,9 +1756,9 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
| LogicalOps '(' ConstVal ',' ConstVal ')' {
if ($3->getType() != $5->getType())
GEN_ERROR("Logical operator types must match!");
if (!$3->getType()->isIntegral()) {
if (!$3->getType()->isInteger()) {
if (!isa<PackedType>($3->getType()) ||
!cast<PackedType>($3->getType())->getElementType()->isIntegral())
!cast<PackedType>($3->getType())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands!");
}
$$ = ConstantExpr::get($1, $3, $5);
@ -1777,7 +1777,7 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
| ShiftOps '(' ConstVal ',' ConstVal ')' {
if ($5->getType() != Type::Int8Ty)
GEN_ERROR("Shift count for shift constant must be i8 type!");
if (!$3->getType()->isIntegral())
if (!$3->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
$$ = ConstantExpr::get($1, $3, $5);
@ -2573,7 +2573,7 @@ OptTailCall : TAIL CALL {
InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isIntegral() && !(*$2)->isFloatingPoint() &&
if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() &&
!isa<PackedType>((*$2).get()))
GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands!");
@ -2594,9 +2594,9 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| LogicalOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isIntegral()) {
if (!(*$2)->isInteger()) {
if (!isa<PackedType>($2->get()) ||
!cast<PackedType>($2->get())->getElementType()->isIntegral())
!cast<PackedType>($2->get())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands!");
}
Value* tmpVal1 = getVal(*$2, $3);
@ -2637,7 +2637,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| ShiftOps ResolvedVal ',' ResolvedVal {
if ($4->getType() != Type::Int8Ty)
GEN_ERROR("Shift amount must be i8 type!");
if (!$2->getType()->isIntegral())
if (!$2->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
$$ = new ShiftInst($1, $2, $4);

View File

@ -292,7 +292,7 @@ void BytecodeWriter::outputType(const Type *T) {
}
void BytecodeWriter::outputConstant(const Constant *CPV) {
assert(((CPV->getType()->isPrimitiveType() || CPV->getType()->isIntegral()) ||
assert(((CPV->getType()->isPrimitiveType() || CPV->getType()->isInteger()) ||
!CPV->isNullValue()) && "Shouldn't output null constants!");
// We must check for a ConstantExpr before switching by type because

View File

@ -455,7 +455,7 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
// We can emit the pointer value into this slot if the slot is an
// integer slot greater or equal to the size of the pointer.
if (Ty->isIntegral() &&
if (Ty->isInteger() &&
TD->getTypeSize(Ty) >= TD->getTypeSize(Op->getType()))
return EmitConstantValueOnly(Op);

View File

@ -107,7 +107,7 @@ void IntrinsicLowering::AddPrototypes(Module &M) {
/// LowerBSWAP - Emit the code to lower bswap of V before the specified
/// instruction IP.
static Value *LowerBSWAP(Value *V, Instruction *IP) {
assert(V->getType()->isIntegral() && "Can't bswap a non-integer type!");
assert(V->getType()->isInteger() && "Can't bswap a non-integer type!");
unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
@ -193,7 +193,7 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) {
/// LowerCTPOP - Emit the code to lower ctpop of V before the specified
/// instruction IP.
static Value *LowerCTPOP(Value *V, Instruction *IP) {
assert(V->getType()->isIntegral() && "Can't ctpop a non-integer type!");
assert(V->getType()->isInteger() && "Can't ctpop a non-integer type!");
static const uint64_t MaskValues[6] = {
0x5555555555555555ULL, 0x3333333333333333ULL,

View File

@ -891,7 +891,7 @@ void Interpreter::popStackAndReturnValueToCaller (const Type *RetTy,
ECStack.pop_back();
if (ECStack.empty()) { // Finished main. Put result into exit code...
if (RetTy && RetTy->isIntegral()) { // Nonvoid return type?
if (RetTy && RetTy->isInteger()) { // Nonvoid return type?
ExitValue = Result; // Capture the exit value of the program
} else {
memset(&ExitValue, 0, sizeof(ExitValue));
@ -1170,7 +1170,7 @@ void Interpreter::visitCallSite(CallSite CS) {
// this by zero or sign extending the value as appropriate according to the
// source type.
const Type *Ty = V->getType();
if (Ty->isIntegral()) {
if (Ty->isInteger()) {
if (Ty->getPrimitiveSizeInBits() == 1)
ArgVals.back().Int32Val = ArgVals.back().Int1Val;
else if (Ty->getPrimitiveSizeInBits() <= 8)
@ -1541,14 +1541,14 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, const Type *DstTy,
if (isa<PointerType>(DstTy)) {
assert(isa<PointerType>(SrcTy) && "Invalid BitCast");
Dest.PointerVal = Src.PointerVal;
} else if (DstTy->isIntegral()) {
} else if (DstTy->isInteger()) {
const IntegerType *DITy = cast<IntegerType>(DstTy);
unsigned DBitWidth = DITy->getBitWidth();
if (SrcTy == Type::FloatTy) {
Dest.Int32Val = FloatToBits(Src.FloatVal);
} else if (SrcTy == Type::DoubleTy) {
Dest.Int64Val = DoubleToBits(Src.DoubleVal);
} else if (SrcTy->isIntegral()) {
} else if (SrcTy->isInteger()) {
const IntegerType *SITy = cast<IntegerType>(SrcTy);
unsigned SBitWidth = SITy->getBitWidth();
assert(SBitWidth <= 64 && "Integer types > 64 bits not supported");
@ -1566,12 +1566,12 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, const Type *DstTy,
} else
assert(0 && "Invalid BitCast");
} else if (DstTy == Type::FloatTy) {
if (SrcTy->isIntegral())
if (SrcTy->isInteger())
Dest.FloatVal = BitsToFloat(Src.Int32Val);
else
Dest.FloatVal = Src.FloatVal;
} else if (DstTy == Type::DoubleTy) {
if (SrcTy->isIntegral())
if (SrcTy->isInteger())
Dest.DoubleVal = BitsToDouble(Src.Int64Val);
else
Dest.DoubleVal = Src.DoubleVal;

View File

@ -31,7 +31,7 @@
using namespace llvm;
static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
if (Ty->isIntegral()) {
if (Ty->isInteger()) {
if (isSigned) {
// Calculate 011111111111111...
unsigned TypeBits = Ty->getPrimitiveSizeInBits();
@ -46,7 +46,7 @@ static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
// Static constructor to create the minimum constant for an integral type...
static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) {
if (Ty->isIntegral()) {
if (Ty->isInteger()) {
if (isSigned) {
// Calculate 1111111111000000000000
unsigned TypeBits = Ty->getPrimitiveSizeInBits();
@ -93,7 +93,7 @@ static ConstantInt *Max(ConstantInt *A, ConstantInt *B,
/// Initialize a full (the default) or empty set for the specified type.
///
ConstantRange::ConstantRange(const Type *Ty, bool Full) {
assert(Ty->isIntegral() &&
assert(Ty->isInteger() &&
"Cannot make constant range of non-integral type!");
if (Full)
Lower = Upper = getMaxValue(Ty);
@ -225,7 +225,7 @@ bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const {
/// subtract - Subtract the specified constant from the endpoints of this
/// constant range.
ConstantRange ConstantRange::subtract(ConstantInt *CI) const {
assert(CI->getType() == getType() && getType()->isIntegral() &&
assert(CI->getType() == getType() && getType()->isInteger() &&
"Cannot subtract from different type range or non-integer!");
// If the set is empty or full, don't modify the endpoints.
if (Lower == Upper) return *this;

View File

@ -366,7 +366,7 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
std::ostream &
CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned,
const std::string &NameSoFar) {
assert((Ty->isPrimitiveType() || Ty->isIntegral()) &&
assert((Ty->isPrimitiveType() || Ty->isInteger()) &&
"Invalid type for printSimpleType");
switch (Ty->getTypeID()) {
case Type::VoidTyID: return Out << "void " << NameSoFar;
@ -399,7 +399,7 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned,
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
bool isSigned, const std::string &NameSoFar,
bool IgnoreName) {
if (Ty->isPrimitiveType() || Ty->isIntegral()) {
if (Ty->isPrimitiveType() || Ty->isInteger()) {
printSimpleType(Out, Ty, isSigned, NameSoFar);
return Out;
}
@ -1022,7 +1022,7 @@ bool CWriter::printConstExprCast(const ConstantExpr* CE) {
}
if (NeedsExplicitCast) {
Out << "((";
if (Ty->isIntegral() && Ty != Type::Int1Ty)
if (Ty->isInteger() && Ty != Type::Int1Ty)
printSimpleType(Out, Ty, TypeIsSigned);
else
printType(Out, Ty); // not integer, sign doesn't matter
@ -1225,7 +1225,7 @@ void CWriter::writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate
// operand.
if (shouldCast) {
Out << "((";
if (OpTy->isIntegral() && OpTy != Type::Int1Ty)
if (OpTy->isInteger() && OpTy != Type::Int1Ty)
printSimpleType(Out, OpTy, castIsSigned);
else
printType(Out, OpTy); // not integer, sign doesn't matter
@ -1727,7 +1727,7 @@ void CWriter::printModuleTypes(const TypeSymbolTable &TST) {
void CWriter::printContainedStructs(const Type *Ty,
std::set<const StructType*> &StructPrinted){
// Don't walk through pointers.
if (isa<PointerType>(Ty) || Ty->isPrimitiveType() || Ty->isIntegral()) return;
if (isa<PointerType>(Ty) || Ty->isPrimitiveType() || Ty->isInteger()) return;
// Print all contained types first.
for (Type::subtype_iterator I = Ty->subtype_begin(),
@ -1848,8 +1848,8 @@ static inline bool isFPIntBitCast(const Instruction &I) {
return false;
const Type *SrcTy = I.getOperand(0)->getType();
const Type *DstTy = I.getType();
return (SrcTy->isFloatingPoint() && DstTy->isIntegral()) ||
(DstTy->isFloatingPoint() && SrcTy->isIntegral());
return (SrcTy->isFloatingPoint() && DstTy->isInteger()) ||
(DstTy->isFloatingPoint() && SrcTy->isInteger());
}
void CWriter::printFunction(Function &F) {

View File

@ -174,7 +174,7 @@ bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const {
// Verify this is a simple bswap.
if (CI->getNumOperands() != 2 ||
CI->getType() != CI->getOperand(1)->getType() ||
!CI->getType()->isIntegral())
!CI->getType()->isInteger())
return false;
const Type *Ty = CI->getType();

View File

@ -69,19 +69,19 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty,
case Instruction::Add:
case Instruction::Sub:
if (!Ty->isIntegral() && !Ty->isFloatingPoint()) return false;
if (!Ty->isInteger() && !Ty->isFloatingPoint()) return false;
if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD) ||
!ExpressionConvertibleToType(I->getOperand(1), Ty, CTMap, TD))
return false;
break;
case Instruction::LShr:
case Instruction::AShr:
if (!Ty->isIntegral()) return false;
if (!Ty->isInteger()) return false;
if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD))
return false;
break;
case Instruction::Shl:
if (!Ty->isIntegral()) return false;
if (!Ty->isInteger()) return false;
if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD))
return false;
break;
@ -458,7 +458,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
case Instruction::Add:
case Instruction::Sub: {
if (!Ty->isIntegral() && !Ty->isFloatingPoint()) return false;
if (!Ty->isInteger() && !Ty->isFloatingPoint()) return false;
Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
return ValueConvertibleToType(I, Ty, CTMap, TD) &&
@ -476,7 +476,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
case Instruction::AShr:
case Instruction::Shl:
if (I->getOperand(1) == V) return false; // Cannot change shift amount type
if (!Ty->isIntegral()) return false;
if (!Ty->isInteger()) return false;
return ValueConvertibleToType(I, Ty, CTMap, TD);
case Instruction::Free:
@ -576,7 +576,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
// Can convert store if the incoming value is convertible and if the
// result will preserve semantics...
const Type *Op0Ty = I->getOperand(0)->getType();
if (!(Op0Ty->isIntegral() ^ ElTy->isIntegral()) &&
if (!(Op0Ty->isInteger() ^ ElTy->isInteger()) &&
!(Op0Ty->isFloatingPoint() ^ ElTy->isFloatingPoint()))
return ExpressionConvertibleToType(I->getOperand(0), ElTy, CTMap, TD);
}

View File

@ -52,13 +52,13 @@ ModulePass *llvm::createDeadTypeEliminationPass() {
//
static inline bool ShouldNukeSymtabEntry(const Type *Ty){
// Nuke all names for primitive types!
if (Ty->isPrimitiveType() || Ty->isIntegral())
if (Ty->isPrimitiveType() || Ty->isInteger())
return true;
// Nuke all pointers to primitive types as well...
if (const PointerType *PT = dyn_cast<PointerType>(Ty))
if (PT->getElementType()->isPrimitiveType() ||
PT->getElementType()->isIntegral())
PT->getElementType()->isInteger())
return true;
return false;

View File

@ -398,7 +398,7 @@ struct ExitInMainOptimization : public LibCallOptimization {
// Make sure the called function looks like exit (int argument, int return
// type, external linkage, not varargs).
virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){
return F->arg_size() >= 1 && F->arg_begin()->getType()->isIntegral();
return F->arg_size() >= 1 && F->arg_begin()->getType()->isInteger();
}
virtual bool OptimizeCall(CallInst* ci, SimplifyLibCalls& SLC) {
@ -960,8 +960,8 @@ struct memcmpOptimization : public LibCallOptimization {
Function::const_arg_iterator AI = F->arg_begin();
if (F->arg_size() != 3 || !isa<PointerType>(AI->getType())) return false;
if (!isa<PointerType>((++AI)->getType())) return false;
if (!(++AI)->getType()->isIntegral()) return false;
if (!F->getReturnType()->isIntegral()) return false;
if (!(++AI)->getType()->isInteger()) return false;
if (!F->getReturnType()->isInteger()) return false;
return true;
}
@ -1725,8 +1725,8 @@ public:
: LibCallOptimization("isascii", "Number of 'isascii' calls simplified") {}
virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){
return F->arg_size() == 1 && F->arg_begin()->getType()->isIntegral() &&
F->getReturnType()->isIntegral();
return F->arg_size() == 1 && F->arg_begin()->getType()->isInteger() &&
F->getReturnType()->isInteger();
}
/// @brief Perform the isascii optimization.

View File

@ -111,7 +111,7 @@ namespace {
Value *Replacement;
public:
ValueInfo(const Type *Ty)
: Bounds(Ty->isIntegral() ? Ty : Type::Int32Ty), Replacement(0) {}
: Bounds(Ty->isInteger() ? Ty : Type::Int32Ty), Replacement(0) {}
// getBounds() - Return the constant bounds of the value...
const ConstantRange &getBounds() const { return Bounds; }

View File

@ -325,7 +325,7 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
if (LI->getLoopFor(L->getBlocks()[i]) == L) { // Not in a subloop...
BasicBlock *BB = L->getBlocks()[i];
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) {
if (I->getType()->isIntegral()) { // Is an integer instruction
if (I->getType()->isInteger()) { // Is an integer instruction
SCEVHandle SH = SE->getSCEV(I);
if (SH->hasComputableLoopEvolution(L) || // Varies predictably
HasConstantItCount) {
@ -460,7 +460,7 @@ void IndVarSimplify::runOnLoop(Loop *L) {
for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
PHINode *PN = cast<PHINode>(I);
if (PN->getType()->isIntegral()) { // FIXME: when we have fast-math, enable!
if (PN->getType()->isInteger()) { // FIXME: when we have fast-math, enable!
SCEVHandle SCEV = SE->getSCEV(PN);
if (SCEV->hasComputableLoopEvolution(L))
// FIXME: It is an extremely bad idea to indvar substitute anything more
@ -574,7 +574,7 @@ void IndVarSimplify::runOnLoop(Loop *L) {
if (LI->getLoopFor(L->getBlocks()[i]) == L) { // Not in a subloop...
BasicBlock *BB = L->getBlocks()[i];
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
if (I->getType()->isIntegral() && // Is an integer instruction
if (I->getType()->isInteger() && // Is an integer instruction
!I->use_empty() &&
!Rewriter.isInsertedInstruction(I)) {
SCEVHandle SH = SE->getSCEV(I);

View File

@ -495,7 +495,7 @@ static inline Value *dyn_castNotVal(Value *V) {
// Otherwise, return null.
//
static inline Value *dyn_castFoldableMul(Value *V, ConstantInt *&CST) {
if (V->hasOneUse() && V->getType()->isIntegral())
if (V->hasOneUse() && V->getType()->isInteger())
if (Instruction *I = dyn_cast<Instruction>(V)) {
if (I->getOpcode() == Instruction::Mul)
if ((CST = dyn_cast<ConstantInt>(I->getOperand(1))))
@ -558,7 +558,7 @@ static void ComputeMaskedBits(Value *V, uint64_t Mask, uint64_t &KnownZero,
Instruction *I = dyn_cast<Instruction>(V);
if (!I) return;
Mask &= V->getType()->getIntegralTypeMask();
Mask &= V->getType()->getIntegerTypeMask();
switch (I->getOpcode()) {
case Instruction::And:
@ -624,7 +624,7 @@ static void ComputeMaskedBits(Value *V, uint64_t Mask, uint64_t &KnownZero,
return;
case Instruction::BitCast: {
const Type *SrcTy = I->getOperand(0)->getType();
if (SrcTy->isIntegral()) {
if (SrcTy->isInteger()) {
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
return;
}
@ -633,10 +633,10 @@ static void ComputeMaskedBits(Value *V, uint64_t Mask, uint64_t &KnownZero,
case Instruction::ZExt: {
// Compute the bits in the result that are not present in the input.
const Type *SrcTy = I->getOperand(0)->getType();
uint64_t NotIn = ~SrcTy->getIntegralTypeMask();
uint64_t NewBits = I->getType()->getIntegralTypeMask() & NotIn;
uint64_t NotIn = ~SrcTy->getIntegerTypeMask();
uint64_t NewBits = I->getType()->getIntegerTypeMask() & NotIn;
Mask &= SrcTy->getIntegralTypeMask();
Mask &= SrcTy->getIntegerTypeMask();
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
// The top bits are known to be zero.
@ -646,10 +646,10 @@ static void ComputeMaskedBits(Value *V, uint64_t Mask, uint64_t &KnownZero,
case Instruction::SExt: {
// Compute the bits in the result that are not present in the input.
const Type *SrcTy = I->getOperand(0)->getType();
uint64_t NotIn = ~SrcTy->getIntegralTypeMask();
uint64_t NewBits = I->getType()->getIntegralTypeMask() & NotIn;
uint64_t NotIn = ~SrcTy->getIntegerTypeMask();
uint64_t NewBits = I->getType()->getIntegerTypeMask() & NotIn;
Mask &= SrcTy->getIntegralTypeMask();
Mask &= SrcTy->getIntegerTypeMask();
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
@ -766,7 +766,7 @@ static void ComputeSignedMinMaxValuesFromKnownBits(const Type *Ty,
uint64_t KnownZero,
uint64_t KnownOne,
int64_t &Min, int64_t &Max) {
uint64_t TypeBits = Ty->getIntegralTypeMask();
uint64_t TypeBits = Ty->getIntegerTypeMask();
uint64_t UnknownBits = ~(KnownZero|KnownOne) & TypeBits;
uint64_t SignBit = 1ULL << (Ty->getPrimitiveSizeInBits()-1);
@ -796,7 +796,7 @@ static void ComputeUnsignedMinMaxValuesFromKnownBits(const Type *Ty,
uint64_t KnownOne,
uint64_t &Min,
uint64_t &Max) {
uint64_t TypeBits = Ty->getIntegralTypeMask();
uint64_t TypeBits = Ty->getIntegerTypeMask();
uint64_t UnknownBits = ~(KnownZero|KnownOne) & TypeBits;
// The minimum value is when the unknown bits are all zeros.
@ -831,7 +831,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
}
// If this is the root being simplified, allow it to have multiple uses,
// just set the DemandedMask to all bits.
DemandedMask = V->getType()->getIntegralTypeMask();
DemandedMask = V->getType()->getIntegerTypeMask();
} else if (DemandedMask == 0) { // Not demanding any bits from V.
if (V != UndefValue::get(V->getType()))
return UpdateValueUsesWith(V, UndefValue::get(V->getType()));
@ -843,7 +843,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
Instruction *I = dyn_cast<Instruction>(V);
if (!I) return false; // Only analyze instructions.
DemandedMask &= V->getType()->getIntegralTypeMask();
DemandedMask &= V->getType()->getIntegerTypeMask();
uint64_t KnownZero2 = 0, KnownOne2 = 0;
switch (I->getOpcode()) {
@ -1001,7 +1001,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
break;
case Instruction::BitCast:
if (!I->getOperand(0)->getType()->isIntegral())
if (!I->getOperand(0)->getType()->isInteger())
return false;
if (SimplifyDemandedBits(I->getOperand(0), DemandedMask,
@ -1012,10 +1012,10 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
case Instruction::ZExt: {
// Compute the bits in the result that are not present in the input.
const Type *SrcTy = I->getOperand(0)->getType();
uint64_t NotIn = ~SrcTy->getIntegralTypeMask();
uint64_t NewBits = I->getType()->getIntegralTypeMask() & NotIn;
uint64_t NotIn = ~SrcTy->getIntegerTypeMask();
uint64_t NewBits = I->getType()->getIntegerTypeMask() & NotIn;
DemandedMask &= SrcTy->getIntegralTypeMask();
DemandedMask &= SrcTy->getIntegerTypeMask();
if (SimplifyDemandedBits(I->getOperand(0), DemandedMask,
KnownZero, KnownOne, Depth+1))
return true;
@ -1027,12 +1027,12 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
case Instruction::SExt: {
// Compute the bits in the result that are not present in the input.
const Type *SrcTy = I->getOperand(0)->getType();
uint64_t NotIn = ~SrcTy->getIntegralTypeMask();
uint64_t NewBits = I->getType()->getIntegralTypeMask() & NotIn;
uint64_t NotIn = ~SrcTy->getIntegerTypeMask();
uint64_t NewBits = I->getType()->getIntegerTypeMask() & NotIn;
// Get the sign bit for the source type
uint64_t InSignBit = 1ULL << (SrcTy->getPrimitiveSizeInBits()-1);
int64_t InputDemandedBits = DemandedMask & SrcTy->getIntegralTypeMask();
int64_t InputDemandedBits = DemandedMask & SrcTy->getIntegerTypeMask();
// If any of the sign extended bits are demanded, we know that the sign
// bit is demanded.
@ -1174,7 +1174,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
// Compute the new bits that are at the top now.
uint64_t HighBits = (1ULL << ShiftAmt)-1;
HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShiftAmt;
uint64_t TypeMask = I->getType()->getIntegralTypeMask();
uint64_t TypeMask = I->getType()->getIntegerTypeMask();
// Unsigned shift right.
if (SimplifyDemandedBits(I->getOperand(0),
(DemandedMask << ShiftAmt) & TypeMask,
@ -1207,7 +1207,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
// Compute the new bits that are at the top now.
uint64_t HighBits = (1ULL << ShiftAmt)-1;
HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShiftAmt;
uint64_t TypeMask = I->getType()->getIntegralTypeMask();
uint64_t TypeMask = I->getType()->getIntegerTypeMask();
// Signed shift right.
if (SimplifyDemandedBits(I->getOperand(0),
(DemandedMask << ShiftAmt) & TypeMask,
@ -1745,7 +1745,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
// (X & 254)+1 -> (X&254)|1
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
SimplifyDemandedBits(&I, I.getType()->getIntegralTypeMask(),
SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
KnownZero, KnownOne))
return &I;
}
@ -1780,7 +1780,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
// This is a sign extend if the top bits are known zero.
uint64_t Mask = ~0ULL;
Mask <<= 64-(TySizeBits-Size);
Mask &= XorLHS->getType()->getIntegralTypeMask();
Mask &= XorLHS->getType()->getIntegerTypeMask();
if (!MaskedValueIsZero(XorLHS, Mask))
Size = 0; // Not a sign ext, but can't be any others either.
goto FoundSExt;
@ -1808,7 +1808,7 @@ FoundSExt:
}
// X + X --> X << 1
if (I.getType()->isIntegral() && I.getType() != Type::Int1Ty) {
if (I.getType()->isInteger() && I.getType() != Type::Int1Ty) {
if (Instruction *Result = AssociativeOpt(I, AddRHS(RHS))) return Result;
if (Instruction *RHSI = dyn_cast<Instruction>(RHS)) {
@ -1876,7 +1876,7 @@ FoundSExt:
// Form a mask of all bits from the lowest bit added through the top.
uint64_t AddRHSHighBits = ~((AddRHSV & -AddRHSV)-1);
AddRHSHighBits &= C2->getType()->getIntegralTypeMask();
AddRHSHighBits &= C2->getType()->getIntegerTypeMask();
// See if the and mask includes all of these bits.
uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getZExtValue();
@ -1933,7 +1933,7 @@ static Value *RemoveNoopCast(Value *V) {
if (CastInst *CI = dyn_cast<CastInst>(V)) {
const Type *CTy = CI->getType();
const Type *OpTy = CI->getOperand(0)->getType();
if (CTy->isIntegral() && OpTy->isIntegral()) {
if (CTy->isInteger() && OpTy->isInteger()) {
if (CTy->getPrimitiveSizeInBits() == OpTy->getPrimitiveSizeInBits())
return RemoveNoopCast(CI->getOperand(0));
} else if (isa<PointerType>(CTy) && isa<PointerType>(OpTy))
@ -2412,7 +2412,7 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
// If the sign bits of both operands are zero (i.e. we can prove they are
// unsigned inputs), turn this into a udiv.
if (I.getType()->isIntegral()) {
if (I.getType()->isInteger()) {
uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1);
if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) {
return BinaryOperator::createUDiv(Op0, Op1, I.getName());
@ -2641,7 +2641,7 @@ static bool isMaxValueMinusOne(const ConstantInt *C, bool isSigned) {
Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
return C->getSExtValue() == Val-1;
}
return C->getZExtValue() == C->getType()->getIntegralTypeMask()-1;
return C->getZExtValue() == C->getType()->getIntegerTypeMask()-1;
}
// isMinValuePlusOne - return true if this is Min+1
@ -2858,7 +2858,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op,
uint64_t AndRHSV = cast<ConstantInt>(AndRHS)->getZExtValue();
// Clear bits that are not part of the constant.
AndRHSV &= AndRHS->getType()->getIntegralTypeMask();
AndRHSV &= AndRHS->getType()->getIntegerTypeMask();
// If there is only one bit set...
if (isOneBitSet(cast<ConstantInt>(AndRHS))) {
@ -3044,7 +3044,7 @@ Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS,
// is all N is, ignore it.
unsigned MB, ME;
if (isRunOfOnes(Mask, MB, ME)) { // begin/end bit of run, inclusive
uint64_t Mask = RHS->getType()->getIntegralTypeMask();
uint64_t Mask = RHS->getType()->getIntegerTypeMask();
Mask >>= 64-MB+1;
if (MaskedValueIsZero(RHS, Mask))
break;
@ -3083,13 +3083,13 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
SimplifyDemandedBits(&I, I.getType()->getIntegralTypeMask(),
SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
KnownZero, KnownOne))
return &I;
if (ConstantInt *AndRHS = dyn_cast<ConstantInt>(Op1)) {
uint64_t AndRHSMask = AndRHS->getZExtValue();
uint64_t TypeMask = Op0->getType()->getIntegralTypeMask();
uint64_t TypeMask = Op0->getType()->getIntegerTypeMask();
uint64_t NotAndRHS = AndRHSMask^TypeMask;
// Optimize a variety of ((val OP C1) & C2) combinations...
@ -3386,7 +3386,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
if (CastInst *Op1C = dyn_cast<CastInst>(Op1))
if (Op0C->getOpcode() == Op1C->getOpcode()) { // same cast kind ?
const Type *SrcTy = Op0C->getOperand(0)->getType();
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() &&
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isInteger() &&
// Only do this if the casts both really cause code to be generated.
ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0),
I.getType(), TD) &&
@ -3554,7 +3554,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
SimplifyDemandedBits(&I, I.getType()->getIntegralTypeMask(),
SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
KnownZero, KnownOne))
return &I;
@ -3836,7 +3836,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
if (CastInst *Op1C = dyn_cast<CastInst>(Op1))
if (Op0C->getOpcode() == Op1C->getOpcode()) {// same cast kind ?
const Type *SrcTy = Op0C->getOperand(0)->getType();
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() &&
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isInteger() &&
// Only do this if the casts both really cause code to be generated.
ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0),
I.getType(), TD) &&
@ -3882,7 +3882,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
SimplifyDemandedBits(&I, I.getType()->getIntegralTypeMask(),
SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
KnownZero, KnownOne))
return &I;
@ -4020,7 +4020,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
if (CastInst *Op1C = dyn_cast<CastInst>(Op1))
if (Op0C->getOpcode() == Op1C->getOpcode()) { // same cast kind?
const Type *SrcTy = Op0C->getOperand(0)->getType();
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() &&
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isInteger() &&
// Only do this if the casts both really cause code to be generated.
ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0),
I.getType(), TD) &&
@ -4512,7 +4512,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
// See if we can fold the comparison based on bits known to be zero or one
// in the input.
uint64_t KnownZero, KnownOne;
if (SimplifyDemandedBits(Op0, Ty->getIntegralTypeMask(),
if (SimplifyDemandedBits(Op0, Ty->getIntegerTypeMask(),
KnownZero, KnownOne, 0))
return &I;
@ -5062,7 +5062,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
Value *CastOp = Cast->getOperand(0);
const Type *SrcTy = CastOp->getType();
unsigned SrcTySize = SrcTy->getPrimitiveSizeInBits();
if (SrcTy->isIntegral() &&
if (SrcTy->isInteger() &&
SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) {
// If this is an unsigned comparison, try to make the comparison use
// smaller constant values.
@ -5436,7 +5436,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
// See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (SimplifyDemandedBits(&I, I.getType()->getIntegralTypeMask(),
if (SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
KnownZero, KnownOne))
return &I;
@ -6038,7 +6038,7 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
// See if we can simplify any instructions used by the LHS whose sole
// purpose is to compute bits we don't care about.
uint64_t KnownZero = 0, KnownOne = 0;
if (SimplifyDemandedBits(&CI, DestTy->getIntegralTypeMask(),
if (SimplifyDemandedBits(&CI, DestTy->getIntegerTypeMask(),
KnownZero, KnownOne))
return &CI;
@ -6211,7 +6211,7 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
if (Op1CV == 0 || isPowerOf2_64(Op1CV)) {
// If Op1C some other power of two, convert:
uint64_t KnownZero, KnownOne;
uint64_t TypeMask = Op1->getType()->getIntegralTypeMask();
uint64_t TypeMask = Op1->getType()->getIntegerTypeMask();
ComputeMaskedBits(Op0, TypeMask, KnownZero, KnownOne);
// This only works for EQ and NE
@ -6333,7 +6333,7 @@ Instruction *InstCombiner::visitZExt(CastInst &CI) {
// If we're actually extending zero bits and the trunc is a no-op
if (MidSize < DstSize && SrcSize == DstSize) {
// Replace both of the casts with an And of the type mask.
uint64_t AndValue = CSrc->getType()->getIntegralTypeMask();
uint64_t AndValue = CSrc->getType()->getIntegerTypeMask();
Constant *AndConst = ConstantInt::get(A->getType(), AndValue);
Instruction *And =
BinaryOperator::createAnd(CSrc->getOperand(0), AndConst);
@ -6395,7 +6395,7 @@ Instruction *InstCombiner::visitBitCast(CastInst &CI) {
const Type *SrcTy = Src->getType();
const Type *DestTy = CI.getType();
if (SrcTy->isIntegral() && DestTy->isIntegral()) {
if (SrcTy->isInteger() && DestTy->isInteger()) {
if (Instruction *Result = commonIntCastTransforms(CI))
return Result;
} else {
@ -6816,7 +6816,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
}
// See if we can fold the select into one of our operands.
if (SI.getType()->isIntegral()) {
if (SI.getType()->isInteger()) {
// See the comment above GetSelectFoldableOperands for a description of the
// transformation we are doing here.
if (Instruction *TVI = dyn_cast<Instruction>(TrueVal))
@ -7273,7 +7273,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
//Either we can cast directly, or we can upconvert the argument
bool isConvertible = ActTy == ParamTy ||
(isa<PointerType>(ParamTy) && isa<PointerType>(ActTy)) ||
(ParamTy->isIntegral() && ActTy->isIntegral() &&
(ParamTy->isInteger() && ActTy->isInteger() &&
ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits()) ||
(c && ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits()
&& c->getSExtValue() > 0);
@ -7667,7 +7667,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Value *Src = CI->getOperand(0);
const Type *SrcTy = Src->getType();
const Type *DestTy = CI->getType();
if (Src->getType()->isIntegral()) {
if (Src->getType()->isInteger()) {
if (SrcTy->getPrimitiveSizeInBits() ==
DestTy->getPrimitiveSizeInBits()) {
// We can always eliminate a cast from ulong or long to the other.
@ -7998,7 +7998,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
const Type *SrcPTy = SrcTy->getElementType();
if (DestPTy->isIntegral() || isa<PointerType>(DestPTy) ||
if (DestPTy->isInteger() || isa<PointerType>(DestPTy) ||
isa<PackedType>(DestPTy)) {
// If the source is an array, the code below will not succeed. Check to
// see if a trivial 'gep P, 0, 0' will help matters. Only do this for
@ -8012,7 +8012,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
SrcPTy = SrcTy->getElementType();
}
if ((SrcPTy->isIntegral() || isa<PointerType>(SrcPTy) ||
if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) ||
isa<PackedType>(SrcPTy)) &&
// Do not allow turning this into a load of an integer, which is then
// casted to a pointer, this pessimizes pointer analysis a lot.
@ -8186,7 +8186,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
const Type *SrcPTy = SrcTy->getElementType();
if (DestPTy->isIntegral() || isa<PointerType>(DestPTy)) {
if (DestPTy->isInteger() || isa<PointerType>(DestPTy)) {
// If the source is an array, the code below will not succeed. Check to
// see if a trivial 'gep P, 0, 0' will help matters. Only do this for
// constants.
@ -8199,7 +8199,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
SrcPTy = SrcTy->getElementType();
}
if ((SrcPTy->isIntegral() || isa<PointerType>(SrcPTy)) &&
if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy)) &&
IC.getTargetData().getTypeSize(SrcPTy) ==
IC.getTargetData().getTypeSize(DestPTy)) {
@ -8210,9 +8210,9 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
Instruction::CastOps opcode = Instruction::BitCast;
Value *SIOp0 = SI.getOperand(0);
if (isa<PointerType>(SrcPTy)) {
if (SIOp0->getType()->isIntegral())
if (SIOp0->getType()->isInteger())
opcode = Instruction::IntToPtr;
} else if (SrcPTy->isIntegral()) {
} else if (SrcPTy->isInteger()) {
if (isa<PointerType>(SIOp0->getType()))
opcode = Instruction::PtrToInt;
}

View File

@ -398,7 +398,7 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV,
/// return true. Otherwise, return false.
bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L,
std::set<Instruction*> &Processed) {
if (!I->getType()->isIntegral() && !isa<PointerType>(I->getType()))
if (!I->getType()->isInteger() && !isa<PointerType>(I->getType()))
return false; // Void and FP expressions cannot be reduced.
if (!Processed.insert(I).second)
return true; // Instruction already handled.

View File

@ -164,7 +164,7 @@ unsigned Reassociate::getRank(Value *V) {
// If this is a not or neg instruction, do not count it for rank. This
// assures us that X and ~X will have the same rank.
if (!I->getType()->isIntegral() ||
if (!I->getType()->isInteger() ||
(!BinaryOperator::isNot(I) && !BinaryOperator::isNeg(I)))
++Rank;

View File

@ -442,7 +442,7 @@ static bool MergeInType(const Type *In, const Type *&Accum,
Accum = In;
} else if (In == Type::VoidTy) {
// Noop.
} else if (In->isIntegral() && Accum->isIntegral()) { // integer union.
} else if (In->isInteger() && Accum->isInteger()) { // integer union.
// Otherwise pick whichever type is larger.
if (cast<IntegerType>(In)->getBitWidth() >
cast<IntegerType>(Accum)->getBitWidth())
@ -472,7 +472,7 @@ static bool MergeInType(const Type *In, const Type *&Accum,
case Type::FloatTyID: Accum = Type::Int32Ty; break;
case Type::DoubleTyID: Accum = Type::Int64Ty; break;
default:
assert(Accum->isIntegral() && "Unknown FP type!");
assert(Accum->isInteger() && "Unknown FP type!");
break;
}
@ -481,7 +481,7 @@ static bool MergeInType(const Type *In, const Type *&Accum,
case Type::FloatTyID: In = Type::Int32Ty; break;
case Type::DoubleTyID: In = Type::Int64Ty; break;
default:
assert(In->isIntegral() && "Unknown FP type!");
assert(In->isInteger() && "Unknown FP type!");
break;
}
return MergeInType(In, Accum, TD);
@ -541,7 +541,7 @@ const Type *SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial) {
IsNotTrivial = true;
const Type *SubElt = CanConvertToScalar(GEP, IsNotTrivial);
if (SubElt == 0) return 0;
if (SubElt != Type::VoidTy && SubElt->isIntegral()) {
if (SubElt != Type::VoidTy && SubElt->isInteger()) {
const Type *NewTy =
getUIntAtLeastAsBitAs(TD.getTypeSize(SubElt)*8+BitOffset);
if (NewTy == 0 || MergeInType(NewTy, UsedType, TD)) return 0;
@ -653,7 +653,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
// an integer.
NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI);
} else {
assert(NV->getType()->isIntegral() && "Unknown promotion!");
assert(NV->getType()->isInteger() && "Unknown promotion!");
if (Offset && Offset < TD.getTypeSize(NV->getType())*8) {
NV = new ShiftInst(Instruction::LShr, NV,
ConstantInt::get(Type::Int8Ty, Offset),
@ -661,7 +661,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
}
// If the result is an integer, this is a trunc or bitcast.
if (LI->getType()->isIntegral()) {
if (LI->getType()->isInteger()) {
NV = CastInst::createTruncOrBitCast(NV, LI->getType(),
LI->getName(), LI);
} else if (LI->getType()->isFloatingPoint()) {
@ -748,7 +748,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
if (TotalBits != SrcSize) {
assert(TotalBits > SrcSize);
uint64_t Mask = ~(((1ULL << SrcSize)-1) << Offset);
Mask = Mask & SV->getType()->getIntegralTypeMask();
Mask = Mask & SV->getType()->getIntegerTypeMask();
Old = BinaryOperator::createAnd(Old,
ConstantInt::get(Old->getType(), Mask),
Old->getName()+".mask", SI);

View File

@ -1852,7 +1852,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
Value *CompVal = 0;
std::vector<ConstantInt*> Values;
bool TrueWhenEqual = GatherValueComparisons(Cond, CompVal, Values);
if (CompVal && CompVal->getType()->isIntegral()) {
if (CompVal && CompVal->getType()->isInteger()) {
// There might be duplicate constants in the list, which the switch
// instruction can't handle, remove them now.
std::sort(Values.begin(), Values.end(), ConstantIntOrdering());

View File

@ -222,7 +222,7 @@ static void fillTypeNameTable(const Module *M,
const Type *Ty = cast<Type>(TI->second);
if (!isa<PointerType>(Ty) ||
!cast<PointerType>(Ty)->getElementType()->isPrimitiveType() ||
!cast<PointerType>(Ty)->getElementType()->isIntegral() ||
!cast<PointerType>(Ty)->getElementType()->isInteger() ||
isa<OpaqueType>(cast<PointerType>(Ty)->getElementType()))
TypeNames.insert(std::make_pair(Ty, getLLVMName(TI->first)));
}
@ -234,7 +234,7 @@ static void calcTypeName(const Type *Ty,
std::vector<const Type *> &TypeStack,
std::map<const Type *, std::string> &TypeNames,
std::string & Result){
if (Ty->isIntegral() || (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty))) {
if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty))) {
Result += Ty->getDescription(); // Base case
return;
}
@ -353,7 +353,7 @@ static std::ostream &printTypeInt(std::ostream &Out, const Type *Ty,
// Primitive types always print out their description, regardless of whether
// they have been named or not.
//
if (Ty->isIntegral() || (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty)))
if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty)))
return Out << Ty->getDescription();
// Check to see if the type is named.

View File

@ -51,7 +51,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
// If the src and dest elements are both integers, or both floats, we can
// just BitCast each element because the elements are the same size.
if ((SrcEltTy->isIntegral() && DstEltTy->isIntegral()) ||
if ((SrcEltTy->isInteger() && DstEltTy->isInteger()) ||
(SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) {
for (unsigned i = 0; i != SrcNumElts; ++i)
Result.push_back(
@ -60,7 +60,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
}
// If this is an int-to-fp cast ..
if (SrcEltTy->isIntegral()) {
if (SrcEltTy->isInteger()) {
// Ensure that it is int-to-fp cast
assert(DstEltTy->isFloatingPoint());
if (DstEltTy->getTypeID() == Type::DoubleTyID) {
@ -81,7 +81,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
}
// Otherwise, this is an fp-to-int cast.
assert(SrcEltTy->isFloatingPoint() && DstEltTy->isIntegral());
assert(SrcEltTy->isFloatingPoint() && DstEltTy->isInteger());
if (SrcEltTy->getTypeID() == Type::DoubleTyID) {
for (unsigned i = 0; i != SrcNumElts; ++i) {
@ -279,7 +279,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
// Handle integral constant input.
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
// Integral -> Integral, must be changing sign.
if (DestTy->isIntegral())
if (DestTy->isInteger())
return ConstantInt::get(DestTy, CI->getZExtValue());
if (DestTy->isFloatingPoint()) {
@ -295,7 +295,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
// Handle ConstantFP input.
if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
// FP -> Integral.
if (DestTy->isIntegral()) {
if (DestTy->isInteger()) {
if (DestTy == Type::Int32Ty)
return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
assert(DestTy == Type::Int64Ty &&
@ -884,7 +884,7 @@ static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1,
// If the cast is not actually changing bits, and the second operand is a
// null pointer, do the comparison with the pre-casted value.
if (V2->isNullValue() &&
(isa<PointerType>(CE1->getType()) || CE1->getType()->isIntegral())) {
(isa<PointerType>(CE1->getType()) || CE1->getType()->isInteger())) {
bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false :
(CE1->getOpcode() == Instruction::SExt ? true :
(CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned));
@ -899,7 +899,7 @@ static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1,
if (const ConstantExpr *CE2 = dyn_cast<ConstantExpr>(V2))
if (CE2->isCast() && isa<PointerType>(CE1->getType()) &&
CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() &&
CE1->getOperand(0)->getType()->isIntegral()) {
CE1->getOperand(0)->getType()->isInteger()) {
bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false :
(CE1->getOpcode() == Instruction::SExt ? true :
(CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned));

View File

@ -849,7 +849,7 @@ ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) {
return getTrue();
else
return getFalse();
return IntConstants->getOrCreate(Ty, V & Ty->getIntegralTypeMask());
return IntConstants->getOrCreate(Ty, V & Ty->getIntegerTypeMask());
}
//---- ConstantFP::get() implementation...
@ -1463,16 +1463,16 @@ Constant *ConstantExpr::getTruncOrBitCast(Constant *C, const Type *Ty) {
Constant *ConstantExpr::getPointerCast(Constant *S, const Type *Ty) {
assert(isa<PointerType>(S->getType()) && "Invalid cast");
assert((Ty->isIntegral() || isa<PointerType>(Ty)) && "Invalid cast");
assert((Ty->isInteger() || isa<PointerType>(Ty)) && "Invalid cast");
if (Ty->isIntegral())
if (Ty->isInteger())
return getCast(Instruction::PtrToInt, S, Ty);
return getCast(Instruction::BitCast, S, Ty);
}
Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty,
bool isSigned) {
assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast");
assert(C->getType()->isInteger() && Ty->isInteger() && "Invalid cast");
unsigned SrcBits = C->getType()->getPrimitiveSizeInBits();
unsigned DstBits = Ty->getPrimitiveSizeInBits();
Instruction::CastOps opcode =
@ -1495,8 +1495,8 @@ Constant *ConstantExpr::getFPCast(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && "Trunc operand must be integer");
assert(Ty->isIntegral() && "Trunc produces only integral");
assert(C->getType()->isInteger() && "Trunc operand must be integer");
assert(Ty->isInteger() && "Trunc produces only integral");
assert(C->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits()&&
"SrcTy must be larger than DestTy for Trunc!");
@ -1504,8 +1504,8 @@ Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && "SEXt operand must be integral");
assert(Ty->isIntegral() && "SExt produces only integer");
assert(C->getType()->isInteger() && "SEXt operand must be integral");
assert(Ty->isInteger() && "SExt produces only integer");
assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&&
"SrcTy must be smaller than DestTy for SExt!");
@ -1513,8 +1513,8 @@ Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && "ZEXt operand must be integral");
assert(Ty->isIntegral() && "ZExt produces only integer");
assert(C->getType()->isInteger() && "ZEXt operand must be integral");
assert(Ty->isInteger() && "ZExt produces only integer");
assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&&
"SrcTy must be smaller than DestTy for ZExt!");
@ -1536,37 +1536,37 @@ Constant *ConstantExpr::getFPExtend(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getUIToFP(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && Ty->isFloatingPoint() &&
assert(C->getType()->isInteger() && Ty->isFloatingPoint() &&
"This is an illegal uint to floating point cast!");
return getFoldedCast(Instruction::UIToFP, C, Ty);
}
Constant *ConstantExpr::getSIToFP(Constant *C, const Type *Ty) {
assert(C->getType()->isIntegral() && Ty->isFloatingPoint() &&
assert(C->getType()->isInteger() && Ty->isFloatingPoint() &&
"This is an illegal sint to floating point cast!");
return getFoldedCast(Instruction::SIToFP, C, Ty);
}
Constant *ConstantExpr::getFPToUI(Constant *C, const Type *Ty) {
assert(C->getType()->isFloatingPoint() && Ty->isIntegral() &&
assert(C->getType()->isFloatingPoint() && Ty->isInteger() &&
"This is an illegal floating point to uint cast!");
return getFoldedCast(Instruction::FPToUI, C, Ty);
}
Constant *ConstantExpr::getFPToSI(Constant *C, const Type *Ty) {
assert(C->getType()->isFloatingPoint() && Ty->isIntegral() &&
assert(C->getType()->isFloatingPoint() && Ty->isInteger() &&
"This is an illegal floating point to sint cast!");
return getFoldedCast(Instruction::FPToSI, C, Ty);
}
Constant *ConstantExpr::getPtrToInt(Constant *C, const Type *DstTy) {
assert(isa<PointerType>(C->getType()) && "PtrToInt source must be pointer");
assert(DstTy->isIntegral() && "PtrToInt destination must be integral");
assert(DstTy->isInteger() && "PtrToInt destination must be integral");
return getFoldedCast(Instruction::PtrToInt, C, DstTy);
}
Constant *ConstantExpr::getIntToPtr(Constant *C, const Type *DstTy) {
assert(C->getType()->isIntegral() && "IntToPtr source must be integral");
assert(C->getType()->isInteger() && "IntToPtr source must be integral");
assert(isa<PointerType>(DstTy) && "IntToPtr destination must be a pointer");
return getFoldedCast(Instruction::IntToPtr, C, DstTy);
}
@ -1649,15 +1649,15 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
case Instruction::Sub:
case Instruction::Mul:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isIntegral() || C1->getType()->isFloatingPoint() ||
assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() ||
isa<PackedType>(C1->getType())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::UDiv:
case Instruction::SDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isIntegral() || (isa<PackedType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isIntegral())) &&
assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isInteger())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::FDiv:
@ -1669,8 +1669,8 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
case Instruction::URem:
case Instruction::SRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isIntegral() || (isa<PackedType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isIntegral())) &&
assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isInteger())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::FRem:
@ -1683,14 +1683,14 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
case Instruction::Or:
case Instruction::Xor:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isIntegral() || isa<PackedType>(C1->getType())) &&
assert((C1->getType()->isInteger() || isa<PackedType>(C1->getType())) &&
"Tried to create a logical operation on a non-integral type!");
break;
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
assert(C2->getType() == Type::Int8Ty && "Shift should be by ubyte!");
assert(C1->getType()->isIntegral() &&
assert(C1->getType()->isInteger() &&
"Tried to create a shift operation on a non-integer type!");
break;
default:
@ -1732,7 +1732,7 @@ Constant *ConstantExpr::getShiftTy(const Type *ReqTy, unsigned Opcode,
Opcode == Instruction::LShr ||
Opcode == Instruction::AShr) &&
"Invalid opcode in binary constant expression");
assert(C1->getType()->isIntegral() && C2->getType() == Type::Int8Ty &&
assert(C1->getType()->isInteger() && C2->getType() == Type::Int8Ty &&
"Invalid operand types for Shift constant expr!");
if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2))

View File

@ -1025,7 +1025,7 @@ void BinaryOperator::init(BinaryOps iType)
case Mul:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isIntegral() || getType()->isFloatingPoint() ||
assert((getType()->isInteger() || getType()->isFloatingPoint() ||
isa<PackedType>(getType())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
@ -1033,8 +1033,8 @@ void BinaryOperator::init(BinaryOps iType)
case SDiv:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isIntegral() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isIntegral())) &&
assert((getType()->isInteger() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) &&
"Incorrect operand type (not integer) for S/UDIV");
break;
case FDiv:
@ -1048,8 +1048,8 @@ void BinaryOperator::init(BinaryOps iType)
case SRem:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isIntegral() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isIntegral())) &&
assert((getType()->isInteger() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) &&
"Incorrect operand type (not integer) for S/UREM");
break;
case FRem:
@ -1063,9 +1063,9 @@ void BinaryOperator::init(BinaryOps iType)
case Xor:
assert(getType() == LHS->getType() &&
"Logical operation should return same type as operands!");
assert((getType()->isIntegral() ||
assert((getType()->isInteger() ||
(isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isIntegral())) &&
cast<PackedType>(getType())->getElementType()->isInteger())) &&
"Tried to create a logical operation on a non-integral type!");
break;
default:
@ -1218,7 +1218,7 @@ bool CastInst::isIntegerCast() const {
case Instruction::Trunc:
return true;
case Instruction::BitCast:
return getOperand(0)->getType()->isIntegral() && getType()->isIntegral();
return getOperand(0)->getType()->isInteger() && getType()->isInteger();
}
}
@ -1351,7 +1351,7 @@ unsigned CastInst::isEliminableCastPair(
case 3:
// no-op cast in second op implies firstOp as long as the DestTy
// is integer
if (DstTy->isIntegral())
if (DstTy->isInteger())
return firstOp;
return 0;
case 4:
@ -1363,7 +1363,7 @@ unsigned CastInst::isEliminableCastPair(
case 5:
// no-op cast in first op implies secondOp as long as the SrcTy
// is an integer
if (SrcTy->isIntegral())
if (SrcTy->isInteger())
return secondOp;
return 0;
case 6:
@ -1528,10 +1528,10 @@ CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
const std::string &Name,
BasicBlock *InsertAtEnd) {
assert(isa<PointerType>(S->getType()) && "Invalid cast");
assert((Ty->isIntegral() || isa<PointerType>(Ty)) &&
assert((Ty->isInteger() || isa<PointerType>(Ty)) &&
"Invalid cast");
if (Ty->isIntegral())
if (Ty->isInteger())
return create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
return create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
}
@ -1541,10 +1541,10 @@ CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
const std::string &Name,
Instruction *InsertBefore) {
assert(isa<PointerType>(S->getType()) && "Invalid cast");
assert((Ty->isIntegral() || isa<PointerType>(Ty)) &&
assert((Ty->isInteger() || isa<PointerType>(Ty)) &&
"Invalid cast");
if (Ty->isIntegral())
if (Ty->isInteger())
return create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
return create(Instruction::BitCast, S, Ty, Name, InsertBefore);
}
@ -1552,7 +1552,7 @@ CastInst *CastInst::createPointerCast(Value *S, const Type *Ty,
CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
bool isSigned, const std::string &Name,
Instruction *InsertBefore) {
assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast");
assert(C->getType()->isInteger() && Ty->isInteger() && "Invalid cast");
unsigned SrcBits = C->getType()->getPrimitiveSizeInBits();
unsigned DstBits = Ty->getPrimitiveSizeInBits();
Instruction::CastOps opcode =
@ -1565,7 +1565,7 @@ CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty,
bool isSigned, const std::string &Name,
BasicBlock *InsertAtEnd) {
assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast");
assert(C->getType()->isInteger() && Ty->isInteger() && "Invalid cast");
unsigned SrcBits = C->getType()->getPrimitiveSizeInBits();
unsigned DstBits = Ty->getPrimitiveSizeInBits();
Instruction::CastOps opcode =
@ -1616,8 +1616,8 @@ CastInst::getCastOpcode(
unsigned DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr/packed
// Run through the possibilities ...
if (DestTy->isIntegral()) { // Casting to integral
if (SrcTy->isIntegral()) { // Casting from integral
if (DestTy->isInteger()) { // Casting to integral
if (SrcTy->isInteger()) { // Casting from integral
if (DestBits < SrcBits)
return Trunc; // int -> smaller int
else if (DestBits > SrcBits) { // its an extension
@ -1643,7 +1643,7 @@ CastInst::getCastOpcode(
return PtrToInt; // ptr -> int
}
} else if (DestTy->isFloatingPoint()) { // Casting to floating pt
if (SrcTy->isIntegral()) { // Casting from integral
if (SrcTy->isInteger()) { // Casting from integral
if (SrcIsSigned)
return SIToFP; // sint -> FP
else
@ -1676,7 +1676,7 @@ CastInst::getCastOpcode(
} else if (isa<PointerType>(DestTy)) {
if (isa<PointerType>(SrcTy)) {
return BitCast; // ptr -> ptr
} else if (SrcTy->isIntegral()) {
} else if (SrcTy->isInteger()) {
return IntToPtr; // int -> ptr
} else {
assert(!"Casting pointer to other than pointer or int");
@ -1715,11 +1715,11 @@ checkCast(Instruction::CastOps op, Value *S, const Type *DstTy) {
switch (op) {
default: return false; // This is an input error
case Instruction::Trunc:
return SrcTy->isIntegral() && DstTy->isIntegral()&& SrcBitSize > DstBitSize;
return SrcTy->isInteger() && DstTy->isInteger()&& SrcBitSize > DstBitSize;
case Instruction::ZExt:
return SrcTy->isIntegral() && DstTy->isIntegral()&& SrcBitSize < DstBitSize;
return SrcTy->isInteger() && DstTy->isInteger()&& SrcBitSize < DstBitSize;
case Instruction::SExt:
return SrcTy->isIntegral() && DstTy->isIntegral()&& SrcBitSize < DstBitSize;
return SrcTy->isInteger() && DstTy->isInteger()&& SrcBitSize < DstBitSize;
case Instruction::FPTrunc:
return SrcTy->isFloatingPoint() && DstTy->isFloatingPoint() &&
SrcBitSize > DstBitSize;
@ -1727,17 +1727,17 @@ checkCast(Instruction::CastOps op, Value *S, const Type *DstTy) {
return SrcTy->isFloatingPoint() && DstTy->isFloatingPoint() &&
SrcBitSize < DstBitSize;
case Instruction::UIToFP:
return SrcTy->isIntegral() && DstTy->isFloatingPoint();
return SrcTy->isInteger() && DstTy->isFloatingPoint();
case Instruction::SIToFP:
return SrcTy->isIntegral() && DstTy->isFloatingPoint();
return SrcTy->isInteger() && DstTy->isFloatingPoint();
case Instruction::FPToUI:
return SrcTy->isFloatingPoint() && DstTy->isIntegral();
return SrcTy->isFloatingPoint() && DstTy->isInteger();
case Instruction::FPToSI:
return SrcTy->isFloatingPoint() && DstTy->isIntegral();
return SrcTy->isFloatingPoint() && DstTy->isInteger();
case Instruction::PtrToInt:
return isa<PointerType>(SrcTy) && DstTy->isIntegral();
return isa<PointerType>(SrcTy) && DstTy->isInteger();
case Instruction::IntToPtr:
return SrcTy->isIntegral() && isa<PointerType>(DstTy);
return SrcTy->isInteger() && isa<PointerType>(DstTy);
case Instruction::BitCast:
// BitCast implies a no-op cast of type only. No bits change.
// However, you can't cast pointers to anything but pointers.
@ -1913,9 +1913,9 @@ CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
assert(Op0Ty == Op1Ty &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
assert(Op0Ty->isIntegral() || isa<PointerType>(Op0Ty) ||
assert(Op0Ty->isInteger() || isa<PointerType>(Op0Ty) ||
(isa<PackedType>(Op0Ty) &&
cast<PackedType>(Op0Ty)->getElementType()->isIntegral()) &&
cast<PackedType>(Op0Ty)->getElementType()->isInteger()) &&
"Invalid operand types for ICmp instruction");
return;
}
@ -1948,9 +1948,9 @@ CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
assert(Op0Ty == Op1Ty &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
assert(Op0Ty->isIntegral() || isa<PointerType>(Op0Ty) ||
assert(Op0Ty->isInteger() || isa<PointerType>(Op0Ty) ||
(isa<PackedType>(Op0Ty) &&
cast<PackedType>(Op0Ty)->getElementType()->isIntegral()) &&
cast<PackedType>(Op0Ty)->getElementType()->isInteger()) &&
"Invalid operand types for ICmp instruction");
return;
}

View File

@ -428,7 +428,7 @@ PackedType::PackedType(const Type *ElType, unsigned NumEl)
NumElements = NumEl;
assert(NumEl > 0 && "NumEl of a PackedType must be greater than 0");
assert((ElType->isIntegral() || ElType->isFloatingPoint()) &&
assert((ElType->isInteger() || ElType->isFloatingPoint()) &&
"Elements of a PackedType must be a primitive type");
}

View File

@ -500,8 +500,8 @@ void Verifier::visitTruncInst(TruncInst &I) {
unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits();
unsigned DestBitSize = DestTy->getPrimitiveSizeInBits();
Assert1(SrcTy->isIntegral(), "Trunc only operates on integer", &I);
Assert1(DestTy->isIntegral(), "Trunc only produces integer", &I);
Assert1(SrcTy->isInteger(), "Trunc only operates on integer", &I);
Assert1(DestTy->isInteger(), "Trunc only produces integer", &I);
Assert1(SrcBitSize > DestBitSize,"DestTy too big for Trunc", &I);
visitInstruction(I);
@ -513,8 +513,8 @@ void Verifier::visitZExtInst(ZExtInst &I) {
const Type *DestTy = I.getType();
// Get the size of the types in bits, we'll need this later
Assert1(SrcTy->isIntegral(), "ZExt only operates on integer", &I);
Assert1(DestTy->isIntegral(), "ZExt only produces an integer", &I);
Assert1(SrcTy->isInteger(), "ZExt only operates on integer", &I);
Assert1(DestTy->isInteger(), "ZExt only produces an integer", &I);
unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits();
unsigned DestBitSize = DestTy->getPrimitiveSizeInBits();
@ -532,8 +532,8 @@ void Verifier::visitSExtInst(SExtInst &I) {
unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits();
unsigned DestBitSize = DestTy->getPrimitiveSizeInBits();
Assert1(SrcTy->isIntegral(), "SExt only operates on integer", &I);
Assert1(DestTy->isIntegral(), "SExt only produces an integer", &I);
Assert1(SrcTy->isInteger(), "SExt only operates on integer", &I);
Assert1(DestTy->isInteger(), "SExt only produces an integer", &I);
Assert1(SrcBitSize < DestBitSize,"Type too small for SExt", &I);
visitInstruction(I);
@ -575,7 +575,7 @@ void Verifier::visitUIToFPInst(UIToFPInst &I) {
const Type *SrcTy = I.getOperand(0)->getType();
const Type *DestTy = I.getType();
Assert1(SrcTy->isIntegral(),"UInt2FP source must be integral", &I);
Assert1(SrcTy->isInteger(),"UInt2FP source must be integral", &I);
Assert1(DestTy->isFloatingPoint(),"UInt2FP result must be FP", &I);
visitInstruction(I);
@ -586,7 +586,7 @@ void Verifier::visitSIToFPInst(SIToFPInst &I) {
const Type *SrcTy = I.getOperand(0)->getType();
const Type *DestTy = I.getType();
Assert1(SrcTy->isIntegral(),"SInt2FP source must be integral", &I);
Assert1(SrcTy->isInteger(),"SInt2FP source must be integral", &I);
Assert1(DestTy->isFloatingPoint(),"SInt2FP result must be FP", &I);
visitInstruction(I);
@ -598,7 +598,7 @@ void Verifier::visitFPToUIInst(FPToUIInst &I) {
const Type *DestTy = I.getType();
Assert1(SrcTy->isFloatingPoint(),"FP2UInt source must be FP", &I);
Assert1(DestTy->isIntegral(),"FP2UInt result must be integral", &I);
Assert1(DestTy->isInteger(),"FP2UInt result must be integral", &I);
visitInstruction(I);
}
@ -609,7 +609,7 @@ void Verifier::visitFPToSIInst(FPToSIInst &I) {
const Type *DestTy = I.getType();
Assert1(SrcTy->isFloatingPoint(),"FPToSI source must be FP", &I);
Assert1(DestTy->isIntegral(),"FP2ToI result must be integral", &I);
Assert1(DestTy->isInteger(),"FP2ToI result must be integral", &I);
visitInstruction(I);
}
@ -620,7 +620,7 @@ void Verifier::visitPtrToIntInst(PtrToIntInst &I) {
const Type *DestTy = I.getType();
Assert1(isa<PointerType>(SrcTy), "PtrToInt source must be pointer", &I);
Assert1(DestTy->isIntegral(), "PtrToInt result must be integral", &I);
Assert1(DestTy->isInteger(), "PtrToInt result must be integral", &I);
visitInstruction(I);
}
@ -630,7 +630,7 @@ void Verifier::visitIntToPtrInst(IntToPtrInst &I) {
const Type *SrcTy = I.getOperand(0)->getType();
const Type *DestTy = I.getType();
Assert1(SrcTy->isIntegral(), "IntToPtr source must be an integral", &I);
Assert1(SrcTy->isInteger(), "IntToPtr source must be an integral", &I);
Assert1(isa<PointerType>(DestTy), "IntToPtr result must be a pointer",&I);
visitInstruction(I);
@ -716,9 +716,9 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
// Check that logical operators are only used with integral operands.
if (B.getOpcode() == Instruction::And || B.getOpcode() == Instruction::Or ||
B.getOpcode() == Instruction::Xor) {
Assert1(B.getType()->isIntegral() ||
Assert1(B.getType()->isInteger() ||
(isa<PackedType>(B.getType()) &&
cast<PackedType>(B.getType())->getElementType()->isIntegral()),
cast<PackedType>(B.getType())->getElementType()->isInteger()),
"Logical operators only work with integral types!", &B);
Assert1(B.getType() == B.getOperand(0)->getType(),
"Logical operators must have same type for operands and result!",
@ -728,7 +728,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
Assert1(B.getType() == B.getOperand(0)->getType(),
"Arithmetic operators must have same type for operands and result!",
&B);
Assert1(B.getType()->isIntegral() || B.getType()->isFloatingPoint() ||
Assert1(B.getType()->isInteger() || B.getType()->isFloatingPoint() ||
isa<PackedType>(B.getType()),
"Arithmetic operators must have integer, fp, or packed type!", &B);
}
@ -743,7 +743,7 @@ void Verifier::visitICmpInst(ICmpInst& IC) {
Assert1(Op0Ty == Op1Ty,
"Both operands to ICmp instruction are not of the same type!", &IC);
// Check that the operands are the right type
Assert1(Op0Ty->isIntegral() || isa<PointerType>(Op0Ty),
Assert1(Op0Ty->isInteger() || isa<PointerType>(Op0Ty),
"Invalid operand types for ICmp instruction", &IC);
visitInstruction(IC);
}
@ -761,7 +761,7 @@ void Verifier::visitFCmpInst(FCmpInst& FC) {
}
void Verifier::visitShiftInst(ShiftInst &SI) {
Assert1(SI.getType()->isIntegral(),
Assert1(SI.getType()->isInteger(),
"Shift must return an integer result!", &SI);
Assert1(SI.getType() == SI.getOperand(0)->getType(),
"Shift return type must be same as first operand!", &SI);

View File

@ -310,7 +310,7 @@ std::string
CppWriter::getCppName(const Type* Ty)
{
// First, handle the primitive types .. easy
if (Ty->isPrimitiveType() || Ty->isIntegral()) {
if (Ty->isPrimitiveType() || Ty->isInteger()) {
switch (Ty->getTypeID()) {
case Type::VoidTyID: return "Type::VoidTy";
case Type::IntegerTyID: {
@ -410,7 +410,7 @@ CppWriter::printCppName(const Value* val) {
bool
CppWriter::printTypeInternal(const Type* Ty) {
// We don't print definitions for primitive types
if (Ty->isPrimitiveType() || Ty->isIntegral())
if (Ty->isPrimitiveType() || Ty->isInteger())
return false;
// If we already defined this type, we don't need to define it again.
@ -599,7 +599,7 @@ CppWriter::printTypes(const Module* M) {
// For primitive types and types already defined, just add a name
TypeMap::const_iterator TNI = TypeNames.find(TI->second);
if (TI->second->isIntegral() || TI->second->isPrimitiveType() ||
if (TI->second->isInteger() || TI->second->isPrimitiveType() ||
TNI != TypeNames.end()) {
Out << "mod->addTypeName(\"";
printEscapedString(TI->first);