mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-21 04:41:34 +00:00
Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! llvm-svn: 96223
This commit is contained in:
parent
6c7bdae8bd
commit
2acaf3609c
@ -2999,9 +2999,9 @@ the <tt>lib/VMCore</tt> directory.</p>
|
||||
<div class="doc_text">
|
||||
|
||||
<ul>
|
||||
<li><tt>bool isInteger() const</tt>: Returns true for any integer type.</li>
|
||||
<li><tt>bool isIntegerTy() const</tt>: Returns true for any integer type.</li>
|
||||
|
||||
<li><tt>bool isFloatingPoint()</tt>: Return true if this is one of the two
|
||||
<li><tt>bool isFloatingPointTy()</tt>: Return true if this is one of the five
|
||||
floating point types.</li>
|
||||
|
||||
<li><tt>bool isAbstract()</tt>: Return true if the type is abstract (contains
|
||||
|
@ -590,7 +590,7 @@ public:
|
||||
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
|
||||
"Both operands to ICmp instruction are not of the same type!");
|
||||
// Check that the operands are the right type
|
||||
assert((getOperand(0)->getType()->isIntOrIntVector() ||
|
||||
assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
|
||||
isa<PointerType>(getOperand(0)->getType())) &&
|
||||
"Invalid operand types for ICmp instruction");
|
||||
}
|
||||
@ -611,7 +611,7 @@ public:
|
||||
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
|
||||
"Both operands to ICmp instruction are not of the same type!");
|
||||
// Check that the operands are the right type
|
||||
assert((getOperand(0)->getType()->isIntOrIntVector() ||
|
||||
assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
|
||||
isa<PointerType>(getOperand(0)->getType())) &&
|
||||
"Invalid operand types for ICmp instruction");
|
||||
}
|
||||
@ -630,7 +630,7 @@ public:
|
||||
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
|
||||
"Both operands to ICmp instruction are not of the same type!");
|
||||
// Check that the operands are the right type
|
||||
assert((getOperand(0)->getType()->isIntOrIntVector() ||
|
||||
assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
|
||||
isa<PointerType>(getOperand(0)->getType())) &&
|
||||
"Invalid operand types for ICmp instruction");
|
||||
}
|
||||
@ -740,7 +740,7 @@ public:
|
||||
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
|
||||
"Both operands to FCmp instruction are not of the same type!");
|
||||
// Check that the operands are the right type
|
||||
assert(getOperand(0)->getType()->isFPOrFPVector() &&
|
||||
assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
|
||||
"Invalid operand types for FCmp instruction");
|
||||
}
|
||||
|
||||
@ -759,7 +759,7 @@ public:
|
||||
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
|
||||
"Both operands to FCmp instruction are not of the same type!");
|
||||
// Check that the operands are the right type
|
||||
assert(getOperand(0)->getType()->isFPOrFPVector() &&
|
||||
assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
|
||||
"Invalid operand types for FCmp instruction");
|
||||
}
|
||||
|
||||
@ -776,7 +776,7 @@ public:
|
||||
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
|
||||
"Both operands to FCmp instruction are not of the same type!");
|
||||
// Check that the operands are the right type
|
||||
assert(getOperand(0)->getType()->isFPOrFPVector() &&
|
||||
assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
|
||||
"Invalid operand types for FCmp instruction");
|
||||
}
|
||||
|
||||
|
@ -214,46 +214,46 @@ public:
|
||||
/// getDescription - Return the string representation of the type.
|
||||
std::string getDescription() const;
|
||||
|
||||
/// isInteger - True if this is an instance of IntegerType.
|
||||
/// isIntegerTy - True if this is an instance of IntegerType.
|
||||
///
|
||||
bool isInteger() const { return ID == IntegerTyID; }
|
||||
bool isIntegerTy() const { return ID == IntegerTyID; }
|
||||
|
||||
/// isInteger - Return true if this is an IntegerType of the specified width.
|
||||
bool isInteger(unsigned Bitwidth) const;
|
||||
/// isIntegerTy - Return true if this is an IntegerType of the given width.
|
||||
bool isIntegerTy(unsigned Bitwidth) const;
|
||||
|
||||
/// isIntOrIntVector - Return true if this is an integer type or a vector of
|
||||
/// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
|
||||
/// integer types.
|
||||
///
|
||||
bool isIntOrIntVector() const;
|
||||
bool isIntOrIntVectorTy() const;
|
||||
|
||||
/// isFloatingPoint - Return true if this is one of the five floating point
|
||||
/// isFloatingPointTy - Return true if this is one of the five floating point
|
||||
/// types
|
||||
bool isFloatingPoint() const { return ID == FloatTyID || ID == DoubleTyID ||
|
||||
bool isFloatingPointTy() const { return ID == FloatTyID || ID == DoubleTyID ||
|
||||
ID == X86_FP80TyID || ID == FP128TyID || ID == PPC_FP128TyID; }
|
||||
|
||||
/// isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
|
||||
/// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
|
||||
///
|
||||
bool isFPOrFPVector() const;
|
||||
bool isFPOrFPVectorTy() const;
|
||||
|
||||
/// isFunction - True if this is an instance of FunctionType.
|
||||
/// isFunctionTy - True if this is an instance of FunctionType.
|
||||
///
|
||||
bool isFunction() const { return ID == FunctionTyID; }
|
||||
bool isFunctionTy() const { return ID == FunctionTyID; }
|
||||
|
||||
/// isStruct - True if this is an instance of StructType.
|
||||
/// isStructTy - True if this is an instance of StructType.
|
||||
///
|
||||
bool isStruct() const { return ID == StructTyID; }
|
||||
bool isStructTy() const { return ID == StructTyID; }
|
||||
|
||||
/// isArray - True if this is an instance of ArrayType.
|
||||
/// isArrayTy - True if this is an instance of ArrayType.
|
||||
///
|
||||
bool isArray() const { return ID == ArrayTyID; }
|
||||
bool isArrayTy() const { return ID == ArrayTyID; }
|
||||
|
||||
/// isPointer - True if this is an instance of PointerType.
|
||||
/// isPointerTy - True if this is an instance of PointerType.
|
||||
///
|
||||
bool isPointer() const { return ID == PointerTyID; }
|
||||
bool isPointerTy() const { return ID == PointerTyID; }
|
||||
|
||||
/// isVector - True if this is an instance of VectorType.
|
||||
/// isVectorTy - True if this is an instance of VectorType.
|
||||
///
|
||||
bool isVector() const { return ID == VectorTyID; }
|
||||
bool isVectorTy() const { return ID == VectorTyID; }
|
||||
|
||||
/// isAbstract - True if the type is either an Opaque type, or is a derived
|
||||
/// type that includes an opaque type somewhere in it.
|
||||
@ -307,7 +307,7 @@ public:
|
||||
///
|
||||
bool isSized() const {
|
||||
// If it's a primitive, it is always sized.
|
||||
if (ID == IntegerTyID || isFloatingPoint() || ID == PointerTyID)
|
||||
if (ID == IntegerTyID || isFloatingPointTy() || 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.
|
||||
|
@ -80,7 +80,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
|
||||
|
||||
// First thing is first. We only want to think about integer here, so if
|
||||
// we have something in FP form, recast it as integer.
|
||||
if (DstEltTy->isFloatingPoint()) {
|
||||
if (DstEltTy->isFloatingPointTy()) {
|
||||
// Fold to an vector of integers with same size as our FP type.
|
||||
unsigned FPWidth = DstEltTy->getPrimitiveSizeInBits();
|
||||
const Type *DestIVTy =
|
||||
@ -95,7 +95,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
|
||||
|
||||
// Okay, we know the destination is integer, if the input is FP, convert
|
||||
// it to integer first.
|
||||
if (SrcEltTy->isFloatingPoint()) {
|
||||
if (SrcEltTy->isFloatingPointTy()) {
|
||||
unsigned FPWidth = SrcEltTy->getPrimitiveSizeInBits();
|
||||
const Type *SrcIVTy =
|
||||
VectorType::get(IntegerType::get(C->getContext(), FPWidth), NumSrcElt);
|
||||
|
@ -214,8 +214,8 @@ bool SCEVCastExpr::properlyDominates(BasicBlock *BB, DominatorTree *DT) const {
|
||||
SCEVTruncateExpr::SCEVTruncateExpr(const FoldingSetNodeID &ID,
|
||||
const SCEV *op, const Type *ty)
|
||||
: SCEVCastExpr(ID, scTruncate, op, ty) {
|
||||
assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((Op->getType()->isIntegerTy() || isa<PointerType>(Op->getType())) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot truncate non-integer value!");
|
||||
}
|
||||
|
||||
@ -226,8 +226,8 @@ void SCEVTruncateExpr::print(raw_ostream &OS) const {
|
||||
SCEVZeroExtendExpr::SCEVZeroExtendExpr(const FoldingSetNodeID &ID,
|
||||
const SCEV *op, const Type *ty)
|
||||
: SCEVCastExpr(ID, scZeroExtend, op, ty) {
|
||||
assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((Op->getType()->isIntegerTy() || isa<PointerType>(Op->getType())) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot zero extend non-integer value!");
|
||||
}
|
||||
|
||||
@ -238,8 +238,8 @@ void SCEVZeroExtendExpr::print(raw_ostream &OS) const {
|
||||
SCEVSignExtendExpr::SCEVSignExtendExpr(const FoldingSetNodeID &ID,
|
||||
const SCEV *op, const Type *ty)
|
||||
: SCEVCastExpr(ID, scSignExtend, op, ty) {
|
||||
assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((Op->getType()->isIntegerTy() || isa<PointerType>(Op->getType())) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot sign extend non-integer value!");
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ bool SCEVUnknown::isAlignOf(const Type *&AllocTy) const {
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(CE->getOperand(2)))
|
||||
if (CI->isOne() &&
|
||||
STy->getNumElements() == 2 &&
|
||||
STy->getElementType(0)->isInteger(1)) {
|
||||
STy->getElementType(0)->isIntegerTy(1)) {
|
||||
AllocTy = STy->getElementType(1);
|
||||
return true;
|
||||
}
|
||||
@ -2308,7 +2308,7 @@ const SCEV *ScalarEvolution::getUnknown(Value *V) {
|
||||
/// has access to target-specific information.
|
||||
bool ScalarEvolution::isSCEVable(const Type *Ty) const {
|
||||
// Integers and pointers are always SCEVable.
|
||||
return Ty->isInteger() || isa<PointerType>(Ty);
|
||||
return Ty->isIntegerTy() || isa<PointerType>(Ty);
|
||||
}
|
||||
|
||||
/// getTypeSizeInBits - Return the size in bits of the specified type,
|
||||
@ -2321,7 +2321,7 @@ uint64_t ScalarEvolution::getTypeSizeInBits(const Type *Ty) const {
|
||||
return TD->getTypeSizeInBits(Ty);
|
||||
|
||||
// Integer types have fixed sizes.
|
||||
if (Ty->isInteger())
|
||||
if (Ty->isIntegerTy())
|
||||
return Ty->getPrimitiveSizeInBits();
|
||||
|
||||
// The only other support type is pointer. Without TargetData, conservatively
|
||||
@ -2337,7 +2337,7 @@ uint64_t ScalarEvolution::getTypeSizeInBits(const Type *Ty) const {
|
||||
const Type *ScalarEvolution::getEffectiveSCEVType(const Type *Ty) const {
|
||||
assert(isSCEVable(Ty) && "Type is not SCEVable!");
|
||||
|
||||
if (Ty->isInteger())
|
||||
if (Ty->isIntegerTy())
|
||||
return Ty;
|
||||
|
||||
// The only other support type is pointer.
|
||||
@ -2412,8 +2412,8 @@ const SCEV *
|
||||
ScalarEvolution::getTruncateOrZeroExtend(const SCEV *V,
|
||||
const Type *Ty) {
|
||||
const Type *SrcTy = V->getType();
|
||||
assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot truncate or zero extend with non-integer arguments!");
|
||||
if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty))
|
||||
return V; // No conversion
|
||||
@ -2429,8 +2429,8 @@ const SCEV *
|
||||
ScalarEvolution::getTruncateOrSignExtend(const SCEV *V,
|
||||
const Type *Ty) {
|
||||
const Type *SrcTy = V->getType();
|
||||
assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot truncate or zero extend with non-integer arguments!");
|
||||
if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty))
|
||||
return V; // No conversion
|
||||
@ -2445,8 +2445,8 @@ ScalarEvolution::getTruncateOrSignExtend(const SCEV *V,
|
||||
const SCEV *
|
||||
ScalarEvolution::getNoopOrZeroExtend(const SCEV *V, const Type *Ty) {
|
||||
const Type *SrcTy = V->getType();
|
||||
assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot noop or zero extend with non-integer arguments!");
|
||||
assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) &&
|
||||
"getNoopOrZeroExtend cannot truncate!");
|
||||
@ -2461,8 +2461,8 @@ ScalarEvolution::getNoopOrZeroExtend(const SCEV *V, const Type *Ty) {
|
||||
const SCEV *
|
||||
ScalarEvolution::getNoopOrSignExtend(const SCEV *V, const Type *Ty) {
|
||||
const Type *SrcTy = V->getType();
|
||||
assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot noop or sign extend with non-integer arguments!");
|
||||
assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) &&
|
||||
"getNoopOrSignExtend cannot truncate!");
|
||||
@ -2478,8 +2478,8 @@ ScalarEvolution::getNoopOrSignExtend(const SCEV *V, const Type *Ty) {
|
||||
const SCEV *
|
||||
ScalarEvolution::getNoopOrAnyExtend(const SCEV *V, const Type *Ty) {
|
||||
const Type *SrcTy = V->getType();
|
||||
assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot noop or any extend with non-integer arguments!");
|
||||
assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) &&
|
||||
"getNoopOrAnyExtend cannot truncate!");
|
||||
@ -2493,8 +2493,8 @@ ScalarEvolution::getNoopOrAnyExtend(const SCEV *V, const Type *Ty) {
|
||||
const SCEV *
|
||||
ScalarEvolution::getTruncateOrNoop(const SCEV *V, const Type *Ty) {
|
||||
const Type *SrcTy = V->getType();
|
||||
assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
(Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Cannot truncate or noop with non-integer arguments!");
|
||||
assert(getTypeSizeInBits(SrcTy) >= getTypeSizeInBits(Ty) &&
|
||||
"getTruncateOrNoop cannot extend!");
|
||||
@ -3068,7 +3068,7 @@ ScalarEvolution::getSignedRange(const SCEV *S) {
|
||||
|
||||
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
|
||||
// For a SCEVUnknown, ask ValueTracking.
|
||||
if (!U->getValue()->getType()->isInteger() && !TD)
|
||||
if (!U->getValue()->getType()->isIntegerTy() && !TD)
|
||||
return ConservativeResult;
|
||||
unsigned NS = ComputeNumSignBits(U->getValue(), TD);
|
||||
if (NS == 1)
|
||||
@ -4450,7 +4450,7 @@ const SCEV *ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) {
|
||||
-StartC->getValue()->getValue(),
|
||||
*this);
|
||||
}
|
||||
} else if (AddRec->isQuadratic() && AddRec->getType()->isInteger()) {
|
||||
} else if (AddRec->isQuadratic() && AddRec->getType()->isIntegerTy()) {
|
||||
// If this is a quadratic (3-term) AddRec {L,+,M,+,N}, find the roots of
|
||||
// the quadratic equation to solve it.
|
||||
std::pair<const SCEV *,const SCEV *> Roots = SolveQuadraticEquation(AddRec,
|
||||
|
@ -1104,7 +1104,7 @@ void SCEVExpander::restoreInsertPoint(BasicBlock *BB, BasicBlock::iterator I) {
|
||||
Value *
|
||||
SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L,
|
||||
const Type *Ty) {
|
||||
assert(Ty->isInteger() && "Can only insert integer induction variables!");
|
||||
assert(Ty->isIntegerTy() && "Can only insert integer induction variables!");
|
||||
const SCEV *H = SE.getAddRecExpr(SE.getIntegerSCEV(0, Ty),
|
||||
SE.getIntegerSCEV(1, Ty), L);
|
||||
BasicBlock *SaveInsertBB = Builder.GetInsertBlock();
|
||||
|
@ -49,11 +49,11 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
|
||||
assert(V && "No Value?");
|
||||
assert(Depth <= MaxDepth && "Limit Search Depth");
|
||||
unsigned BitWidth = Mask.getBitWidth();
|
||||
assert((V->getType()->isIntOrIntVector() || isa<PointerType>(V->getType())) &&
|
||||
"Not integer or pointer type!");
|
||||
assert((V->getType()->isIntOrIntVectorTy() || isa<PointerType>(V->getType()))
|
||||
&& "Not integer or pointer type!");
|
||||
assert((!TD ||
|
||||
TD->getTypeSizeInBits(V->getType()->getScalarType()) == BitWidth) &&
|
||||
(!V->getType()->isIntOrIntVector() ||
|
||||
(!V->getType()->isIntOrIntVectorTy() ||
|
||||
V->getType()->getScalarSizeInBits() == BitWidth) &&
|
||||
KnownZero.getBitWidth() == BitWidth &&
|
||||
KnownOne.getBitWidth() == BitWidth &&
|
||||
@ -269,7 +269,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
|
||||
}
|
||||
case Instruction::BitCast: {
|
||||
const Type *SrcTy = I->getOperand(0)->getType();
|
||||
if ((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
|
||||
if ((SrcTy->isIntegerTy() || isa<PointerType>(SrcTy)) &&
|
||||
// TODO: For now, not handling conversions like:
|
||||
// (bitcast i64 %x to <2 x i32>)
|
||||
!isa<VectorType>(I->getType())) {
|
||||
@ -649,7 +649,7 @@ bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask,
|
||||
///
|
||||
unsigned llvm::ComputeNumSignBits(Value *V, const TargetData *TD,
|
||||
unsigned Depth) {
|
||||
assert((TD || V->getType()->isIntOrIntVector()) &&
|
||||
assert((TD || V->getType()->isIntOrIntVectorTy()) &&
|
||||
"ComputeNumSignBits requires a TargetData object to operate "
|
||||
"on non-integer values!");
|
||||
const Type *Ty = V->getType();
|
||||
@ -823,7 +823,7 @@ bool llvm::ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,
|
||||
|
||||
assert(V && "No Value?");
|
||||
assert(Depth <= MaxDepth && "Limit Search Depth");
|
||||
assert(V->getType()->isInteger() && "Not integer or pointer type!");
|
||||
assert(V->getType()->isIntegerTy() && "Not integer or pointer type!");
|
||||
|
||||
const Type *T = V->getType();
|
||||
|
||||
@ -1372,7 +1372,7 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
|
||||
// Make sure the index-ee is a pointer to array of i8.
|
||||
const PointerType *PT = cast<PointerType>(GEP->getOperand(0)->getType());
|
||||
const ArrayType *AT = dyn_cast<ArrayType>(PT->getElementType());
|
||||
if (AT == 0 || !AT->getElementType()->isInteger(8))
|
||||
if (AT == 0 || !AT->getElementType()->isIntegerTy(8))
|
||||
return false;
|
||||
|
||||
// Check to make sure that the first operand of the GEP is an integer and
|
||||
@ -1411,7 +1411,7 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
|
||||
|
||||
// Must be a Constant Array
|
||||
ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
|
||||
if (Array == 0 || !Array->getType()->getElementType()->isInteger(8))
|
||||
if (Array == 0 || !Array->getType()->getElementType()->isIntegerTy(8))
|
||||
return false;
|
||||
|
||||
// Get the number of elements in the array
|
||||
|
@ -2057,8 +2057,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
if (Elts.empty())
|
||||
return Error(ID.Loc, "constant vector must not be empty");
|
||||
|
||||
if (!Elts[0]->getType()->isInteger() &&
|
||||
!Elts[0]->getType()->isFloatingPoint())
|
||||
if (!Elts[0]->getType()->isIntegerTy() &&
|
||||
!Elts[0]->getType()->isFloatingPointTy())
|
||||
return Error(FirstEltLoc,
|
||||
"vector elements must have integer or floating point type");
|
||||
|
||||
@ -2250,12 +2250,12 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
CmpInst::Predicate Pred = (CmpInst::Predicate)PredVal;
|
||||
|
||||
if (Opc == Instruction::FCmp) {
|
||||
if (!Val0->getType()->isFPOrFPVector())
|
||||
if (!Val0->getType()->isFPOrFPVectorTy())
|
||||
return Error(ID.Loc, "fcmp requires floating point operands");
|
||||
ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1);
|
||||
} else {
|
||||
assert(Opc == Instruction::ICmp && "Unexpected opcode for CmpInst!");
|
||||
if (!Val0->getType()->isIntOrIntVector() &&
|
||||
if (!Val0->getType()->isIntOrIntVectorTy() &&
|
||||
!isa<PointerType>(Val0->getType()))
|
||||
return Error(ID.Loc, "icmp requires pointer or integer operands");
|
||||
ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1);
|
||||
@ -2306,7 +2306,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
return true;
|
||||
if (Val0->getType() != Val1->getType())
|
||||
return Error(ID.Loc, "operands of constexpr must have same type");
|
||||
if (!Val0->getType()->isIntOrIntVector()) {
|
||||
if (!Val0->getType()->isIntOrIntVectorTy()) {
|
||||
if (NUW)
|
||||
return Error(ModifierLoc, "nuw only applies to integer operations");
|
||||
if (NSW)
|
||||
@ -2314,8 +2314,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
}
|
||||
// API compatibility: Accept either integer or floating-point types with
|
||||
// add, sub, and mul.
|
||||
if (!Val0->getType()->isIntOrIntVector() &&
|
||||
!Val0->getType()->isFPOrFPVector())
|
||||
if (!Val0->getType()->isIntOrIntVectorTy() &&
|
||||
!Val0->getType()->isFPOrFPVectorTy())
|
||||
return Error(ID.Loc,"constexpr requires integer, fp, or vector operands");
|
||||
unsigned Flags = 0;
|
||||
if (NUW) Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
|
||||
@ -2345,7 +2345,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
|
||||
return true;
|
||||
if (Val0->getType() != Val1->getType())
|
||||
return Error(ID.Loc, "operands of constexpr must have same type");
|
||||
if (!Val0->getType()->isIntOrIntVector())
|
||||
if (!Val0->getType()->isIntOrIntVectorTy())
|
||||
return Error(ID.Loc,
|
||||
"constexpr requires integer or integer vector operands");
|
||||
ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1);
|
||||
@ -2515,7 +2515,7 @@ bool LLParser::ConvertValIDToValue(const Type *Ty, ValID &ID, Value *&V,
|
||||
V = ConstantInt::get(Context, ID.APSIntVal);
|
||||
return false;
|
||||
case ValID::t_APFloat:
|
||||
if (!Ty->isFloatingPoint() ||
|
||||
if (!Ty->isFloatingPointTy() ||
|
||||
!ConstantFP::isValueValidForType(Ty, ID.APFloatVal))
|
||||
return Error(ID.Loc, "floating point constant invalid for type");
|
||||
|
||||
@ -2963,7 +2963,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
|
||||
// API compatibility: Accept either integer or floating-point types.
|
||||
bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 0);
|
||||
if (!Result) {
|
||||
if (!Inst->getType()->isIntOrIntVector()) {
|
||||
if (!Inst->getType()->isIntOrIntVectorTy()) {
|
||||
if (NUW)
|
||||
return Error(ModifierLoc, "nuw only applies to integer operations");
|
||||
if (NSW)
|
||||
@ -3382,11 +3382,11 @@ bool LLParser::ParseArithmetic(Instruction *&Inst, PerFunctionState &PFS,
|
||||
switch (OperandType) {
|
||||
default: llvm_unreachable("Unknown operand type!");
|
||||
case 0: // int or FP.
|
||||
Valid = LHS->getType()->isIntOrIntVector() ||
|
||||
LHS->getType()->isFPOrFPVector();
|
||||
Valid = LHS->getType()->isIntOrIntVectorTy() ||
|
||||
LHS->getType()->isFPOrFPVectorTy();
|
||||
break;
|
||||
case 1: Valid = LHS->getType()->isIntOrIntVector(); break;
|
||||
case 2: Valid = LHS->getType()->isFPOrFPVector(); break;
|
||||
case 1: Valid = LHS->getType()->isIntOrIntVectorTy(); break;
|
||||
case 2: Valid = LHS->getType()->isFPOrFPVectorTy(); break;
|
||||
}
|
||||
|
||||
if (!Valid)
|
||||
@ -3406,7 +3406,7 @@ bool LLParser::ParseLogical(Instruction *&Inst, PerFunctionState &PFS,
|
||||
ParseValue(LHS->getType(), RHS, PFS))
|
||||
return true;
|
||||
|
||||
if (!LHS->getType()->isIntOrIntVector())
|
||||
if (!LHS->getType()->isIntOrIntVectorTy())
|
||||
return Error(Loc,"instruction requires integer or integer vector operands");
|
||||
|
||||
Inst = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
|
||||
@ -3430,12 +3430,12 @@ bool LLParser::ParseCompare(Instruction *&Inst, PerFunctionState &PFS,
|
||||
return true;
|
||||
|
||||
if (Opc == Instruction::FCmp) {
|
||||
if (!LHS->getType()->isFPOrFPVector())
|
||||
if (!LHS->getType()->isFPOrFPVectorTy())
|
||||
return Error(Loc, "fcmp requires floating point operands");
|
||||
Inst = new FCmpInst(CmpInst::Predicate(Pred), LHS, RHS);
|
||||
} else {
|
||||
assert(Opc == Instruction::ICmp && "Unknown opcode for CmpInst!");
|
||||
if (!LHS->getType()->isIntOrIntVector() &&
|
||||
if (!LHS->getType()->isIntOrIntVectorTy() &&
|
||||
!isa<PointerType>(LHS->getType()))
|
||||
return Error(Loc, "icmp requires integer operands");
|
||||
Inst = new ICmpInst(CmpInst::Predicate(Pred), LHS, RHS);
|
||||
@ -3733,7 +3733,7 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS,
|
||||
}
|
||||
}
|
||||
|
||||
if (Size && !Size->getType()->isInteger(32))
|
||||
if (Size && !Size->getType()->isIntegerTy(32))
|
||||
return Error(SizeLoc, "element count must be i32");
|
||||
|
||||
if (isAlloca) {
|
||||
|
@ -108,17 +108,17 @@ static int GetDecodedBinaryOpcode(unsigned Val, const Type *Ty) {
|
||||
switch (Val) {
|
||||
default: return -1;
|
||||
case bitc::BINOP_ADD:
|
||||
return Ty->isFPOrFPVector() ? Instruction::FAdd : Instruction::Add;
|
||||
return Ty->isFPOrFPVectorTy() ? Instruction::FAdd : Instruction::Add;
|
||||
case bitc::BINOP_SUB:
|
||||
return Ty->isFPOrFPVector() ? Instruction::FSub : Instruction::Sub;
|
||||
return Ty->isFPOrFPVectorTy() ? Instruction::FSub : Instruction::Sub;
|
||||
case bitc::BINOP_MUL:
|
||||
return Ty->isFPOrFPVector() ? Instruction::FMul : Instruction::Mul;
|
||||
return Ty->isFPOrFPVectorTy() ? Instruction::FMul : Instruction::Mul;
|
||||
case bitc::BINOP_UDIV: return Instruction::UDiv;
|
||||
case bitc::BINOP_SDIV:
|
||||
return Ty->isFPOrFPVector() ? Instruction::FDiv : Instruction::SDiv;
|
||||
return Ty->isFPOrFPVectorTy() ? Instruction::FDiv : Instruction::SDiv;
|
||||
case bitc::BINOP_UREM: return Instruction::URem;
|
||||
case bitc::BINOP_SREM:
|
||||
return Ty->isFPOrFPVector() ? Instruction::FRem : Instruction::SRem;
|
||||
return Ty->isFPOrFPVectorTy() ? Instruction::FRem : Instruction::SRem;
|
||||
case bitc::BINOP_SHL: return Instruction::Shl;
|
||||
case bitc::BINOP_LSHR: return Instruction::LShr;
|
||||
case bitc::BINOP_ASHR: return Instruction::AShr;
|
||||
@ -1175,7 +1175,7 @@ bool BitcodeReader::ParseConstants() {
|
||||
Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
|
||||
Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy);
|
||||
|
||||
if (OpTy->isFPOrFPVector())
|
||||
if (OpTy->isFPOrFPVectorTy())
|
||||
V = ConstantExpr::getFCmp(Record[3], Op0, Op1);
|
||||
else
|
||||
V = ConstantExpr::getICmp(Record[3], Op0, Op1);
|
||||
@ -1892,7 +1892,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
OpNum+1 != Record.size())
|
||||
return Error("Invalid CMP record");
|
||||
|
||||
if (LHS->getType()->isFPOrFPVector())
|
||||
if (LHS->getType()->isFPOrFPVectorTy())
|
||||
I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);
|
||||
else
|
||||
I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
|
||||
|
@ -155,7 +155,7 @@ void IntrinsicLowering::AddPrototypes(Module &M) {
|
||||
/// LowerBSWAP - Emit the code to lower bswap of V before the specified
|
||||
/// instruction IP.
|
||||
static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) {
|
||||
assert(V->getType()->isInteger() && "Can't bswap a non-integer type!");
|
||||
assert(V->getType()->isIntegerTy() && "Can't bswap a non-integer type!");
|
||||
|
||||
unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
|
||||
|
||||
@ -251,7 +251,7 @@ static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) {
|
||||
/// LowerCTPOP - Emit the code to lower ctpop of V before the specified
|
||||
/// instruction IP.
|
||||
static Value *LowerCTPOP(LLVMContext &Context, Value *V, Instruction *IP) {
|
||||
assert(V->getType()->isInteger() && "Can't ctpop a non-integer type!");
|
||||
assert(V->getType()->isIntegerTy() && "Can't ctpop a non-integer type!");
|
||||
|
||||
static const uint64_t MaskValues[6] = {
|
||||
0x5555555555555555ULL, 0x3333333333333333ULL,
|
||||
|
@ -4631,7 +4631,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
|
||||
StringRef Name = F->getName();
|
||||
if (Name == "copysign" || Name == "copysignf") {
|
||||
if (I.getNumOperands() == 3 && // Basic sanity checks.
|
||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
||||
I.getOperand(1)->getType()->isFloatingPointTy() &&
|
||||
I.getType() == I.getOperand(1)->getType() &&
|
||||
I.getType() == I.getOperand(2)->getType()) {
|
||||
SDValue LHS = getValue(I.getOperand(1));
|
||||
@ -4642,7 +4642,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
|
||||
}
|
||||
} else if (Name == "fabs" || Name == "fabsf" || Name == "fabsl") {
|
||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
||||
I.getOperand(1)->getType()->isFloatingPointTy() &&
|
||||
I.getType() == I.getOperand(1)->getType()) {
|
||||
SDValue Tmp = getValue(I.getOperand(1));
|
||||
setValue(&I, DAG.getNode(ISD::FABS, getCurDebugLoc(),
|
||||
@ -4651,7 +4651,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
|
||||
}
|
||||
} else if (Name == "sin" || Name == "sinf" || Name == "sinl") {
|
||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
||||
I.getOperand(1)->getType()->isFloatingPointTy() &&
|
||||
I.getType() == I.getOperand(1)->getType() &&
|
||||
I.onlyReadsMemory()) {
|
||||
SDValue Tmp = getValue(I.getOperand(1));
|
||||
@ -4661,7 +4661,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
|
||||
}
|
||||
} else if (Name == "cos" || Name == "cosf" || Name == "cosl") {
|
||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
||||
I.getOperand(1)->getType()->isFloatingPointTy() &&
|
||||
I.getType() == I.getOperand(1)->getType() &&
|
||||
I.onlyReadsMemory()) {
|
||||
SDValue Tmp = getValue(I.getOperand(1));
|
||||
@ -4671,7 +4671,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
|
||||
}
|
||||
} else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") {
|
||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
||||
I.getOperand(1)->getType()->isFloatingPointTy() &&
|
||||
I.getType() == I.getOperand(1)->getType() &&
|
||||
I.onlyReadsMemory()) {
|
||||
SDValue Tmp = getValue(I.getOperand(1));
|
||||
|
@ -113,7 +113,7 @@ bool StackProtector::RequiresStackProtector() const {
|
||||
|
||||
if (const ArrayType *AT = dyn_cast<ArrayType>(AI->getAllocatedType())) {
|
||||
// We apparently only care about character arrays.
|
||||
if (!AT->getElementType()->isInteger(8))
|
||||
if (!AT->getElementType()->isIntegerTy(8))
|
||||
continue;
|
||||
|
||||
// If an array has more than SSPBufferSize bytes of allocated space,
|
||||
|
@ -339,7 +339,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn,
|
||||
}
|
||||
// FALLS THROUGH
|
||||
case 1:
|
||||
if (!FTy->getParamType(0)->isInteger(32)) {
|
||||
if (!FTy->getParamType(0)->isIntegerTy(32)) {
|
||||
llvm_report_error("Invalid type for first argument of main() supplied");
|
||||
}
|
||||
// FALLS THROUGH
|
||||
@ -599,18 +599,18 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
switch (Op0->getType()->getTypeID()) {
|
||||
default: llvm_unreachable("Invalid bitcast operand");
|
||||
case Type::IntegerTyID:
|
||||
assert(DestTy->isFloatingPoint() && "invalid bitcast");
|
||||
assert(DestTy->isFloatingPointTy() && "invalid bitcast");
|
||||
if (DestTy->isFloatTy())
|
||||
GV.FloatVal = GV.IntVal.bitsToFloat();
|
||||
else if (DestTy->isDoubleTy())
|
||||
GV.DoubleVal = GV.IntVal.bitsToDouble();
|
||||
break;
|
||||
case Type::FloatTyID:
|
||||
assert(DestTy->isInteger(32) && "Invalid bitcast");
|
||||
assert(DestTy->isIntegerTy(32) && "Invalid bitcast");
|
||||
GV.IntVal.floatToBits(GV.FloatVal);
|
||||
break;
|
||||
case Type::DoubleTyID:
|
||||
assert(DestTy->isInteger(64) && "Invalid bitcast");
|
||||
assert(DestTy->isIntegerTy(64) && "Invalid bitcast");
|
||||
GV.IntVal.doubleToBits(GV.DoubleVal);
|
||||
break;
|
||||
case Type::PointerTyID:
|
||||
|
@ -591,7 +591,7 @@ void Interpreter::popStackAndReturnValueToCaller(const Type *RetTy,
|
||||
ECStack.pop_back();
|
||||
|
||||
if (ECStack.empty()) { // Finished main. Put result into exit code...
|
||||
if (RetTy && RetTy->isInteger()) { // Nonvoid return type?
|
||||
if (RetTy && RetTy->isIntegerTy()) { // Nonvoid return type?
|
||||
ExitValue = Result; // Capture the exit value of the program
|
||||
} else {
|
||||
memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));
|
||||
@ -979,7 +979,7 @@ GenericValue Interpreter::executeFPToUIInst(Value *SrcVal, const Type *DstTy,
|
||||
const Type *SrcTy = SrcVal->getType();
|
||||
uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
assert(SrcTy->isFloatingPoint() && "Invalid FPToUI instruction");
|
||||
assert(SrcTy->isFloatingPointTy() && "Invalid FPToUI instruction");
|
||||
|
||||
if (SrcTy->getTypeID() == Type::FloatTyID)
|
||||
Dest.IntVal = APIntOps::RoundFloatToAPInt(Src.FloatVal, DBitWidth);
|
||||
@ -993,7 +993,7 @@ GenericValue Interpreter::executeFPToSIInst(Value *SrcVal, const Type *DstTy,
|
||||
const Type *SrcTy = SrcVal->getType();
|
||||
uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
assert(SrcTy->isFloatingPoint() && "Invalid FPToSI instruction");
|
||||
assert(SrcTy->isFloatingPointTy() && "Invalid FPToSI instruction");
|
||||
|
||||
if (SrcTy->getTypeID() == Type::FloatTyID)
|
||||
Dest.IntVal = APIntOps::RoundFloatToAPInt(Src.FloatVal, DBitWidth);
|
||||
@ -1005,7 +1005,7 @@ GenericValue Interpreter::executeFPToSIInst(Value *SrcVal, const Type *DstTy,
|
||||
GenericValue Interpreter::executeUIToFPInst(Value *SrcVal, const Type *DstTy,
|
||||
ExecutionContext &SF) {
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
assert(DstTy->isFloatingPoint() && "Invalid UIToFP instruction");
|
||||
assert(DstTy->isFloatingPointTy() && "Invalid UIToFP instruction");
|
||||
|
||||
if (DstTy->getTypeID() == Type::FloatTyID)
|
||||
Dest.FloatVal = APIntOps::RoundAPIntToFloat(Src.IntVal);
|
||||
@ -1017,7 +1017,7 @@ GenericValue Interpreter::executeUIToFPInst(Value *SrcVal, const Type *DstTy,
|
||||
GenericValue Interpreter::executeSIToFPInst(Value *SrcVal, const Type *DstTy,
|
||||
ExecutionContext &SF) {
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
assert(DstTy->isFloatingPoint() && "Invalid SIToFP instruction");
|
||||
assert(DstTy->isFloatingPointTy() && "Invalid SIToFP instruction");
|
||||
|
||||
if (DstTy->getTypeID() == Type::FloatTyID)
|
||||
Dest.FloatVal = APIntOps::RoundSignedAPIntToFloat(Src.IntVal);
|
||||
@ -1058,24 +1058,24 @@ 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->isInteger()) {
|
||||
} else if (DstTy->isIntegerTy()) {
|
||||
if (SrcTy->isFloatTy()) {
|
||||
Dest.IntVal.zext(sizeof(Src.FloatVal) * CHAR_BIT);
|
||||
Dest.IntVal.floatToBits(Src.FloatVal);
|
||||
} else if (SrcTy->isDoubleTy()) {
|
||||
Dest.IntVal.zext(sizeof(Src.DoubleVal) * CHAR_BIT);
|
||||
Dest.IntVal.doubleToBits(Src.DoubleVal);
|
||||
} else if (SrcTy->isInteger()) {
|
||||
} else if (SrcTy->isIntegerTy()) {
|
||||
Dest.IntVal = Src.IntVal;
|
||||
} else
|
||||
llvm_unreachable("Invalid BitCast");
|
||||
} else if (DstTy->isFloatTy()) {
|
||||
if (SrcTy->isInteger())
|
||||
if (SrcTy->isIntegerTy())
|
||||
Dest.FloatVal = Src.IntVal.bitsToFloat();
|
||||
else
|
||||
Dest.FloatVal = Src.FloatVal;
|
||||
} else if (DstTy->isDoubleTy()) {
|
||||
if (SrcTy->isInteger())
|
||||
if (SrcTy->isIntegerTy())
|
||||
Dest.DoubleVal = Src.IntVal.bitsToDouble();
|
||||
else
|
||||
Dest.DoubleVal = Src.DoubleVal;
|
||||
|
@ -411,10 +411,10 @@ GenericValue JIT::runFunction(Function *F,
|
||||
|
||||
// Handle some common cases first. These cases correspond to common `main'
|
||||
// prototypes.
|
||||
if (RetTy->isInteger(32) || RetTy->isVoidTy()) {
|
||||
if (RetTy->isIntegerTy(32) || RetTy->isVoidTy()) {
|
||||
switch (ArgValues.size()) {
|
||||
case 3:
|
||||
if (FTy->getParamType(0)->isInteger(32) &&
|
||||
if (FTy->getParamType(0)->isIntegerTy(32) &&
|
||||
isa<PointerType>(FTy->getParamType(1)) &&
|
||||
isa<PointerType>(FTy->getParamType(2))) {
|
||||
int (*PF)(int, char **, const char **) =
|
||||
@ -429,7 +429,7 @@ GenericValue JIT::runFunction(Function *F,
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (FTy->getParamType(0)->isInteger(32) &&
|
||||
if (FTy->getParamType(0)->isIntegerTy(32) &&
|
||||
isa<PointerType>(FTy->getParamType(1))) {
|
||||
int (*PF)(int, char **) = (int(*)(int, char **))(intptr_t)FPtr;
|
||||
|
||||
@ -442,7 +442,7 @@ GenericValue JIT::runFunction(Function *F,
|
||||
break;
|
||||
case 1:
|
||||
if (FTy->getNumParams() == 1 &&
|
||||
FTy->getParamType(0)->isInteger(32)) {
|
||||
FTy->getParamType(0)->isIntegerTy(32)) {
|
||||
GenericValue rv;
|
||||
int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
|
||||
rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue()));
|
||||
|
@ -493,7 +493,7 @@ raw_ostream &
|
||||
CWriter::printSimpleType(formatted_raw_ostream &Out, const Type *Ty,
|
||||
bool isSigned,
|
||||
const std::string &NameSoFar) {
|
||||
assert((Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) &&
|
||||
assert((Ty->isPrimitiveType() || Ty->isIntegerTy() || isa<VectorType>(Ty)) &&
|
||||
"Invalid type for printSimpleType");
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
||||
@ -540,7 +540,7 @@ CWriter::printSimpleType(formatted_raw_ostream &Out, const Type *Ty,
|
||||
std::ostream &
|
||||
CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned,
|
||||
const std::string &NameSoFar) {
|
||||
assert((Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) &&
|
||||
assert((Ty->isPrimitiveType() || Ty->isIntegerTy() || isa<VectorType>(Ty)) &&
|
||||
"Invalid type for printSimpleType");
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
||||
@ -591,7 +591,7 @@ raw_ostream &CWriter::printType(formatted_raw_ostream &Out,
|
||||
const Type *Ty,
|
||||
bool isSigned, const std::string &NameSoFar,
|
||||
bool IgnoreName, const AttrListPtr &PAL) {
|
||||
if (Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) {
|
||||
if (Ty->isPrimitiveType() || Ty->isIntegerTy() || isa<VectorType>(Ty)) {
|
||||
printSimpleType(Out, Ty, isSigned, NameSoFar);
|
||||
return Out;
|
||||
}
|
||||
@ -694,7 +694,7 @@ raw_ostream &CWriter::printType(formatted_raw_ostream &Out,
|
||||
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
||||
bool isSigned, const std::string &NameSoFar,
|
||||
bool IgnoreName, const AttrListPtr &PAL) {
|
||||
if (Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) {
|
||||
if (Ty->isPrimitiveType() || Ty->isIntegerTy() || isa<VectorType>(Ty)) {
|
||||
printSimpleType(Out, Ty, isSigned, NameSoFar);
|
||||
return Out;
|
||||
}
|
||||
@ -1396,7 +1396,7 @@ bool CWriter::printConstExprCast(const ConstantExpr* CE, bool Static) {
|
||||
}
|
||||
if (NeedsExplicitCast) {
|
||||
Out << "((";
|
||||
if (Ty->isInteger() && Ty != Type::getInt1Ty(Ty->getContext()))
|
||||
if (Ty->isIntegerTy() && Ty != Type::getInt1Ty(Ty->getContext()))
|
||||
printSimpleType(Out, Ty, TypeIsSigned);
|
||||
else
|
||||
printType(Out, Ty); // not integer, sign doesn't matter
|
||||
@ -1497,7 +1497,7 @@ void CWriter::writeInstComputationInline(Instruction &I) {
|
||||
// We can't currently support integer types other than 1, 8, 16, 32, 64.
|
||||
// Validate this.
|
||||
const Type *Ty = I.getType();
|
||||
if (Ty->isInteger() && (Ty!=Type::getInt1Ty(I.getContext()) &&
|
||||
if (Ty->isIntegerTy() && (Ty!=Type::getInt1Ty(I.getContext()) &&
|
||||
Ty!=Type::getInt8Ty(I.getContext()) &&
|
||||
Ty!=Type::getInt16Ty(I.getContext()) &&
|
||||
Ty!=Type::getInt32Ty(I.getContext()) &&
|
||||
@ -2287,7 +2287,8 @@ void CWriter::printModuleTypes(const TypeSymbolTable &TST) {
|
||||
void CWriter::printContainedStructs(const Type *Ty,
|
||||
std::set<const Type*> &StructPrinted) {
|
||||
// Don't walk through pointers.
|
||||
if (isa<PointerType>(Ty) || Ty->isPrimitiveType() || Ty->isInteger()) return;
|
||||
if (isa<PointerType>(Ty) || Ty->isPrimitiveType() || Ty->isIntegerTy())
|
||||
return;
|
||||
|
||||
// Print all contained types first.
|
||||
for (Type::subtype_iterator I = Ty->subtype_begin(),
|
||||
@ -2423,8 +2424,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->isInteger()) ||
|
||||
(DstTy->isFloatingPoint() && SrcTy->isInteger());
|
||||
return (SrcTy->isFloatingPointTy() && DstTy->isIntegerTy()) ||
|
||||
(DstTy->isFloatingPointTy() && SrcTy->isIntegerTy());
|
||||
}
|
||||
|
||||
void CWriter::printFunction(Function &F) {
|
||||
|
@ -344,7 +344,7 @@ namespace {
|
||||
|
||||
std::string CppWriter::getCppName(const Type* Ty) {
|
||||
// First, handle the primitive types .. easy
|
||||
if (Ty->isPrimitiveType() || Ty->isInteger()) {
|
||||
if (Ty->isPrimitiveType() || Ty->isIntegerTy()) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: return "Type::getVoidTy(getGlobalContext())";
|
||||
case Type::IntegerTyID: {
|
||||
@ -493,7 +493,7 @@ namespace {
|
||||
|
||||
bool CppWriter::printTypeInternal(const Type* Ty) {
|
||||
// We don't print definitions for primitive types
|
||||
if (Ty->isPrimitiveType() || Ty->isInteger())
|
||||
if (Ty->isPrimitiveType() || Ty->isIntegerTy())
|
||||
return false;
|
||||
|
||||
// If we already defined this type, we don't need to define it again.
|
||||
@ -686,7 +686,7 @@ namespace {
|
||||
|
||||
// For primitive types and types already defined, just add a name
|
||||
TypeMap::const_iterator TNI = TypeNames.find(TI->second);
|
||||
if (TI->second->isInteger() || TI->second->isPrimitiveType() ||
|
||||
if (TI->second->isIntegerTy() || TI->second->isPrimitiveType() ||
|
||||
TNI != TypeNames.end()) {
|
||||
Out << "mod->addTypeName(\"";
|
||||
printEscapedString(TI->first);
|
||||
|
@ -187,7 +187,7 @@ void MSILWriter::printModuleStartup() {
|
||||
break;
|
||||
case 1:
|
||||
Arg1 = F->arg_begin();
|
||||
if (Arg1->getType()->isInteger()) {
|
||||
if (Arg1->getType()->isIntegerTy()) {
|
||||
Out << "\tldloc\targc\n";
|
||||
Args = getTypeName(Arg1->getType());
|
||||
BadSig = false;
|
||||
@ -195,7 +195,7 @@ void MSILWriter::printModuleStartup() {
|
||||
break;
|
||||
case 2:
|
||||
Arg1 = Arg2 = F->arg_begin(); ++Arg2;
|
||||
if (Arg1->getType()->isInteger() &&
|
||||
if (Arg1->getType()->isIntegerTy() &&
|
||||
Arg2->getType()->getTypeID() == Type::PointerTyID) {
|
||||
Out << "\tldloc\targc\n\tldloc\targv\n";
|
||||
Args = getTypeName(Arg1->getType())+","+getTypeName(Arg2->getType());
|
||||
@ -207,7 +207,7 @@ void MSILWriter::printModuleStartup() {
|
||||
}
|
||||
|
||||
bool RetVoid = (F->getReturnType()->getTypeID() == Type::VoidTyID);
|
||||
if (BadSig || (!F->getReturnType()->isInteger() && !RetVoid)) {
|
||||
if (BadSig || (!F->getReturnType()->isIntegerTy() && !RetVoid)) {
|
||||
Out << "\tldc.i4.0\n";
|
||||
} else {
|
||||
Out << "\tcall\t" << getTypeName(F->getReturnType()) <<
|
||||
@ -334,7 +334,7 @@ std::string MSILWriter::getPrimitiveTypeName(const Type* Ty, bool isSigned) {
|
||||
|
||||
std::string MSILWriter::getTypeName(const Type* Ty, bool isSigned,
|
||||
bool isNested) {
|
||||
if (Ty->isPrimitiveType() || Ty->isInteger())
|
||||
if (Ty->isPrimitiveType() || Ty->isIntegerTy())
|
||||
return getPrimitiveTypeName(Ty,isSigned);
|
||||
// FIXME: "OpaqueType" support
|
||||
switch (Ty->getTypeID()) {
|
||||
|
@ -971,7 +971,7 @@ const char *MSP430TargetLowering::getTargetNodeName(unsigned Opcode) const {
|
||||
|
||||
bool MSP430TargetLowering::isTruncateFree(const Type *Ty1,
|
||||
const Type *Ty2) const {
|
||||
if (!Ty1->isInteger() || !Ty2->isInteger())
|
||||
if (!Ty1->isIntegerTy() || !Ty2->isIntegerTy())
|
||||
return false;
|
||||
|
||||
return (Ty1->getPrimitiveSizeInBits() > Ty2->getPrimitiveSizeInBits());
|
||||
@ -986,7 +986,7 @@ bool MSP430TargetLowering::isTruncateFree(EVT VT1, EVT VT2) const {
|
||||
|
||||
bool MSP430TargetLowering::isZExtFree(const Type *Ty1, const Type *Ty2) const {
|
||||
// MSP430 implicitly zero-extends 8-bit results in 16-bit registers.
|
||||
return 0 && Ty1->isInteger(8) && Ty2->isInteger(16);
|
||||
return 0 && Ty1->isIntegerTy(8) && Ty2->isIntegerTy(16);
|
||||
}
|
||||
|
||||
bool MSP430TargetLowering::isZExtFree(EVT VT1, EVT VT2) const {
|
||||
|
@ -786,8 +786,8 @@ bool X86FastISel::X86SelectCmp(Instruction *I) {
|
||||
|
||||
bool X86FastISel::X86SelectZExt(Instruction *I) {
|
||||
// Handle zero-extension from i1 to i8, which is common.
|
||||
if (I->getType()->isInteger(8) &&
|
||||
I->getOperand(0)->getType()->isInteger(1)) {
|
||||
if (I->getType()->isIntegerTy(8) &&
|
||||
I->getOperand(0)->getType()->isIntegerTy(1)) {
|
||||
unsigned ResultReg = getRegForValue(I->getOperand(0));
|
||||
if (ResultReg == 0) return false;
|
||||
// Set the high bits to zero.
|
||||
@ -949,7 +949,7 @@ bool X86FastISel::X86SelectBranch(Instruction *I) {
|
||||
bool X86FastISel::X86SelectShift(Instruction *I) {
|
||||
unsigned CReg = 0, OpReg = 0, OpImm = 0;
|
||||
const TargetRegisterClass *RC = NULL;
|
||||
if (I->getType()->isInteger(8)) {
|
||||
if (I->getType()->isIntegerTy(8)) {
|
||||
CReg = X86::CL;
|
||||
RC = &X86::GR8RegClass;
|
||||
switch (I->getOpcode()) {
|
||||
@ -958,7 +958,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
|
||||
case Instruction::Shl: OpReg = X86::SHL8rCL; OpImm = X86::SHL8ri; break;
|
||||
default: return false;
|
||||
}
|
||||
} else if (I->getType()->isInteger(16)) {
|
||||
} else if (I->getType()->isIntegerTy(16)) {
|
||||
CReg = X86::CX;
|
||||
RC = &X86::GR16RegClass;
|
||||
switch (I->getOpcode()) {
|
||||
@ -967,7 +967,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
|
||||
case Instruction::Shl: OpReg = X86::SHL16rCL; OpImm = X86::SHL16ri; break;
|
||||
default: return false;
|
||||
}
|
||||
} else if (I->getType()->isInteger(32)) {
|
||||
} else if (I->getType()->isIntegerTy(32)) {
|
||||
CReg = X86::ECX;
|
||||
RC = &X86::GR32RegClass;
|
||||
switch (I->getOpcode()) {
|
||||
@ -976,7 +976,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
|
||||
case Instruction::Shl: OpReg = X86::SHL32rCL; OpImm = X86::SHL32ri; break;
|
||||
default: return false;
|
||||
}
|
||||
} else if (I->getType()->isInteger(64)) {
|
||||
} else if (I->getType()->isIntegerTy(64)) {
|
||||
CReg = X86::RCX;
|
||||
RC = &X86::GR64RegClass;
|
||||
switch (I->getOpcode()) {
|
||||
|
@ -118,7 +118,7 @@ bool FPRegKiller::runOnMachineFunction(MachineFunction &MF) {
|
||||
for (BasicBlock::const_iterator II = SI->begin();
|
||||
(PN = dyn_cast<PHINode>(II)); ++II) {
|
||||
if (PN->getType()==Type::getX86_FP80Ty(LLVMBB->getContext()) ||
|
||||
(!Subtarget.hasSSE1() && PN->getType()->isFloatingPoint()) ||
|
||||
(!Subtarget.hasSSE1() && PN->getType()->isFloatingPointTy()) ||
|
||||
(!Subtarget.hasSSE2() &&
|
||||
PN->getType()==Type::getDoubleTy(LLVMBB->getContext()))) {
|
||||
ContainsFPCode = true;
|
||||
|
@ -7742,7 +7742,7 @@ bool X86TargetLowering::isLegalAddressingMode(const AddrMode &AM,
|
||||
|
||||
|
||||
bool X86TargetLowering::isTruncateFree(const Type *Ty1, const Type *Ty2) const {
|
||||
if (!Ty1->isInteger() || !Ty2->isInteger())
|
||||
if (!Ty1->isIntegerTy() || !Ty2->isIntegerTy())
|
||||
return false;
|
||||
unsigned NumBits1 = Ty1->getPrimitiveSizeInBits();
|
||||
unsigned NumBits2 = Ty2->getPrimitiveSizeInBits();
|
||||
@ -7763,7 +7763,7 @@ bool X86TargetLowering::isTruncateFree(EVT VT1, EVT VT2) const {
|
||||
|
||||
bool X86TargetLowering::isZExtFree(const Type *Ty1, const Type *Ty2) const {
|
||||
// x86-64 implicitly zero-extends 32-bit results in 64-bit registers.
|
||||
return Ty1->isInteger(32) && Ty2->isInteger(64) && Subtarget->is64Bit();
|
||||
return Ty1->isIntegerTy(32) && Ty2->isIntegerTy(64) && Subtarget->is64Bit();
|
||||
}
|
||||
|
||||
bool X86TargetLowering::isZExtFree(EVT VT1, EVT VT2) const {
|
||||
@ -9695,7 +9695,7 @@ static bool LowerToBSwap(CallInst *CI) {
|
||||
// Verify this is a simple bswap.
|
||||
if (CI->getNumOperands() != 2 ||
|
||||
CI->getType() != CI->getOperand(1)->getType() ||
|
||||
!CI->getType()->isInteger())
|
||||
!CI->getType()->isIntegerTy())
|
||||
return false;
|
||||
|
||||
const IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
|
||||
@ -9744,7 +9744,7 @@ bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const {
|
||||
return LowerToBSwap(CI);
|
||||
}
|
||||
// rorw $$8, ${0:w} --> llvm.bswap.i16
|
||||
if (CI->getType()->isInteger(16) &&
|
||||
if (CI->getType()->isIntegerTy(16) &&
|
||||
AsmPieces.size() == 3 &&
|
||||
AsmPieces[0] == "rorw" &&
|
||||
AsmPieces[1] == "$$8," &&
|
||||
@ -9754,7 +9754,7 @@ bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (CI->getType()->isInteger(64) &&
|
||||
if (CI->getType()->isIntegerTy(64) &&
|
||||
Constraints.size() >= 2 &&
|
||||
Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] == "A" &&
|
||||
Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] == "0") {
|
||||
|
@ -57,13 +57,13 @@ ModulePass *llvm::createDeadTypeEliminationPass() {
|
||||
//
|
||||
static inline bool ShouldNukeSymtabEntry(const Type *Ty){
|
||||
// Nuke all names for primitive types!
|
||||
if (Ty->isPrimitiveType() || Ty->isInteger())
|
||||
if (Ty->isPrimitiveType() || Ty->isIntegerTy())
|
||||
return true;
|
||||
|
||||
// Nuke all pointers to primitive types as well...
|
||||
if (const PointerType *PT = dyn_cast<PointerType>(Ty))
|
||||
if (PT->getElementType()->isPrimitiveType() ||
|
||||
PT->getElementType()->isInteger())
|
||||
PT->getElementType()->isIntegerTy())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -1590,7 +1590,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
|
||||
// simplification. In these cases, we typically end up with "cond ? v1 : v2"
|
||||
// where v1 and v2 both require constant pool loads, a big loss.
|
||||
if (GVElType == Type::getInt1Ty(GV->getContext()) ||
|
||||
GVElType->isFloatingPoint() ||
|
||||
GVElType->isFloatingPointTy() ||
|
||||
isa<PointerType>(GVElType) || isa<VectorType>(GVElType))
|
||||
return false;
|
||||
|
||||
@ -1925,7 +1925,7 @@ GlobalVariable *GlobalOpt::FindGlobalCtors(Module &M) {
|
||||
if (!ATy) return 0;
|
||||
const StructType *STy = dyn_cast<StructType>(ATy->getElementType());
|
||||
if (!STy || STy->getNumElements() != 2 ||
|
||||
!STy->getElementType(0)->isInteger(32)) return 0;
|
||||
!STy->getElementType(0)->isIntegerTy(32)) return 0;
|
||||
const PointerType *PFTy = dyn_cast<PointerType>(STy->getElementType(1));
|
||||
if (!PFTy) return 0;
|
||||
const FunctionType *FTy = dyn_cast<FunctionType>(PFTy->getElementType());
|
||||
|
@ -35,7 +35,7 @@ static Constant *SubOne(ConstantInt *C) {
|
||||
// Otherwise, return null.
|
||||
//
|
||||
static inline Value *dyn_castFoldableMul(Value *V, ConstantInt *&CST) {
|
||||
if (!V->hasOneUse() || !V->getType()->isInteger())
|
||||
if (!V->hasOneUse() || !V->getType()->isIntegerTy())
|
||||
return 0;
|
||||
|
||||
Instruction *I = dyn_cast<Instruction>(V);
|
||||
@ -145,10 +145,10 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
|
||||
}
|
||||
}
|
||||
|
||||
if (I.getType()->isInteger(1))
|
||||
if (I.getType()->isIntegerTy(1))
|
||||
return BinaryOperator::CreateXor(LHS, RHS);
|
||||
|
||||
if (I.getType()->isInteger()) {
|
||||
if (I.getType()->isIntegerTy()) {
|
||||
// X + X --> X << 1
|
||||
if (LHS == RHS)
|
||||
return BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1));
|
||||
@ -168,7 +168,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
|
||||
// -A + B --> B - A
|
||||
// -A + -B --> -(A + B)
|
||||
if (Value *LHSV = dyn_castNegVal(LHS)) {
|
||||
if (LHS->getType()->isIntOrIntVector()) {
|
||||
if (LHS->getType()->isIntOrIntVectorTy()) {
|
||||
if (Value *RHSV = dyn_castNegVal(RHS)) {
|
||||
Value *NewAdd = Builder->CreateAdd(LHSV, RHSV, "sum");
|
||||
return BinaryOperator::CreateNeg(NewAdd);
|
||||
@ -222,7 +222,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
|
||||
}
|
||||
|
||||
// W*X + Y*Z --> W * (X+Z) iff W == Y
|
||||
if (I.getType()->isIntOrIntVector()) {
|
||||
if (I.getType()->isIntOrIntVectorTy()) {
|
||||
Value *W, *X, *Y, *Z;
|
||||
if (match(LHS, m_Mul(m_Value(W), m_Value(X))) &&
|
||||
match(RHS, m_Mul(m_Value(Y), m_Value(Z)))) {
|
||||
@ -560,7 +560,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
||||
return ReplaceInstUsesWith(I, Op0); // undef - X -> undef
|
||||
if (isa<UndefValue>(Op1))
|
||||
return ReplaceInstUsesWith(I, Op1); // X - undef -> undef
|
||||
if (I.getType()->isInteger(1))
|
||||
if (I.getType()->isIntegerTy(1))
|
||||
return BinaryOperator::CreateXor(Op0, Op1);
|
||||
|
||||
if (ConstantInt *C = dyn_cast<ConstantInt>(Op0)) {
|
||||
|
@ -946,7 +946,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
|
||||
const Type *SrcTy = Op0C->getOperand(0)->getType();
|
||||
if (Op0C->getOpcode() == Op1C->getOpcode() && // same cast kind ?
|
||||
SrcTy == Op1C->getOperand(0)->getType() &&
|
||||
SrcTy->isIntOrIntVector()) {
|
||||
SrcTy->isIntOrIntVectorTy()) {
|
||||
Value *Op0COp = Op0C->getOperand(0), *Op1COp = Op1C->getOperand(0);
|
||||
|
||||
// Only do this if the casts both really cause code to be generated.
|
||||
@ -1161,7 +1161,7 @@ static Instruction *MatchSelectFromAndOr(Value *A, Value *B,
|
||||
// If A is not a select of -1/0, this cannot match.
|
||||
Value *Cond = 0;
|
||||
if (!match(A, m_SExt(m_Value(Cond))) ||
|
||||
!Cond->getType()->isInteger(1))
|
||||
!Cond->getType()->isIntegerTy(1))
|
||||
return 0;
|
||||
|
||||
// ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B.
|
||||
@ -1699,7 +1699,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
|
||||
if (Op0C->getOpcode() == Op1C->getOpcode()) {// same cast kind ?
|
||||
const Type *SrcTy = Op0C->getOperand(0)->getType();
|
||||
if (SrcTy == Op1C->getOperand(0)->getType() &&
|
||||
SrcTy->isIntOrIntVector()) {
|
||||
SrcTy->isIntOrIntVectorTy()) {
|
||||
Value *Op0COp = Op0C->getOperand(0), *Op1COp = Op1C->getOperand(0);
|
||||
|
||||
if ((!isa<ICmpInst>(Op0COp) || !isa<ICmpInst>(Op1COp)) &&
|
||||
@ -2016,7 +2016,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->isInteger() &&
|
||||
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegerTy() &&
|
||||
// Only do this if the casts both really cause code to be generated.
|
||||
ShouldOptimizeCast(Op0C->getOpcode(), Op0C->getOperand(0),
|
||||
I.getType()) &&
|
||||
|
@ -199,7 +199,7 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {
|
||||
// Extract the length and alignment and fill if they are constant.
|
||||
ConstantInt *LenC = dyn_cast<ConstantInt>(MI->getLength());
|
||||
ConstantInt *FillC = dyn_cast<ConstantInt>(MI->getValue());
|
||||
if (!LenC || !FillC || !FillC->getType()->isInteger(8))
|
||||
if (!LenC || !FillC || !FillC->getType()->isIntegerTy(8))
|
||||
return 0;
|
||||
uint64_t Len = LenC->getZExtValue();
|
||||
Alignment = MI->getAlignment();
|
||||
|
@ -23,7 +23,7 @@ using namespace PatternMatch;
|
||||
///
|
||||
static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale,
|
||||
int &Offset) {
|
||||
assert(Val->getType()->isInteger(32) && "Unexpected allocation size type!");
|
||||
assert(Val->getType()->isIntegerTy(32) && "Unexpected allocation size type!");
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Val)) {
|
||||
Offset = CI->getZExtValue();
|
||||
Scale = 0;
|
||||
@ -837,7 +837,7 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) {
|
||||
|
||||
// zext (xor i1 X, true) to i32 --> xor (zext i1 X to i32), 1
|
||||
Value *X;
|
||||
if (SrcI && SrcI->hasOneUse() && SrcI->getType()->isInteger(1) &&
|
||||
if (SrcI && SrcI->hasOneUse() && SrcI->getType()->isIntegerTy(1) &&
|
||||
match(SrcI, m_Not(m_Value(X))) &&
|
||||
(!X->hasOneUse() || !isa<CmpInst>(X))) {
|
||||
Value *New = Builder->CreateZExt(X, CI.getType());
|
||||
|
@ -1606,7 +1606,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
const Type *Ty = Op0->getType();
|
||||
|
||||
// icmp's with boolean values can always be turned into bitwise operations
|
||||
if (Ty->isInteger(1)) {
|
||||
if (Ty->isIntegerTy(1)) {
|
||||
switch (I.getPredicate()) {
|
||||
default: llvm_unreachable("Invalid icmp instruction!");
|
||||
case ICmpInst::ICMP_EQ: { // icmp eq i1 A, B -> ~(A^B)
|
||||
@ -1650,7 +1650,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
unsigned BitWidth = 0;
|
||||
if (TD)
|
||||
BitWidth = TD->getTypeSizeInBits(Ty->getScalarType());
|
||||
else if (Ty->isIntOrIntVector())
|
||||
else if (Ty->isIntOrIntVectorTy())
|
||||
BitWidth = Ty->getScalarSizeInBits();
|
||||
|
||||
bool isSignBit = false;
|
||||
|
@ -87,7 +87,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
|
||||
|
||||
const Type *SrcPTy = SrcTy->getElementType();
|
||||
|
||||
if (DestPTy->isInteger() || isa<PointerType>(DestPTy) ||
|
||||
if (DestPTy->isIntegerTy() || isa<PointerType>(DestPTy) ||
|
||||
isa<VectorType>(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
|
||||
@ -104,7 +104,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
|
||||
}
|
||||
|
||||
if (IC.getTargetData() &&
|
||||
(SrcPTy->isInteger() || isa<PointerType>(SrcPTy) ||
|
||||
(SrcPTy->isIntegerTy() || isa<PointerType>(SrcPTy) ||
|
||||
isa<VectorType>(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.
|
||||
@ -243,7 +243,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||
|
||||
const Type *SrcPTy = SrcTy->getElementType();
|
||||
|
||||
if (!DestPTy->isInteger() && !isa<PointerType>(DestPTy))
|
||||
if (!DestPTy->isIntegerTy() && !isa<PointerType>(DestPTy))
|
||||
return 0;
|
||||
|
||||
/// NewGEPIndices - If SrcPTy is an aggregate type, we can emit a "noop gep"
|
||||
@ -277,7 +277,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||
SrcTy = PointerType::get(SrcPTy, SrcTy->getAddressSpace());
|
||||
}
|
||||
|
||||
if (!SrcPTy->isInteger() && !isa<PointerType>(SrcPTy))
|
||||
if (!SrcPTy->isIntegerTy() && !isa<PointerType>(SrcPTy))
|
||||
return 0;
|
||||
|
||||
// If the pointers point into different address spaces or if they point to
|
||||
@ -298,7 +298,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||
const Type* CastSrcTy = SIOp0->getType();
|
||||
const Type* CastDstTy = SrcPTy;
|
||||
if (isa<PointerType>(CastDstTy)) {
|
||||
if (CastSrcTy->isInteger())
|
||||
if (CastSrcTy->isIntegerTy())
|
||||
opcode = Instruction::IntToPtr;
|
||||
} else if (isa<IntegerType>(CastDstTy)) {
|
||||
if (isa<PointerType>(SIOp0->getType()))
|
||||
|
@ -157,7 +157,7 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
|
||||
}
|
||||
|
||||
/// i1 mul -> i1 and.
|
||||
if (I.getType()->isInteger(1))
|
||||
if (I.getType()->isIntegerTy(1))
|
||||
return BinaryOperator::CreateAnd(Op0, Op1);
|
||||
|
||||
// X*(1 << Y) --> X << Y
|
||||
@ -314,7 +314,7 @@ Instruction *InstCombiner::commonDivTransforms(BinaryOperator &I) {
|
||||
// undef / X -> 0 for integer.
|
||||
// undef / X -> undef for FP (the undef could be a snan).
|
||||
if (isa<UndefValue>(Op0)) {
|
||||
if (Op0->getType()->isFPOrFPVector())
|
||||
if (Op0->getType()->isFPOrFPVectorTy())
|
||||
return ReplaceInstUsesWith(I, Op0);
|
||||
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
|
||||
}
|
||||
@ -386,7 +386,7 @@ Instruction *InstCombiner::commonIDivTransforms(BinaryOperator &I) {
|
||||
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
|
||||
|
||||
// It can't be division by zero, hence it must be division by one.
|
||||
if (I.getType()->isInteger(1))
|
||||
if (I.getType()->isIntegerTy(1))
|
||||
return ReplaceInstUsesWith(I, Op0);
|
||||
|
||||
if (ConstantVector *Op1V = dyn_cast<ConstantVector>(Op1)) {
|
||||
@ -493,7 +493,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()->isInteger()) {
|
||||
if (I.getType()->isIntegerTy()) {
|
||||
APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));
|
||||
if (MaskedValueIsZero(Op0, Mask)) {
|
||||
if (MaskedValueIsZero(Op1, Mask)) {
|
||||
@ -527,7 +527,7 @@ Instruction *InstCombiner::commonRemTransforms(BinaryOperator &I) {
|
||||
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
|
||||
|
||||
if (isa<UndefValue>(Op0)) { // undef % X -> 0
|
||||
if (I.getType()->isFPOrFPVector())
|
||||
if (I.getType()->isFPOrFPVectorTy())
|
||||
return ReplaceInstUsesWith(I, Op0); // X % undef -> undef (could be SNaN)
|
||||
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
|
||||
}
|
||||
@ -648,7 +648,7 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
|
||||
|
||||
// If the sign bits of both operands are zero (i.e. we can prove they are
|
||||
// unsigned inputs), turn this into a urem.
|
||||
if (I.getType()->isInteger()) {
|
||||
if (I.getType()->isIntegerTy()) {
|
||||
APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));
|
||||
if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) {
|
||||
// X srem Y -> X urem Y, iff X and Y don't have sign bit set
|
||||
|
@ -441,7 +441,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
return ReplaceInstUsesWith(SI, FalseVal);
|
||||
}
|
||||
|
||||
if (SI.getType()->isInteger(1)) {
|
||||
if (SI.getType()->isIntegerTy(1)) {
|
||||
if (ConstantInt *C = dyn_cast<ConstantInt>(TrueVal)) {
|
||||
if (C->getZExtValue()) {
|
||||
// Change: A = select B, true, C --> A = or B, C
|
||||
@ -629,7 +629,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
}
|
||||
|
||||
// See if we can fold the select into one of our operands.
|
||||
if (SI.getType()->isInteger()) {
|
||||
if (SI.getType()->isIntegerTy()) {
|
||||
if (Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal))
|
||||
return FoldI;
|
||||
|
||||
|
@ -107,7 +107,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
assert((TD || !isa<PointerType>(VTy)) &&
|
||||
"SimplifyDemandedBits needs to know bit widths!");
|
||||
assert((!TD || TD->getTypeSizeInBits(VTy->getScalarType()) == BitWidth) &&
|
||||
(!VTy->isIntOrIntVector() ||
|
||||
(!VTy->isIntOrIntVectorTy() ||
|
||||
VTy->getScalarSizeInBits() == BitWidth) &&
|
||||
KnownZero.getBitWidth() == BitWidth &&
|
||||
KnownOne.getBitWidth() == BitWidth &&
|
||||
@ -401,7 +401,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
break;
|
||||
}
|
||||
case Instruction::BitCast:
|
||||
if (!I->getOperand(0)->getType()->isIntOrIntVector())
|
||||
if (!I->getOperand(0)->getType()->isIntOrIntVectorTy())
|
||||
return 0; // vector->int or fp->int?
|
||||
|
||||
if (const VectorType *DstVTy = dyn_cast<VectorType>(I->getType())) {
|
||||
|
@ -158,7 +158,7 @@ Value *InstCombiner::dyn_castNegVal(Value *V) const {
|
||||
return ConstantExpr::getNeg(C);
|
||||
|
||||
if (ConstantVector *C = dyn_cast<ConstantVector>(V))
|
||||
if (C->getType()->getElementType()->isInteger())
|
||||
if (C->getType()->getElementType()->isIntegerTy())
|
||||
return ConstantExpr::getNeg(C);
|
||||
|
||||
return 0;
|
||||
@ -177,7 +177,7 @@ Value *InstCombiner::dyn_castFNegVal(Value *V) const {
|
||||
return ConstantExpr::getFNeg(C);
|
||||
|
||||
if (ConstantVector *C = dyn_cast<ConstantVector>(V))
|
||||
if (C->getType()->getElementType()->isFloatingPoint())
|
||||
if (C->getType()->getElementType()->isFloatingPointTy())
|
||||
return ConstantExpr::getFNeg(C);
|
||||
|
||||
return 0;
|
||||
@ -226,7 +226,7 @@ Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
|
||||
|
||||
if (isa<Constant>(TV) || isa<Constant>(FV)) {
|
||||
// Bool selects with constant operands can be folded to logical ops.
|
||||
if (SI->getType()->isInteger(1)) return 0;
|
||||
if (SI->getType()->isIntegerTy(1)) return 0;
|
||||
|
||||
Value *SelectTrueVal = FoldOperationIntoSelectOperand(Op, TV, this);
|
||||
Value *SelectFalseVal = FoldOperationIntoSelectOperand(Op, FV, this);
|
||||
@ -596,7 +596,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
||||
// (where tmp = 8*tmp2) into:
|
||||
// getelementptr [100 x double]* %arr, i32 0, i32 %tmp2; bitcast
|
||||
|
||||
if (TD && isa<ArrayType>(SrcElTy) && ResElTy->isInteger(8)) {
|
||||
if (TD && isa<ArrayType>(SrcElTy) && ResElTy->isIntegerTy(8)) {
|
||||
uint64_t ArrayEltSize =
|
||||
TD->getTypeAllocSize(cast<ArrayType>(SrcElTy)->getElementType());
|
||||
|
||||
|
@ -84,7 +84,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
|
||||
AI = MainFn->arg_begin();
|
||||
// If the program looked at argc, have it look at the return value of the
|
||||
// init call instead.
|
||||
if (!AI->getType()->isInteger(32)) {
|
||||
if (!AI->getType()->isIntegerTy(32)) {
|
||||
Instruction::CastOps opcode;
|
||||
if (!AI->use_empty()) {
|
||||
opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true);
|
||||
|
@ -405,7 +405,7 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){
|
||||
// If comparing a live-in value against a constant, see if we know the
|
||||
// live-in value on any predecessors.
|
||||
if (LVI && isa<Constant>(Cmp->getOperand(1)) &&
|
||||
Cmp->getType()->isInteger() && // Not vector compare.
|
||||
Cmp->getType()->isIntegerTy() && // Not vector compare.
|
||||
(!isa<Instruction>(Cmp->getOperand(0)) ||
|
||||
cast<Instruction>(Cmp->getOperand(0))->getParent() != BB)) {
|
||||
Constant *RHSCst = cast<Constant>(Cmp->getOperand(1));
|
||||
|
@ -871,7 +871,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
|
||||
// If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC
|
||||
// in the loop with the appropriate one directly.
|
||||
if (IsEqual || (isa<ConstantInt>(Val) &&
|
||||
Val->getType()->isInteger(1))) {
|
||||
Val->getType()->isIntegerTy(1))) {
|
||||
Value *Replacement;
|
||||
if (IsEqual)
|
||||
Replacement = Val;
|
||||
@ -997,10 +997,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
|
||||
case Instruction::And:
|
||||
if (isa<ConstantInt>(I->getOperand(0)) &&
|
||||
// constant -> RHS
|
||||
I->getOperand(0)->getType()->isInteger(1))
|
||||
I->getOperand(0)->getType()->isIntegerTy(1))
|
||||
cast<BinaryOperator>(I)->swapOperands();
|
||||
if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
|
||||
if (CB->getType()->isInteger(1)) {
|
||||
if (CB->getType()->isIntegerTy(1)) {
|
||||
if (CB->isOne()) // X & 1 -> X
|
||||
ReplaceUsesOfWith(I, I->getOperand(0), Worklist, L, LPM);
|
||||
else // X & 0 -> 0
|
||||
@ -1011,10 +1011,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
|
||||
case Instruction::Or:
|
||||
if (isa<ConstantInt>(I->getOperand(0)) &&
|
||||
// constant -> RHS
|
||||
I->getOperand(0)->getType()->isInteger(1))
|
||||
I->getOperand(0)->getType()->isIntegerTy(1))
|
||||
cast<BinaryOperator>(I)->swapOperands();
|
||||
if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
|
||||
if (CB->getType()->isInteger(1)) {
|
||||
if (CB->getType()->isIntegerTy(1)) {
|
||||
if (CB->isOne()) // X | 1 -> 1
|
||||
ReplaceUsesOfWith(I, I->getOperand(1), Worklist, L, LPM);
|
||||
else // X | 0 -> X
|
||||
|
@ -42,7 +42,7 @@ static Value *isBytewiseValue(Value *V) {
|
||||
LLVMContext &Context = V->getContext();
|
||||
|
||||
// All byte-wide stores are splatable, even of arbitrary variables.
|
||||
if (V->getType()->isInteger(8)) return V;
|
||||
if (V->getType()->isIntegerTy(8)) return V;
|
||||
|
||||
// Constant float and double values can be handled as integer values if the
|
||||
// corresponding integer value is "byteable". An important case is 0.0.
|
||||
|
@ -182,7 +182,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()->isInteger() ||
|
||||
if (!I->getType()->isIntegerTy() ||
|
||||
(!BinaryOperator::isNot(I) && !BinaryOperator::isNeg(I)))
|
||||
++Rank;
|
||||
|
||||
@ -929,7 +929,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
|
||||
}
|
||||
|
||||
// Reject cases where it is pointless to do this.
|
||||
if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() ||
|
||||
if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPointTy() ||
|
||||
isa<VectorType>(BI->getType()))
|
||||
continue; // Floating point ops are not associative.
|
||||
|
||||
@ -939,7 +939,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
|
||||
// is not further optimized, it is likely to be transformed back to a
|
||||
// short-circuited form for code gen, and the source order may have been
|
||||
// optimized for the most likely conditions.
|
||||
if (BI->getType()->isInteger(1))
|
||||
if (BI->getType()->isIntegerTy(1))
|
||||
continue;
|
||||
|
||||
// If this is a subtract instruction which is not already in negate form,
|
||||
|
@ -835,7 +835,7 @@ void SROA::RewriteMemIntrinUserOfAlloca(MemIntrinsic *MI, Instruction *Inst,
|
||||
StoreVal = ConstantInt::get(Context, TotalVal);
|
||||
if (isa<PointerType>(ValTy))
|
||||
StoreVal = ConstantExpr::getIntToPtr(StoreVal, ValTy);
|
||||
else if (ValTy->isFloatingPoint())
|
||||
else if (ValTy->isFloatingPointTy())
|
||||
StoreVal = ConstantExpr::getBitCast(StoreVal, ValTy);
|
||||
assert(StoreVal->getType() == ValTy && "Type mismatch!");
|
||||
|
||||
@ -939,7 +939,7 @@ void SROA::RewriteStoreUserOfWholeAlloca(StoreInst *SI, AllocaInst *AI,
|
||||
Value *DestField = NewElts[i];
|
||||
if (EltVal->getType() == FieldTy) {
|
||||
// Storing to an integer field of this size, just do it.
|
||||
} else if (FieldTy->isFloatingPoint() || isa<VectorType>(FieldTy)) {
|
||||
} else if (FieldTy->isFloatingPointTy() || isa<VectorType>(FieldTy)) {
|
||||
// Bitcast to the right element type (for fp/vector values).
|
||||
EltVal = new BitCastInst(EltVal, FieldTy, "", SI);
|
||||
} else {
|
||||
@ -983,7 +983,8 @@ void SROA::RewriteStoreUserOfWholeAlloca(StoreInst *SI, AllocaInst *AI,
|
||||
Value *DestField = NewElts[i];
|
||||
if (EltVal->getType() == ArrayEltTy) {
|
||||
// Storing to an integer field of this size, just do it.
|
||||
} else if (ArrayEltTy->isFloatingPoint() || isa<VectorType>(ArrayEltTy)) {
|
||||
} else if (ArrayEltTy->isFloatingPointTy() ||
|
||||
isa<VectorType>(ArrayEltTy)) {
|
||||
// Bitcast to the right element type (for fp/vector values).
|
||||
EltVal = new BitCastInst(EltVal, ArrayEltTy, "", SI);
|
||||
} else {
|
||||
@ -1043,7 +1044,7 @@ void SROA::RewriteLoadUserOfWholeAlloca(LoadInst *LI, AllocaInst *AI,
|
||||
|
||||
const IntegerType *FieldIntTy = IntegerType::get(LI->getContext(),
|
||||
FieldSizeBits);
|
||||
if (!isa<IntegerType>(FieldTy) && !FieldTy->isFloatingPoint() &&
|
||||
if (!isa<IntegerType>(FieldTy) && !FieldTy->isFloatingPointTy() &&
|
||||
!isa<VectorType>(FieldTy))
|
||||
SrcField = new BitCastInst(SrcField,
|
||||
PointerType::getUnqual(FieldIntTy),
|
||||
@ -1522,7 +1523,7 @@ Value *SROA::ConvertScalar_ExtractValue(Value *FromVal, const Type *ToType,
|
||||
// If the result is an integer, this is a trunc or bitcast.
|
||||
if (isa<IntegerType>(ToType)) {
|
||||
// Should be done.
|
||||
} else if (ToType->isFloatingPoint() || isa<VectorType>(ToType)) {
|
||||
} else if (ToType->isFloatingPointTy() || isa<VectorType>(ToType)) {
|
||||
// Just do a bitcast, we know the sizes match up.
|
||||
FromVal = Builder.CreateBitCast(FromVal, ToType, "tmp");
|
||||
} else {
|
||||
@ -1600,7 +1601,7 @@ Value *SROA::ConvertScalar_InsertValue(Value *SV, Value *Old,
|
||||
unsigned DestWidth = TD->getTypeSizeInBits(AllocaType);
|
||||
unsigned SrcStoreWidth = TD->getTypeStoreSizeInBits(SV->getType());
|
||||
unsigned DestStoreWidth = TD->getTypeStoreSizeInBits(AllocaType);
|
||||
if (SV->getType()->isFloatingPoint() || isa<VectorType>(SV->getType()))
|
||||
if (SV->getType()->isFloatingPointTy() || isa<VectorType>(SV->getType()))
|
||||
SV = Builder.CreateBitCast(SV,
|
||||
IntegerType::get(SV->getContext(),SrcWidth), "tmp");
|
||||
else if (isa<PointerType>(SV->getType()))
|
||||
|
@ -525,7 +525,7 @@ static uint64_t GetStringLengthH(Value *V, SmallPtrSet<PHINode*, 32> &PHIs) {
|
||||
|
||||
// Must be a Constant Array
|
||||
ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
|
||||
if (!Array || !Array->getType()->getElementType()->isInteger(8))
|
||||
if (!Array || !Array->getType()->getElementType()->isIntegerTy(8))
|
||||
return false;
|
||||
|
||||
// Get the number of elements in the array
|
||||
@ -697,7 +697,7 @@ struct StrChrOpt : public LibCallOptimization {
|
||||
if (!TD) return 0;
|
||||
|
||||
uint64_t Len = GetStringLength(SrcStr);
|
||||
if (Len == 0 || !FT->getParamType(1)->isInteger(32)) // memchr needs i32.
|
||||
if (Len == 0 || !FT->getParamType(1)->isIntegerTy(32))// memchr needs i32.
|
||||
return 0;
|
||||
|
||||
return EmitMemChr(SrcStr, CI->getOperand(2), // include nul.
|
||||
@ -739,7 +739,7 @@ struct StrCmpOpt : public LibCallOptimization {
|
||||
// Verify the "strcmp" function prototype.
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
if (FT->getNumParams() != 2 ||
|
||||
!FT->getReturnType()->isInteger(32) ||
|
||||
!FT->getReturnType()->isIntegerTy(32) ||
|
||||
FT->getParamType(0) != FT->getParamType(1) ||
|
||||
FT->getParamType(0) != Type::getInt8PtrTy(*Context))
|
||||
return 0;
|
||||
@ -787,7 +787,7 @@ struct StrNCmpOpt : public LibCallOptimization {
|
||||
// Verify the "strncmp" function prototype.
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
if (FT->getNumParams() != 3 ||
|
||||
!FT->getReturnType()->isInteger(32) ||
|
||||
!FT->getReturnType()->isIntegerTy(32) ||
|
||||
FT->getParamType(0) != FT->getParamType(1) ||
|
||||
FT->getParamType(0) != Type::getInt8PtrTy(*Context) ||
|
||||
!isa<IntegerType>(FT->getParamType(2)))
|
||||
@ -1008,7 +1008,7 @@ struct MemCmpOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
if (FT->getNumParams() != 3 || !isa<PointerType>(FT->getParamType(0)) ||
|
||||
!isa<PointerType>(FT->getParamType(1)) ||
|
||||
!FT->getReturnType()->isInteger(32))
|
||||
!FT->getReturnType()->isIntegerTy(32))
|
||||
return 0;
|
||||
|
||||
Value *LHS = CI->getOperand(1), *RHS = CI->getOperand(2);
|
||||
@ -1241,7 +1241,7 @@ struct PowOpt : public LibCallOptimization {
|
||||
// result type.
|
||||
if (FT->getNumParams() != 2 || FT->getReturnType() != FT->getParamType(0) ||
|
||||
FT->getParamType(0) != FT->getParamType(1) ||
|
||||
!FT->getParamType(0)->isFloatingPoint())
|
||||
!FT->getParamType(0)->isFloatingPointTy())
|
||||
return 0;
|
||||
|
||||
Value *Op1 = CI->getOperand(1), *Op2 = CI->getOperand(2);
|
||||
@ -1295,7 +1295,7 @@ struct Exp2Opt : public LibCallOptimization {
|
||||
// Just make sure this has 1 argument of FP type, which matches the
|
||||
// result type.
|
||||
if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
|
||||
!FT->getParamType(0)->isFloatingPoint())
|
||||
!FT->getParamType(0)->isFloatingPointTy())
|
||||
return 0;
|
||||
|
||||
Value *Op = CI->getOperand(1);
|
||||
@ -1375,7 +1375,7 @@ struct FFSOpt : public LibCallOptimization {
|
||||
// Just make sure this has 2 arguments of the same FP type, which match the
|
||||
// result type.
|
||||
if (FT->getNumParams() != 1 ||
|
||||
!FT->getReturnType()->isInteger(32) ||
|
||||
!FT->getReturnType()->isIntegerTy(32) ||
|
||||
!isa<IntegerType>(FT->getParamType(0)))
|
||||
return 0;
|
||||
|
||||
@ -1411,7 +1411,7 @@ struct IsDigitOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
// We require integer(i32)
|
||||
if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
|
||||
!FT->getParamType(0)->isInteger(32))
|
||||
!FT->getParamType(0)->isIntegerTy(32))
|
||||
return 0;
|
||||
|
||||
// isdigit(c) -> (c-'0') <u 10
|
||||
@ -1432,7 +1432,7 @@ struct IsAsciiOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
// We require integer(i32)
|
||||
if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
|
||||
!FT->getParamType(0)->isInteger(32))
|
||||
!FT->getParamType(0)->isIntegerTy(32))
|
||||
return 0;
|
||||
|
||||
// isascii(c) -> c <u 128
|
||||
@ -1473,7 +1473,7 @@ struct ToAsciiOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
// We require i32(i32)
|
||||
if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
|
||||
!FT->getParamType(0)->isInteger(32))
|
||||
!FT->getParamType(0)->isIntegerTy(32))
|
||||
return 0;
|
||||
|
||||
// isascii(c) -> c & 0x7f
|
||||
|
@ -1077,7 +1077,7 @@ static bool FoldCondBranchOnPHI(BranchInst *BI) {
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
|
||||
ConstantInt *CB;
|
||||
if ((CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i))) &&
|
||||
CB->getType()->isInteger(1)) {
|
||||
CB->getType()->isIntegerTy(1)) {
|
||||
// Okay, we now know that all edges from PredBB should be revectored to
|
||||
// branch to RealDest.
|
||||
BasicBlock *PredBB = PN->getIncomingBlock(i);
|
||||
|
@ -431,13 +431,13 @@ static void AddModuleTypesToPrinter(TypePrinting &TP,
|
||||
// they are used too often to have a single useful name.
|
||||
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
|
||||
const Type *PETy = PTy->getElementType();
|
||||
if ((PETy->isPrimitiveType() || PETy->isInteger()) &&
|
||||
if ((PETy->isPrimitiveType() || PETy->isIntegerTy()) &&
|
||||
!isa<OpaqueType>(PETy))
|
||||
continue;
|
||||
}
|
||||
|
||||
// Likewise don't insert primitives either.
|
||||
if (Ty->isInteger() || Ty->isPrimitiveType())
|
||||
if (Ty->isIntegerTy() || Ty->isPrimitiveType())
|
||||
continue;
|
||||
|
||||
// Get the name as a string and insert it into TypeNames.
|
||||
@ -849,7 +849,7 @@ static void WriteOptimizationInfo(raw_ostream &Out, const User *U) {
|
||||
static void WriteConstantInt(raw_ostream &Out, const Constant *CV,
|
||||
TypePrinting &TypePrinter, SlotTracker *Machine) {
|
||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
|
||||
if (CI->getType()->isInteger(1)) {
|
||||
if (CI->getType()->isIntegerTy(1)) {
|
||||
Out << (CI->getZExtValue() ? "true" : "false");
|
||||
return;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ std::string Attribute::getAsString(Attributes Attrs) {
|
||||
Attributes Attribute::typeIncompatible(const Type *Ty) {
|
||||
Attributes Incompatible = None;
|
||||
|
||||
if (!Ty->isInteger())
|
||||
if (!Ty->isIntegerTy())
|
||||
// Attributes that only apply to integers.
|
||||
Incompatible |= SExt | ZExt;
|
||||
|
||||
|
@ -155,12 +155,12 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
|
||||
|
||||
// Handle integral constant input.
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
|
||||
if (DestTy->isInteger())
|
||||
if (DestTy->isIntegerTy())
|
||||
// Integral -> Integral. This is a no-op because the bit widths must
|
||||
// be the same. Consequently, we just fold to V.
|
||||
return V;
|
||||
|
||||
if (DestTy->isFloatingPoint())
|
||||
if (DestTy->isFloatingPointTy())
|
||||
return ConstantFP::get(DestTy->getContext(),
|
||||
APFloat(CI->getValue(),
|
||||
!DestTy->isPPC_FP128Ty()));
|
||||
@ -364,7 +364,7 @@ static Constant *getFoldedSizeOf(const Type *Ty, const Type *DestTy,
|
||||
// Pointer size doesn't depend on the pointee type, so canonicalize them
|
||||
// to an arbitrary pointee.
|
||||
if (const PointerType *PTy = dyn_cast<PointerType>(Ty))
|
||||
if (!PTy->getElementType()->isInteger(1))
|
||||
if (!PTy->getElementType()->isIntegerTy(1))
|
||||
return
|
||||
getFoldedSizeOf(PointerType::get(IntegerType::get(PTy->getContext(), 1),
|
||||
PTy->getAddressSpace()),
|
||||
@ -429,7 +429,7 @@ static Constant *getFoldedAlignOf(const Type *Ty, const Type *DestTy,
|
||||
// Pointer alignment doesn't depend on the pointee type, so canonicalize them
|
||||
// to an arbitrary pointee.
|
||||
if (const PointerType *PTy = dyn_cast<PointerType>(Ty))
|
||||
if (!PTy->getElementType()->isInteger(1))
|
||||
if (!PTy->getElementType()->isIntegerTy(1))
|
||||
return
|
||||
getFoldedAlignOf(PointerType::get(IntegerType::get(PTy->getContext(),
|
||||
1),
|
||||
@ -629,7 +629,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
|
||||
ConstantInt *CI = cast<ConstantInt>(CE->getOperand(2));
|
||||
if (CI->isOne() &&
|
||||
STy->getNumElements() == 2 &&
|
||||
STy->getElementType(0)->isInteger(1)) {
|
||||
STy->getElementType(0)->isIntegerTy(1)) {
|
||||
return getFoldedAlignOf(STy->getElementType(1), DestTy, false);
|
||||
}
|
||||
}
|
||||
@ -1392,7 +1392,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
|
||||
}
|
||||
|
||||
// i1 can be simplified in many cases.
|
||||
if (C1->getType()->isInteger(1)) {
|
||||
if (C1->getType()->isIntegerTy(1)) {
|
||||
switch (Opcode) {
|
||||
case Instruction::Add:
|
||||
case Instruction::Sub:
|
||||
@ -1458,10 +1458,10 @@ static int IdxCompare(Constant *C1, Constant *C2, const Type *ElTy) {
|
||||
|
||||
// Ok, we have two differing integer indices. Sign extend them to be the same
|
||||
// type. Long is always big enough, so we use it.
|
||||
if (!C1->getType()->isInteger(64))
|
||||
if (!C1->getType()->isIntegerTy(64))
|
||||
C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(C1->getContext()));
|
||||
|
||||
if (!C2->getType()->isInteger(64))
|
||||
if (!C2->getType()->isIntegerTy(64))
|
||||
C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(C1->getContext()));
|
||||
|
||||
if (C1 == C2) return 0; // They are equal
|
||||
@ -1667,7 +1667,7 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
|
||||
// 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()->isInteger())) {
|
||||
(isa<PointerType>(CE1->getType()) || CE1->getType()->isIntegerTy())) {
|
||||
if (CE1->getOpcode() == Instruction::ZExt) isSigned = false;
|
||||
if (CE1->getOpcode() == Instruction::SExt) isSigned = true;
|
||||
return evaluateICmpRelation(CE1Op0,
|
||||
@ -1842,7 +1842,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
}
|
||||
|
||||
// If the comparison is a comparison between two i1's, simplify it.
|
||||
if (C1->getType()->isInteger(1)) {
|
||||
if (C1->getType()->isIntegerTy(1)) {
|
||||
switch(pred) {
|
||||
case ICmpInst::ICMP_EQ:
|
||||
if (isa<ConstantInt>(C2))
|
||||
@ -1931,7 +1931,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
return ConstantVector::get(&ResElts[0], ResElts.size());
|
||||
}
|
||||
|
||||
if (C1->getType()->isFloatingPoint()) {
|
||||
if (C1->getType()->isFloatingPointTy()) {
|
||||
int Result = -1; // -1 = unknown, 0 = known false, 1 = known true.
|
||||
switch (evaluateFCmpRelation(C1, C2)) {
|
||||
default: llvm_unreachable("Unknown relation!");
|
||||
@ -2266,10 +2266,10 @@ Constant *llvm::ConstantFoldGetElementPtr(Constant *C,
|
||||
|
||||
// Before adding, extend both operands to i64 to avoid
|
||||
// overflow trouble.
|
||||
if (!PrevIdx->getType()->isInteger(64))
|
||||
if (!PrevIdx->getType()->isIntegerTy(64))
|
||||
PrevIdx = ConstantExpr::getSExt(PrevIdx,
|
||||
Type::getInt64Ty(Div->getContext()));
|
||||
if (!Div->getType()->isInteger(64))
|
||||
if (!Div->getType()->isIntegerTy(64))
|
||||
Div = ConstantExpr::getSExt(Div,
|
||||
Type::getInt64Ty(Div->getContext()));
|
||||
|
||||
|
@ -404,13 +404,13 @@ ConstantFP* ConstantFP::getNegativeZero(const Type* Ty) {
|
||||
|
||||
Constant* ConstantFP::getZeroValueForNegation(const Type* Ty) {
|
||||
if (const VectorType *PTy = dyn_cast<VectorType>(Ty))
|
||||
if (PTy->getElementType()->isFloatingPoint()) {
|
||||
if (PTy->getElementType()->isFloatingPointTy()) {
|
||||
std::vector<Constant*> zeros(PTy->getNumElements(),
|
||||
getNegativeZero(PTy->getElementType()));
|
||||
return ConstantVector::get(PTy, zeros);
|
||||
}
|
||||
|
||||
if (Ty->isFloatingPoint())
|
||||
if (Ty->isFloatingPointTy())
|
||||
return getNegativeZero(Ty);
|
||||
|
||||
return Constant::getNullValue(Ty);
|
||||
@ -661,13 +661,13 @@ Constant* ConstantVector::get(Constant* const* Vals, unsigned NumVals) {
|
||||
}
|
||||
|
||||
Constant* ConstantExpr::getNSWNeg(Constant* C) {
|
||||
assert(C->getType()->isIntOrIntVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() &&
|
||||
"Cannot NEG a nonintegral value!");
|
||||
return getNSWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
|
||||
}
|
||||
|
||||
Constant* ConstantExpr::getNUWNeg(Constant* C) {
|
||||
assert(C->getType()->isIntOrIntVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() &&
|
||||
"Cannot NEG a nonintegral value!");
|
||||
return getNUWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
|
||||
}
|
||||
@ -969,7 +969,7 @@ void ConstantArray::destroyConstant() {
|
||||
/// if the elements of the array are all ConstantInt's.
|
||||
bool ConstantArray::isString() const {
|
||||
// Check the element type for i8...
|
||||
if (!getType()->getElementType()->isInteger(8))
|
||||
if (!getType()->getElementType()->isIntegerTy(8))
|
||||
return false;
|
||||
// Check the elements to make sure they are all integers, not constant
|
||||
// expressions.
|
||||
@ -984,7 +984,7 @@ bool ConstantArray::isString() const {
|
||||
/// null bytes except its terminator.
|
||||
bool ConstantArray::isCString() const {
|
||||
// Check the element type for i8...
|
||||
if (!getType()->getElementType()->isInteger(8))
|
||||
if (!getType()->getElementType()->isIntegerTy(8))
|
||||
return false;
|
||||
|
||||
// Last element must be a null.
|
||||
@ -1240,17 +1240,17 @@ 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->isInteger() || isa<PointerType>(Ty)) && "Invalid cast");
|
||||
assert((Ty->isIntegerTy() || isa<PointerType>(Ty)) && "Invalid cast");
|
||||
|
||||
if (Ty->isInteger())
|
||||
if (Ty->isIntegerTy())
|
||||
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()->isIntOrIntVector() &&
|
||||
Ty->isIntOrIntVector() && "Invalid cast");
|
||||
assert(C->getType()->isIntOrIntVectorTy() &&
|
||||
Ty->isIntOrIntVectorTy() && "Invalid cast");
|
||||
unsigned SrcBits = C->getType()->getScalarSizeInBits();
|
||||
unsigned DstBits = Ty->getScalarSizeInBits();
|
||||
Instruction::CastOps opcode =
|
||||
@ -1261,7 +1261,7 @@ Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty,
|
||||
}
|
||||
|
||||
Constant *ConstantExpr::getFPCast(Constant *C, const Type *Ty) {
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
"Invalid cast");
|
||||
unsigned SrcBits = C->getType()->getScalarSizeInBits();
|
||||
unsigned DstBits = Ty->getScalarSizeInBits();
|
||||
@ -1278,8 +1278,8 @@ Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVector() && "Trunc operand must be integer");
|
||||
assert(Ty->isIntOrIntVector() && "Trunc produces only integral");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && "Trunc operand must be integer");
|
||||
assert(Ty->isIntOrIntVectorTy() && "Trunc produces only integral");
|
||||
assert(C->getType()->getScalarSizeInBits() > Ty->getScalarSizeInBits()&&
|
||||
"SrcTy must be larger than DestTy for Trunc!");
|
||||
|
||||
@ -1292,8 +1292,8 @@ Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVector() && "SExt operand must be integral");
|
||||
assert(Ty->isIntOrIntVector() && "SExt produces only integer");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && "SExt operand must be integral");
|
||||
assert(Ty->isIntOrIntVectorTy() && "SExt produces only integer");
|
||||
assert(C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&&
|
||||
"SrcTy must be smaller than DestTy for SExt!");
|
||||
|
||||
@ -1306,8 +1306,8 @@ Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVector() && "ZEXt operand must be integral");
|
||||
assert(Ty->isIntOrIntVector() && "ZExt produces only integer");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && "ZEXt operand must be integral");
|
||||
assert(Ty->isIntOrIntVectorTy() && "ZExt produces only integer");
|
||||
assert(C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&&
|
||||
"SrcTy must be smaller than DestTy for ZExt!");
|
||||
|
||||
@ -1320,7 +1320,7 @@ Constant *ConstantExpr::getFPTrunc(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
C->getType()->getScalarSizeInBits() > Ty->getScalarSizeInBits()&&
|
||||
"This is an illegal floating point truncation!");
|
||||
return getFoldedCast(Instruction::FPTrunc, C, Ty);
|
||||
@ -1332,7 +1332,7 @@ Constant *ConstantExpr::getFPExtend(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&&
|
||||
"This is an illegal floating point extension!");
|
||||
return getFoldedCast(Instruction::FPExt, C, Ty);
|
||||
@ -1344,7 +1344,7 @@ Constant *ConstantExpr::getUIToFP(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
"This is an illegal uint to floating point cast!");
|
||||
return getFoldedCast(Instruction::UIToFP, C, Ty);
|
||||
}
|
||||
@ -1355,7 +1355,7 @@ Constant *ConstantExpr::getSIToFP(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
"This is an illegal sint to floating point cast!");
|
||||
return getFoldedCast(Instruction::SIToFP, C, Ty);
|
||||
}
|
||||
@ -1366,7 +1366,7 @@ Constant *ConstantExpr::getFPToUI(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isIntOrIntVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() &&
|
||||
"This is an illegal floating point to uint cast!");
|
||||
return getFoldedCast(Instruction::FPToUI, C, Ty);
|
||||
}
|
||||
@ -1377,19 +1377,19 @@ Constant *ConstantExpr::getFPToSI(Constant *C, const Type *Ty) {
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isIntOrIntVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() &&
|
||||
"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->isInteger() && "PtrToInt destination must be integral");
|
||||
assert(DstTy->isIntegerTy() && "PtrToInt destination must be integral");
|
||||
return getFoldedCast(Instruction::PtrToInt, C, DstTy);
|
||||
}
|
||||
|
||||
Constant *ConstantExpr::getIntToPtr(Constant *C, const Type *DstTy) {
|
||||
assert(C->getType()->isInteger() && "IntToPtr source must be integral");
|
||||
assert(C->getType()->isIntegerTy() && "IntToPtr source must be integral");
|
||||
assert(isa<PointerType>(DstTy) && "IntToPtr destination must be a pointer");
|
||||
return getFoldedCast(Instruction::IntToPtr, C, DstTy);
|
||||
}
|
||||
@ -1449,7 +1449,7 @@ Constant *ConstantExpr::getCompareTy(unsigned short predicate,
|
||||
Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
|
||||
unsigned Flags) {
|
||||
// API compatibility: Adjust integer opcodes to floating-point opcodes.
|
||||
if (C1->getType()->isFPOrFPVector()) {
|
||||
if (C1->getType()->isFPOrFPVectorTy()) {
|
||||
if (Opcode == Instruction::Add) Opcode = Instruction::FAdd;
|
||||
else if (Opcode == Instruction::Sub) Opcode = Instruction::FSub;
|
||||
else if (Opcode == Instruction::Mul) Opcode = Instruction::FMul;
|
||||
@ -1460,51 +1460,51 @@ 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()->isIntOrIntVector() &&
|
||||
assert(C1->getType()->isIntOrIntVectorTy() &&
|
||||
"Tried to create an integer operation on a non-integer type!");
|
||||
break;
|
||||
case Instruction::FAdd:
|
||||
case Instruction::FSub:
|
||||
case Instruction::FMul:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isFPOrFPVector() &&
|
||||
assert(C1->getType()->isFPOrFPVectorTy() &&
|
||||
"Tried to create a floating-point operation on a "
|
||||
"non-floating-point type!");
|
||||
break;
|
||||
case Instruction::UDiv:
|
||||
case Instruction::SDiv:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isIntOrIntVector() &&
|
||||
assert(C1->getType()->isIntOrIntVectorTy() &&
|
||||
"Tried to create an arithmetic operation on a non-arithmetic type!");
|
||||
break;
|
||||
case Instruction::FDiv:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isFPOrFPVector() &&
|
||||
assert(C1->getType()->isFPOrFPVectorTy() &&
|
||||
"Tried to create an arithmetic operation on a non-arithmetic type!");
|
||||
break;
|
||||
case Instruction::URem:
|
||||
case Instruction::SRem:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isIntOrIntVector() &&
|
||||
assert(C1->getType()->isIntOrIntVectorTy() &&
|
||||
"Tried to create an arithmetic operation on a non-arithmetic type!");
|
||||
break;
|
||||
case Instruction::FRem:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isFPOrFPVector() &&
|
||||
assert(C1->getType()->isFPOrFPVectorTy() &&
|
||||
"Tried to create an arithmetic operation on a non-arithmetic type!");
|
||||
break;
|
||||
case Instruction::And:
|
||||
case Instruction::Or:
|
||||
case Instruction::Xor:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isIntOrIntVector() &&
|
||||
assert(C1->getType()->isIntOrIntVectorTy() &&
|
||||
"Tried to create a logical operation on a non-integral type!");
|
||||
break;
|
||||
case Instruction::Shl:
|
||||
case Instruction::LShr:
|
||||
case Instruction::AShr:
|
||||
assert(C1->getType() == C2->getType() && "Op types should be identical!");
|
||||
assert(C1->getType()->isIntOrIntVector() &&
|
||||
assert(C1->getType()->isIntOrIntVectorTy() &&
|
||||
"Tried to create a shift operation on a non-integer type!");
|
||||
break;
|
||||
default:
|
||||
@ -1729,7 +1729,7 @@ Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
|
||||
Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
|
||||
assert(isa<VectorType>(Val->getType()) &&
|
||||
"Tried to create extractelement operation on non-vector type!");
|
||||
assert(Idx->getType()->isInteger(32) &&
|
||||
assert(Idx->getType()->isIntegerTy(32) &&
|
||||
"Extractelement index must be i32 type!");
|
||||
return getExtractElementTy(cast<VectorType>(Val->getType())->getElementType(),
|
||||
Val, Idx);
|
||||
@ -1755,7 +1755,7 @@ Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt,
|
||||
"Tried to create insertelement operation on non-vector type!");
|
||||
assert(Elt->getType() == cast<VectorType>(Val->getType())->getElementType()
|
||||
&& "Insertelement types must match!");
|
||||
assert(Idx->getType()->isInteger(32) &&
|
||||
assert(Idx->getType()->isIntegerTy(32) &&
|
||||
"Insertelement index must be i32 type!");
|
||||
return getInsertElementTy(Val->getType(), Val, Elt, Idx);
|
||||
}
|
||||
@ -1839,9 +1839,9 @@ Constant *ConstantExpr::getExtractValue(Constant *Agg,
|
||||
|
||||
Constant* ConstantExpr::getNeg(Constant* C) {
|
||||
// API compatibility: Adjust integer opcodes to floating-point opcodes.
|
||||
if (C->getType()->isFPOrFPVector())
|
||||
if (C->getType()->isFPOrFPVectorTy())
|
||||
return getFNeg(C);
|
||||
assert(C->getType()->isIntOrIntVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() &&
|
||||
"Cannot NEG a nonintegral value!");
|
||||
return get(Instruction::Sub,
|
||||
ConstantFP::getZeroValueForNegation(C->getType()),
|
||||
@ -1849,7 +1849,7 @@ Constant* ConstantExpr::getNeg(Constant* C) {
|
||||
}
|
||||
|
||||
Constant* ConstantExpr::getFNeg(Constant* C) {
|
||||
assert(C->getType()->isFPOrFPVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() &&
|
||||
"Cannot FNEG a non-floating-point value!");
|
||||
return get(Instruction::FSub,
|
||||
ConstantFP::getZeroValueForNegation(C->getType()),
|
||||
@ -1857,7 +1857,7 @@ Constant* ConstantExpr::getFNeg(Constant* C) {
|
||||
}
|
||||
|
||||
Constant* ConstantExpr::getNot(Constant* C) {
|
||||
assert(C->getType()->isIntOrIntVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() &&
|
||||
"Cannot NOT a nonintegral value!");
|
||||
return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType()));
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ BasicBlock *UnreachableInst::getSuccessorV(unsigned idx) const {
|
||||
|
||||
void BranchInst::AssertOK() {
|
||||
if (isConditional())
|
||||
assert(getCondition()->getType()->isInteger(1) &&
|
||||
assert(getCondition()->getType()->isIntegerTy(1) &&
|
||||
"May only branch on boolean predicates!");
|
||||
}
|
||||
|
||||
@ -892,7 +892,7 @@ static Value *getAISize(LLVMContext &Context, Value *Amt) {
|
||||
else {
|
||||
assert(!isa<BasicBlock>(Amt) &&
|
||||
"Passed basic block into allocation size parameter! Use other ctor");
|
||||
assert(Amt->getType()->isInteger(32) &&
|
||||
assert(Amt->getType()->isIntegerTy(32) &&
|
||||
"Allocation array size is not a 32-bit integer!");
|
||||
}
|
||||
return Amt;
|
||||
@ -1391,7 +1391,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
|
||||
|
||||
|
||||
bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
|
||||
if (!isa<VectorType>(Val->getType()) || !Index->getType()->isInteger(32))
|
||||
if (!isa<VectorType>(Val->getType()) || !Index->getType()->isIntegerTy(32))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -1438,7 +1438,7 @@ bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
|
||||
if (Elt->getType() != cast<VectorType>(Vec->getType())->getElementType())
|
||||
return false;// Second operand of insertelement must be vector element type.
|
||||
|
||||
if (!Index->getType()->isInteger(32))
|
||||
if (!Index->getType()->isIntegerTy(32))
|
||||
return false; // Third operand of insertelement must be i32.
|
||||
return true;
|
||||
}
|
||||
@ -1490,7 +1490,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
|
||||
|
||||
const VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
|
||||
if (!isa<Constant>(Mask) || MaskTy == 0 ||
|
||||
!MaskTy->getElementType()->isInteger(32))
|
||||
!MaskTy->getElementType()->isIntegerTy(32))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -1632,7 +1632,7 @@ const Type* ExtractValueInst::getIndexedType(const Type *Agg,
|
||||
static BinaryOperator::BinaryOps AdjustIType(BinaryOperator::BinaryOps iType,
|
||||
const Type *Ty) {
|
||||
// API compatibility: Adjust integer opcodes to floating-point opcodes.
|
||||
if (Ty->isFPOrFPVector()) {
|
||||
if (Ty->isFPOrFPVectorTy()) {
|
||||
if (iType == BinaryOperator::Add) iType = BinaryOperator::FAdd;
|
||||
else if (iType == BinaryOperator::Sub) iType = BinaryOperator::FSub;
|
||||
else if (iType == BinaryOperator::Mul) iType = BinaryOperator::FMul;
|
||||
@ -1678,14 +1678,14 @@ void BinaryOperator::init(BinaryOps iType) {
|
||||
case Mul:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Arithmetic operation should return same type as operands!");
|
||||
assert(getType()->isIntOrIntVector() &&
|
||||
assert(getType()->isIntOrIntVectorTy() &&
|
||||
"Tried to create an integer operation on a non-integer type!");
|
||||
break;
|
||||
case FAdd: case FSub:
|
||||
case FMul:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Arithmetic operation should return same type as operands!");
|
||||
assert(getType()->isFPOrFPVector() &&
|
||||
assert(getType()->isFPOrFPVectorTy() &&
|
||||
"Tried to create a floating-point operation on a "
|
||||
"non-floating-point type!");
|
||||
break;
|
||||
@ -1693,28 +1693,28 @@ void BinaryOperator::init(BinaryOps iType) {
|
||||
case SDiv:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Arithmetic operation should return same type as operands!");
|
||||
assert((getType()->isInteger() || (isa<VectorType>(getType()) &&
|
||||
cast<VectorType>(getType())->getElementType()->isInteger())) &&
|
||||
assert((getType()->isIntegerTy() || (isa<VectorType>(getType()) &&
|
||||
cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
|
||||
"Incorrect operand type (not integer) for S/UDIV");
|
||||
break;
|
||||
case FDiv:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Arithmetic operation should return same type as operands!");
|
||||
assert(getType()->isFPOrFPVector() &&
|
||||
assert(getType()->isFPOrFPVectorTy() &&
|
||||
"Incorrect operand type (not floating point) for FDIV");
|
||||
break;
|
||||
case URem:
|
||||
case SRem:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Arithmetic operation should return same type as operands!");
|
||||
assert((getType()->isInteger() || (isa<VectorType>(getType()) &&
|
||||
cast<VectorType>(getType())->getElementType()->isInteger())) &&
|
||||
assert((getType()->isIntegerTy() || (isa<VectorType>(getType()) &&
|
||||
cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
|
||||
"Incorrect operand type (not integer) for S/UREM");
|
||||
break;
|
||||
case FRem:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Arithmetic operation should return same type as operands!");
|
||||
assert(getType()->isFPOrFPVector() &&
|
||||
assert(getType()->isFPOrFPVectorTy() &&
|
||||
"Incorrect operand type (not floating point) for FREM");
|
||||
break;
|
||||
case Shl:
|
||||
@ -1722,18 +1722,18 @@ void BinaryOperator::init(BinaryOps iType) {
|
||||
case AShr:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Shift operation should return same type as operands!");
|
||||
assert((getType()->isInteger() ||
|
||||
assert((getType()->isIntegerTy() ||
|
||||
(isa<VectorType>(getType()) &&
|
||||
cast<VectorType>(getType())->getElementType()->isInteger())) &&
|
||||
cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
|
||||
"Tried to create a shift operation on a non-integral type!");
|
||||
break;
|
||||
case And: case Or:
|
||||
case Xor:
|
||||
assert(getType() == LHS->getType() &&
|
||||
"Logical operation should return same type as operands!");
|
||||
assert((getType()->isInteger() ||
|
||||
assert((getType()->isIntegerTy() ||
|
||||
(isa<VectorType>(getType()) &&
|
||||
cast<VectorType>(getType())->getElementType()->isInteger())) &&
|
||||
cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
|
||||
"Tried to create a logical operation on a non-integral type!");
|
||||
break;
|
||||
default:
|
||||
@ -1960,7 +1960,8 @@ bool CastInst::isIntegerCast() const {
|
||||
case Instruction::Trunc:
|
||||
return true;
|
||||
case Instruction::BitCast:
|
||||
return getOperand(0)->getType()->isInteger() && getType()->isInteger();
|
||||
return getOperand(0)->getType()->isIntegerTy() &&
|
||||
getType()->isIntegerTy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2093,25 +2094,25 @@ unsigned CastInst::isEliminableCastPair(
|
||||
// no-op cast in second op implies firstOp as long as the DestTy
|
||||
// is integer and we are not converting between a vector and a
|
||||
// non vector type.
|
||||
if (!isa<VectorType>(SrcTy) && DstTy->isInteger())
|
||||
if (!isa<VectorType>(SrcTy) && DstTy->isIntegerTy())
|
||||
return firstOp;
|
||||
return 0;
|
||||
case 4:
|
||||
// no-op cast in second op implies firstOp as long as the DestTy
|
||||
// is floating point.
|
||||
if (DstTy->isFloatingPoint())
|
||||
if (DstTy->isFloatingPointTy())
|
||||
return firstOp;
|
||||
return 0;
|
||||
case 5:
|
||||
// no-op cast in first op implies secondOp as long as the SrcTy
|
||||
// is an integer.
|
||||
if (SrcTy->isInteger())
|
||||
if (SrcTy->isIntegerTy())
|
||||
return secondOp;
|
||||
return 0;
|
||||
case 6:
|
||||
// no-op cast in first op implies secondOp as long as the SrcTy
|
||||
// is a floating point.
|
||||
if (SrcTy->isFloatingPoint())
|
||||
if (SrcTy->isFloatingPointTy())
|
||||
return secondOp;
|
||||
return 0;
|
||||
case 7: {
|
||||
@ -2274,10 +2275,10 @@ CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
|
||||
const Twine &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(isa<PointerType>(S->getType()) && "Invalid cast");
|
||||
assert((Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Invalid cast");
|
||||
|
||||
if (Ty->isInteger())
|
||||
if (Ty->isIntegerTy())
|
||||
return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
|
||||
}
|
||||
@ -2287,10 +2288,10 @@ CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
|
||||
const Twine &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(isa<PointerType>(S->getType()) && "Invalid cast");
|
||||
assert((Ty->isInteger() || isa<PointerType>(Ty)) &&
|
||||
assert((Ty->isIntegerTy() || isa<PointerType>(Ty)) &&
|
||||
"Invalid cast");
|
||||
|
||||
if (Ty->isInteger())
|
||||
if (Ty->isIntegerTy())
|
||||
return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
|
||||
return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
|
||||
}
|
||||
@ -2298,7 +2299,7 @@ CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
|
||||
CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
|
||||
bool isSigned, const Twine &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(C->getType()->isIntOrIntVector() && Ty->isIntOrIntVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() && Ty->isIntOrIntVectorTy() &&
|
||||
"Invalid integer cast");
|
||||
unsigned SrcBits = C->getType()->getScalarSizeInBits();
|
||||
unsigned DstBits = Ty->getScalarSizeInBits();
|
||||
@ -2312,7 +2313,7 @@ CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
|
||||
bool isSigned, const Twine &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(C->getType()->isIntOrIntVector() && Ty->isIntOrIntVector() &&
|
||||
assert(C->getType()->isIntOrIntVectorTy() && Ty->isIntOrIntVectorTy() &&
|
||||
"Invalid cast");
|
||||
unsigned SrcBits = C->getType()->getScalarSizeInBits();
|
||||
unsigned DstBits = Ty->getScalarSizeInBits();
|
||||
@ -2326,7 +2327,7 @@ CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
|
||||
const Twine &Name,
|
||||
Instruction *InsertBefore) {
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
"Invalid cast");
|
||||
unsigned SrcBits = C->getType()->getScalarSizeInBits();
|
||||
unsigned DstBits = Ty->getScalarSizeInBits();
|
||||
@ -2339,7 +2340,7 @@ CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
|
||||
CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
|
||||
const Twine &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
"Invalid cast");
|
||||
unsigned SrcBits = C->getType()->getScalarSizeInBits();
|
||||
unsigned DstBits = Ty->getScalarSizeInBits();
|
||||
@ -2363,10 +2364,10 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) {
|
||||
unsigned DestBits = DestTy->getScalarSizeInBits(); // 0 for ptr
|
||||
|
||||
// Run through the possibilities ...
|
||||
if (DestTy->isInteger()) { // Casting to integral
|
||||
if (SrcTy->isInteger()) { // Casting from integral
|
||||
if (DestTy->isIntegerTy()) { // Casting to integral
|
||||
if (SrcTy->isIntegerTy()) { // Casting from integral
|
||||
return true;
|
||||
} else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
|
||||
} else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt
|
||||
return true;
|
||||
} else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) {
|
||||
// Casting from vector
|
||||
@ -2374,10 +2375,10 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) {
|
||||
} else { // Casting from something else
|
||||
return isa<PointerType>(SrcTy);
|
||||
}
|
||||
} else if (DestTy->isFloatingPoint()) { // Casting to floating pt
|
||||
if (SrcTy->isInteger()) { // Casting from integral
|
||||
} else if (DestTy->isFloatingPointTy()) { // Casting to floating pt
|
||||
if (SrcTy->isIntegerTy()) { // Casting from integral
|
||||
return true;
|
||||
} else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
|
||||
} else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt
|
||||
return true;
|
||||
} else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) {
|
||||
// Casting from vector
|
||||
@ -2396,7 +2397,7 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) {
|
||||
} else if (isa<PointerType>(DestTy)) { // Casting to pointer
|
||||
if (isa<PointerType>(SrcTy)) { // Casting from pointer
|
||||
return true;
|
||||
} else if (SrcTy->isInteger()) { // Casting from integral
|
||||
} else if (SrcTy->isIntegerTy()) { // Casting from integral
|
||||
return true;
|
||||
} else { // Casting from something else
|
||||
return false;
|
||||
@ -2425,8 +2426,8 @@ CastInst::getCastOpcode(
|
||||
"Only first class types are castable!");
|
||||
|
||||
// Run through the possibilities ...
|
||||
if (DestTy->isInteger()) { // Casting to integral
|
||||
if (SrcTy->isInteger()) { // Casting from integral
|
||||
if (DestTy->isIntegerTy()) { // Casting to integral
|
||||
if (SrcTy->isIntegerTy()) { // Casting from integral
|
||||
if (DestBits < SrcBits)
|
||||
return Trunc; // int -> smaller int
|
||||
else if (DestBits > SrcBits) { // its an extension
|
||||
@ -2437,7 +2438,7 @@ CastInst::getCastOpcode(
|
||||
} else {
|
||||
return BitCast; // Same size, No-op cast
|
||||
}
|
||||
} else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
|
||||
} else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt
|
||||
if (DestIsSigned)
|
||||
return FPToSI; // FP -> sint
|
||||
else
|
||||
@ -2452,13 +2453,13 @@ CastInst::getCastOpcode(
|
||||
"Casting from a value that is not first-class type");
|
||||
return PtrToInt; // ptr -> int
|
||||
}
|
||||
} else if (DestTy->isFloatingPoint()) { // Casting to floating pt
|
||||
if (SrcTy->isInteger()) { // Casting from integral
|
||||
} else if (DestTy->isFloatingPointTy()) { // Casting to floating pt
|
||||
if (SrcTy->isIntegerTy()) { // Casting from integral
|
||||
if (SrcIsSigned)
|
||||
return SIToFP; // sint -> FP
|
||||
else
|
||||
return UIToFP; // uint -> FP
|
||||
} else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
|
||||
} else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt
|
||||
if (DestBits < SrcBits) {
|
||||
return FPTrunc; // FP -> smaller FP
|
||||
} else if (DestBits > SrcBits) {
|
||||
@ -2488,7 +2489,7 @@ CastInst::getCastOpcode(
|
||||
} else if (isa<PointerType>(DestTy)) {
|
||||
if (isa<PointerType>(SrcTy)) {
|
||||
return BitCast; // ptr -> ptr
|
||||
} else if (SrcTy->isInteger()) {
|
||||
} else if (SrcTy->isIntegerTy()) {
|
||||
return IntToPtr; // int -> ptr
|
||||
} else {
|
||||
assert(!"Casting pointer to other than pointer or int");
|
||||
@ -2528,46 +2529,46 @@ CastInst::castIsValid(Instruction::CastOps op, Value *S, const Type *DstTy) {
|
||||
switch (op) {
|
||||
default: return false; // This is an input error
|
||||
case Instruction::Trunc:
|
||||
return SrcTy->isIntOrIntVector() &&
|
||||
DstTy->isIntOrIntVector()&& SrcBitSize > DstBitSize;
|
||||
return SrcTy->isIntOrIntVectorTy() &&
|
||||
DstTy->isIntOrIntVectorTy()&& SrcBitSize > DstBitSize;
|
||||
case Instruction::ZExt:
|
||||
return SrcTy->isIntOrIntVector() &&
|
||||
DstTy->isIntOrIntVector()&& SrcBitSize < DstBitSize;
|
||||
return SrcTy->isIntOrIntVectorTy() &&
|
||||
DstTy->isIntOrIntVectorTy()&& SrcBitSize < DstBitSize;
|
||||
case Instruction::SExt:
|
||||
return SrcTy->isIntOrIntVector() &&
|
||||
DstTy->isIntOrIntVector()&& SrcBitSize < DstBitSize;
|
||||
return SrcTy->isIntOrIntVectorTy() &&
|
||||
DstTy->isIntOrIntVectorTy()&& SrcBitSize < DstBitSize;
|
||||
case Instruction::FPTrunc:
|
||||
return SrcTy->isFPOrFPVector() &&
|
||||
DstTy->isFPOrFPVector() &&
|
||||
return SrcTy->isFPOrFPVectorTy() &&
|
||||
DstTy->isFPOrFPVectorTy() &&
|
||||
SrcBitSize > DstBitSize;
|
||||
case Instruction::FPExt:
|
||||
return SrcTy->isFPOrFPVector() &&
|
||||
DstTy->isFPOrFPVector() &&
|
||||
return SrcTy->isFPOrFPVectorTy() &&
|
||||
DstTy->isFPOrFPVectorTy() &&
|
||||
SrcBitSize < DstBitSize;
|
||||
case Instruction::UIToFP:
|
||||
case Instruction::SIToFP:
|
||||
if (const VectorType *SVTy = dyn_cast<VectorType>(SrcTy)) {
|
||||
if (const VectorType *DVTy = dyn_cast<VectorType>(DstTy)) {
|
||||
return SVTy->getElementType()->isIntOrIntVector() &&
|
||||
DVTy->getElementType()->isFPOrFPVector() &&
|
||||
return SVTy->getElementType()->isIntOrIntVectorTy() &&
|
||||
DVTy->getElementType()->isFPOrFPVectorTy() &&
|
||||
SVTy->getNumElements() == DVTy->getNumElements();
|
||||
}
|
||||
}
|
||||
return SrcTy->isIntOrIntVector() && DstTy->isFPOrFPVector();
|
||||
return SrcTy->isIntOrIntVectorTy() && DstTy->isFPOrFPVectorTy();
|
||||
case Instruction::FPToUI:
|
||||
case Instruction::FPToSI:
|
||||
if (const VectorType *SVTy = dyn_cast<VectorType>(SrcTy)) {
|
||||
if (const VectorType *DVTy = dyn_cast<VectorType>(DstTy)) {
|
||||
return SVTy->getElementType()->isFPOrFPVector() &&
|
||||
DVTy->getElementType()->isIntOrIntVector() &&
|
||||
return SVTy->getElementType()->isFPOrFPVectorTy() &&
|
||||
DVTy->getElementType()->isIntOrIntVectorTy() &&
|
||||
SVTy->getNumElements() == DVTy->getNumElements();
|
||||
}
|
||||
}
|
||||
return SrcTy->isFPOrFPVector() && DstTy->isIntOrIntVector();
|
||||
return SrcTy->isFPOrFPVectorTy() && DstTy->isIntOrIntVectorTy();
|
||||
case Instruction::PtrToInt:
|
||||
return isa<PointerType>(SrcTy) && DstTy->isInteger();
|
||||
return isa<PointerType>(SrcTy) && DstTy->isIntegerTy();
|
||||
case Instruction::IntToPtr:
|
||||
return SrcTy->isInteger() && isa<PointerType>(DstTy);
|
||||
return SrcTy->isIntegerTy() && 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.
|
||||
|
@ -127,32 +127,32 @@ const Type *Type::getScalarType() const {
|
||||
return this;
|
||||
}
|
||||
|
||||
/// isInteger - Return true if this is an IntegerType of the specified width.
|
||||
bool Type::isInteger(unsigned Bitwidth) const {
|
||||
return isInteger() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
|
||||
/// isIntegerTy - Return true if this is an IntegerType of the specified width.
|
||||
bool Type::isIntegerTy(unsigned Bitwidth) const {
|
||||
return isIntegerTy() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
|
||||
}
|
||||
|
||||
/// isIntOrIntVector - Return true if this is an integer type or a vector of
|
||||
/// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
|
||||
/// integer types.
|
||||
///
|
||||
bool Type::isIntOrIntVector() const {
|
||||
if (isInteger())
|
||||
bool Type::isIntOrIntVectorTy() const {
|
||||
if (isIntegerTy())
|
||||
return true;
|
||||
if (ID != Type::VectorTyID) return false;
|
||||
|
||||
return cast<VectorType>(this)->getElementType()->isInteger();
|
||||
return cast<VectorType>(this)->getElementType()->isIntegerTy();
|
||||
}
|
||||
|
||||
/// isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
|
||||
/// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP types.
|
||||
///
|
||||
bool Type::isFPOrFPVector() const {
|
||||
bool Type::isFPOrFPVectorTy() const {
|
||||
if (ID == Type::FloatTyID || ID == Type::DoubleTyID ||
|
||||
ID == Type::FP128TyID || ID == Type::X86_FP80TyID ||
|
||||
ID == Type::PPC_FP128TyID)
|
||||
return true;
|
||||
if (ID != Type::VectorTyID) return false;
|
||||
|
||||
return cast<VectorType>(this)->getElementType()->isFloatingPoint();
|
||||
return cast<VectorType>(this)->getElementType()->isFloatingPointTy();
|
||||
}
|
||||
|
||||
// canLosslesslyBitCastTo - Return true if this type can be converted to
|
||||
@ -207,7 +207,7 @@ unsigned Type::getScalarSizeInBits() const {
|
||||
int Type::getFPMantissaWidth() const {
|
||||
if (const VectorType *VTy = dyn_cast<VectorType>(this))
|
||||
return VTy->getElementType()->getFPMantissaWidth();
|
||||
assert(isFloatingPoint() && "Not a floating point type!");
|
||||
assert(isFloatingPointTy() && "Not a floating point type!");
|
||||
if (ID == FloatTyID) return 24;
|
||||
if (ID == DoubleTyID) return 53;
|
||||
if (ID == X86_FP80TyID) return 64;
|
||||
@ -288,7 +288,7 @@ std::string Type::getDescription() const {
|
||||
|
||||
bool StructType::indexValid(const Value *V) const {
|
||||
// Structure indexes require 32-bit integer constants.
|
||||
if (V->getType()->isInteger(32))
|
||||
if (V->getType()->isIntegerTy(32))
|
||||
if (const ConstantInt *CU = dyn_cast<ConstantInt>(V))
|
||||
return indexValid(CU->getZExtValue());
|
||||
return false;
|
||||
@ -314,7 +314,7 @@ const Type *StructType::getTypeAtIndex(unsigned Idx) const {
|
||||
|
||||
bool UnionType::indexValid(const Value *V) const {
|
||||
// Union indexes require 32-bit integer constants.
|
||||
if (V->getType()->isInteger(32))
|
||||
if (V->getType()->isIntegerTy(32))
|
||||
if (const ConstantInt *CU = dyn_cast<ConstantInt>(V))
|
||||
return indexValid(CU->getZExtValue());
|
||||
return false;
|
||||
@ -911,7 +911,7 @@ VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
|
||||
}
|
||||
|
||||
bool VectorType::isValidElementType(const Type *ElemTy) {
|
||||
return ElemTy->isInteger() || ElemTy->isFloatingPoint() ||
|
||||
return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
|
||||
isa<OpaqueType>(ElemTy);
|
||||
}
|
||||
|
||||
@ -1000,7 +1000,7 @@ UnionType *UnionType::get(const Type *type, ...) {
|
||||
|
||||
bool UnionType::isValidElementType(const Type *ElemTy) {
|
||||
return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
|
||||
!ElemTy->isMetadataTy() && !ElemTy->isFunction();
|
||||
!ElemTy->isMetadataTy() && !ElemTy->isFunctionTy();
|
||||
}
|
||||
|
||||
int UnionType::getElementTypeIndex(const Type *ElemTy) const {
|
||||
|
@ -36,12 +36,12 @@ EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT,
|
||||
|
||||
bool EVT::isExtendedFloatingPoint() const {
|
||||
assert(isExtended() && "Type is not extended!");
|
||||
return LLVMTy->isFPOrFPVector();
|
||||
return LLVMTy->isFPOrFPVectorTy();
|
||||
}
|
||||
|
||||
bool EVT::isExtendedInteger() const {
|
||||
assert(isExtended() && "Type is not extended!");
|
||||
return LLVMTy->isIntOrIntVector();
|
||||
return LLVMTy->isIntOrIntVectorTy();
|
||||
}
|
||||
|
||||
bool EVT::isExtendedVector() const {
|
||||
|
@ -821,8 +821,8 @@ void Verifier::visitTruncInst(TruncInst &I) {
|
||||
unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
|
||||
unsigned DestBitSize = DestTy->getScalarSizeInBits();
|
||||
|
||||
Assert1(SrcTy->isIntOrIntVector(), "Trunc only operates on integer", &I);
|
||||
Assert1(DestTy->isIntOrIntVector(), "Trunc only produces integer", &I);
|
||||
Assert1(SrcTy->isIntOrIntVectorTy(), "Trunc only operates on integer", &I);
|
||||
Assert1(DestTy->isIntOrIntVectorTy(), "Trunc only produces integer", &I);
|
||||
Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
|
||||
"trunc source and destination must both be a vector or neither", &I);
|
||||
Assert1(SrcBitSize > DestBitSize,"DestTy too big for Trunc", &I);
|
||||
@ -836,8 +836,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->isIntOrIntVector(), "ZExt only operates on integer", &I);
|
||||
Assert1(DestTy->isIntOrIntVector(), "ZExt only produces an integer", &I);
|
||||
Assert1(SrcTy->isIntOrIntVectorTy(), "ZExt only operates on integer", &I);
|
||||
Assert1(DestTy->isIntOrIntVectorTy(), "ZExt only produces an integer", &I);
|
||||
Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
|
||||
"zext source and destination must both be a vector or neither", &I);
|
||||
unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
|
||||
@ -857,8 +857,8 @@ void Verifier::visitSExtInst(SExtInst &I) {
|
||||
unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
|
||||
unsigned DestBitSize = DestTy->getScalarSizeInBits();
|
||||
|
||||
Assert1(SrcTy->isIntOrIntVector(), "SExt only operates on integer", &I);
|
||||
Assert1(DestTy->isIntOrIntVector(), "SExt only produces an integer", &I);
|
||||
Assert1(SrcTy->isIntOrIntVectorTy(), "SExt only operates on integer", &I);
|
||||
Assert1(DestTy->isIntOrIntVectorTy(), "SExt only produces an integer", &I);
|
||||
Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
|
||||
"sext source and destination must both be a vector or neither", &I);
|
||||
Assert1(SrcBitSize < DestBitSize,"Type too small for SExt", &I);
|
||||
@ -874,8 +874,8 @@ void Verifier::visitFPTruncInst(FPTruncInst &I) {
|
||||
unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
|
||||
unsigned DestBitSize = DestTy->getScalarSizeInBits();
|
||||
|
||||
Assert1(SrcTy->isFPOrFPVector(),"FPTrunc only operates on FP", &I);
|
||||
Assert1(DestTy->isFPOrFPVector(),"FPTrunc only produces an FP", &I);
|
||||
Assert1(SrcTy->isFPOrFPVectorTy(),"FPTrunc only operates on FP", &I);
|
||||
Assert1(DestTy->isFPOrFPVectorTy(),"FPTrunc only produces an FP", &I);
|
||||
Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
|
||||
"fptrunc source and destination must both be a vector or neither",&I);
|
||||
Assert1(SrcBitSize > DestBitSize,"DestTy too big for FPTrunc", &I);
|
||||
@ -892,8 +892,8 @@ void Verifier::visitFPExtInst(FPExtInst &I) {
|
||||
unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
|
||||
unsigned DestBitSize = DestTy->getScalarSizeInBits();
|
||||
|
||||
Assert1(SrcTy->isFPOrFPVector(),"FPExt only operates on FP", &I);
|
||||
Assert1(DestTy->isFPOrFPVector(),"FPExt only produces an FP", &I);
|
||||
Assert1(SrcTy->isFPOrFPVectorTy(),"FPExt only operates on FP", &I);
|
||||
Assert1(DestTy->isFPOrFPVectorTy(),"FPExt only produces an FP", &I);
|
||||
Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
|
||||
"fpext source and destination must both be a vector or neither", &I);
|
||||
Assert1(SrcBitSize < DestBitSize,"DestTy too small for FPExt", &I);
|
||||
@ -911,9 +911,9 @@ void Verifier::visitUIToFPInst(UIToFPInst &I) {
|
||||
|
||||
Assert1(SrcVec == DstVec,
|
||||
"UIToFP source and dest must both be vector or scalar", &I);
|
||||
Assert1(SrcTy->isIntOrIntVector(),
|
||||
Assert1(SrcTy->isIntOrIntVectorTy(),
|
||||
"UIToFP source must be integer or integer vector", &I);
|
||||
Assert1(DestTy->isFPOrFPVector(),
|
||||
Assert1(DestTy->isFPOrFPVectorTy(),
|
||||
"UIToFP result must be FP or FP vector", &I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
@ -934,9 +934,9 @@ void Verifier::visitSIToFPInst(SIToFPInst &I) {
|
||||
|
||||
Assert1(SrcVec == DstVec,
|
||||
"SIToFP source and dest must both be vector or scalar", &I);
|
||||
Assert1(SrcTy->isIntOrIntVector(),
|
||||
Assert1(SrcTy->isIntOrIntVectorTy(),
|
||||
"SIToFP source must be integer or integer vector", &I);
|
||||
Assert1(DestTy->isFPOrFPVector(),
|
||||
Assert1(DestTy->isFPOrFPVectorTy(),
|
||||
"SIToFP result must be FP or FP vector", &I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
@ -957,8 +957,9 @@ void Verifier::visitFPToUIInst(FPToUIInst &I) {
|
||||
|
||||
Assert1(SrcVec == DstVec,
|
||||
"FPToUI source and dest must both be vector or scalar", &I);
|
||||
Assert1(SrcTy->isFPOrFPVector(), "FPToUI source must be FP or FP vector", &I);
|
||||
Assert1(DestTy->isIntOrIntVector(),
|
||||
Assert1(SrcTy->isFPOrFPVectorTy(), "FPToUI source must be FP or FP vector",
|
||||
&I);
|
||||
Assert1(DestTy->isIntOrIntVectorTy(),
|
||||
"FPToUI result must be integer or integer vector", &I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
@ -979,9 +980,9 @@ void Verifier::visitFPToSIInst(FPToSIInst &I) {
|
||||
|
||||
Assert1(SrcVec == DstVec,
|
||||
"FPToSI source and dest must both be vector or scalar", &I);
|
||||
Assert1(SrcTy->isFPOrFPVector(),
|
||||
Assert1(SrcTy->isFPOrFPVectorTy(),
|
||||
"FPToSI source must be FP or FP vector", &I);
|
||||
Assert1(DestTy->isIntOrIntVector(),
|
||||
Assert1(DestTy->isIntOrIntVectorTy(),
|
||||
"FPToSI result must be integer or integer vector", &I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
@ -998,7 +999,7 @@ void Verifier::visitPtrToIntInst(PtrToIntInst &I) {
|
||||
const Type *DestTy = I.getType();
|
||||
|
||||
Assert1(isa<PointerType>(SrcTy), "PtrToInt source must be pointer", &I);
|
||||
Assert1(DestTy->isInteger(), "PtrToInt result must be integral", &I);
|
||||
Assert1(DestTy->isIntegerTy(), "PtrToInt result must be integral", &I);
|
||||
|
||||
visitInstruction(I);
|
||||
}
|
||||
@ -1008,7 +1009,7 @@ void Verifier::visitIntToPtrInst(IntToPtrInst &I) {
|
||||
const Type *SrcTy = I.getOperand(0)->getType();
|
||||
const Type *DestTy = I.getType();
|
||||
|
||||
Assert1(SrcTy->isInteger(), "IntToPtr source must be an integral", &I);
|
||||
Assert1(SrcTy->isIntegerTy(), "IntToPtr source must be an integral", &I);
|
||||
Assert1(isa<PointerType>(DestTy), "IntToPtr result must be a pointer",&I);
|
||||
|
||||
visitInstruction(I);
|
||||
@ -1151,7 +1152,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
|
||||
case Instruction::UDiv:
|
||||
case Instruction::SRem:
|
||||
case Instruction::URem:
|
||||
Assert1(B.getType()->isIntOrIntVector(),
|
||||
Assert1(B.getType()->isIntOrIntVectorTy(),
|
||||
"Integer arithmetic operators only work with integral types!", &B);
|
||||
Assert1(B.getType() == B.getOperand(0)->getType(),
|
||||
"Integer arithmetic operators must have same type "
|
||||
@ -1164,7 +1165,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
|
||||
case Instruction::FMul:
|
||||
case Instruction::FDiv:
|
||||
case Instruction::FRem:
|
||||
Assert1(B.getType()->isFPOrFPVector(),
|
||||
Assert1(B.getType()->isFPOrFPVectorTy(),
|
||||
"Floating-point arithmetic operators only work with "
|
||||
"floating-point types!", &B);
|
||||
Assert1(B.getType() == B.getOperand(0)->getType(),
|
||||
@ -1175,7 +1176,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
|
||||
case Instruction::And:
|
||||
case Instruction::Or:
|
||||
case Instruction::Xor:
|
||||
Assert1(B.getType()->isIntOrIntVector(),
|
||||
Assert1(B.getType()->isIntOrIntVectorTy(),
|
||||
"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!",
|
||||
@ -1184,7 +1185,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
|
||||
case Instruction::Shl:
|
||||
case Instruction::LShr:
|
||||
case Instruction::AShr:
|
||||
Assert1(B.getType()->isIntOrIntVector(),
|
||||
Assert1(B.getType()->isIntOrIntVectorTy(),
|
||||
"Shifts only work with integral types!", &B);
|
||||
Assert1(B.getType() == B.getOperand(0)->getType(),
|
||||
"Shift return type must be same as operands!", &B);
|
||||
@ -1203,7 +1204,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->isIntOrIntVector() || isa<PointerType>(Op0Ty),
|
||||
Assert1(Op0Ty->isIntOrIntVectorTy() || isa<PointerType>(Op0Ty),
|
||||
"Invalid operand types for ICmp instruction", &IC);
|
||||
|
||||
visitInstruction(IC);
|
||||
@ -1216,7 +1217,7 @@ void Verifier::visitFCmpInst(FCmpInst& FC) {
|
||||
Assert1(Op0Ty == Op1Ty,
|
||||
"Both operands to FCmp instruction are not of the same type!", &FC);
|
||||
// Check that the operands are the right type
|
||||
Assert1(Op0Ty->isFPOrFPVector(),
|
||||
Assert1(Op0Ty->isFPOrFPVectorTy(),
|
||||
"Invalid operand types for FCmp instruction", &FC);
|
||||
visitInstruction(FC);
|
||||
}
|
||||
@ -1302,7 +1303,7 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
|
||||
&AI);
|
||||
Assert1(PTy->getElementType()->isSized(), "Cannot allocate unsized type",
|
||||
&AI);
|
||||
Assert1(AI.getArraySize()->getType()->isInteger(32),
|
||||
Assert1(AI.getArraySize()->getType()->isIntegerTy(32),
|
||||
"Alloca array size must be i32", &AI);
|
||||
visitInstruction(AI);
|
||||
}
|
||||
@ -1734,7 +1735,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
|
||||
}
|
||||
}
|
||||
} else if (VT == MVT::iAny) {
|
||||
if (!EltTy->isInteger()) {
|
||||
if (!EltTy->isIntegerTy()) {
|
||||
CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not "
|
||||
"an integer type.", F);
|
||||
return false;
|
||||
@ -1759,7 +1760,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
|
||||
break;
|
||||
}
|
||||
} else if (VT == MVT::fAny) {
|
||||
if (!EltTy->isFloatingPoint()) {
|
||||
if (!EltTy->isFloatingPointTy()) {
|
||||
CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not "
|
||||
"a floating-point type.", F);
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user