[llvm-commits] [dragonegg] r96346 - in /dragonegg/trunk: llvm-abi-default.cpp llvm-backend.cpp llvm-convert.cpp x86/llvm-target.cpp
Duncan Sands
baldrick at free.fr
Tue Feb 16 04:26:56 PST 2010
Author: baldrick
Date: Tue Feb 16 06:26:55 2010
New Revision: 96346
URL: http://llvm.org/viewvc/llvm-project?rev=96346&view=rev
Log:
There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
Modified:
dragonegg/trunk/llvm-abi-default.cpp
dragonegg/trunk/llvm-backend.cpp
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/x86/llvm-target.cpp
Modified: dragonegg/trunk/llvm-abi-default.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi-default.cpp?rev=96346&r1=96345&r2=96346&view=diff
==============================================================================
--- dragonegg/trunk/llvm-abi-default.cpp (original)
+++ dragonegg/trunk/llvm-abi-default.cpp Tue Feb 16 06:26:55 2010
@@ -11,7 +11,7 @@
void DefaultABI::HandleReturnType(tree type, tree fn, bool isBuiltin) {
unsigned Offset = 0;
const Type *Ty = ConvertType(type);
- if (isa<VectorType>(Ty)) {
+ if (Ty->isVectorTy()) {
// Vector handling is weird on x86. In particular builtin and
// non-builtin function of the same return types can use different
// calling conventions.
@@ -81,7 +81,7 @@
const Type *PtrTy = Ty->getPointerTo();
C.HandleByInvisibleReferenceArgument(PtrTy, type);
ScalarElts.push_back(PtrTy);
- } else if (isa<VectorType>(Ty)) {
+ } else if (Ty->isVectorTy()) {
if (LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS(type)) {
PassInIntegerRegisters(type, ScalarElts, 0, false);
} else if (LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(type)) {
@@ -160,7 +160,7 @@
HandleUnion(type, ScalarElts);
} else if (TREE_CODE(type) == ARRAY_TYPE) {
// Array with padding?
- if (isa<StructType>(Ty))
+ if (Ty->isStructTy())
Ty = cast<StructType>(Ty)->getTypeAtIndex(0U);
const ArrayType *ATy = cast<ArrayType>(Ty);
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=96346&r1=96345&r2=96346&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Tue Feb 16 06:26:55 2010
@@ -1651,7 +1651,7 @@
}
FoundThis = true; // The current argument is 'this'.
- assert(isa<PointerType>(AI->getType()) && "Wrong type for 'this'!");
+ assert(AI->getType()->isPointerTy() && "Wrong type for 'this'!");
Value *This = AI;
// Adjust 'this' according to the thunk offsets. First, the fixed offset.
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=96346&r1=96345&r2=96346&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Feb 16 06:26:55 2010
@@ -335,7 +335,7 @@
// Not clear what this is supposed to do on big endian machines...
assert(!BYTES_BIG_ENDIAN && "Unsupported case - please report");
// Do byte wise store because actual argument type does not match LLVMTy.
- assert(isa<IntegerType>(ArgVal->getType()) && "Expected an integer value!");
+ assert(ArgVal->getType()->isIntegerTy() && "Expected an integer value!");
const Type *StoreType = IntegerType::get(Context, RealSize * 8);
Loc = Builder.CreateBitCast(Loc, StoreType->getPointerTo());
if (ArgVal->getType()->getPrimitiveSizeInBits() >=
@@ -442,7 +442,7 @@
unsigned RealSize = 0) {
Value *ArgVal = AI;
if (ArgVal->getType() != LLVMTy) {
- if (isa<PointerType>(ArgVal->getType()) && isa<PointerType>(LLVMTy)) {
+ if (ArgVal->getType()->isPointerTy() && LLVMTy->isPointerTy()) {
// If this is GCC being sloppy about pointer types, insert a bitcast.
// See PR1083 for an example.
ArgVal = Builder.CreateBitCast(ArgVal, LLVMTy);
@@ -718,7 +718,7 @@
const Type *ArgTy = ConvertType(TREE_TYPE(Args));
bool isInvRef = isPassedByInvisibleReference(TREE_TYPE(Args));
if (isInvRef ||
- (isa<VectorType>(ArgTy) &&
+ (ArgTy->isVectorTy() &&
LLVM_SHOULD_PASS_VECTOR_USING_BYVAL_ATTR(TREE_TYPE(Args))) ||
(!ArgTy->isSingleValueType() &&
isPassedByVal(TREE_TYPE(Args), ArgTy, ScalarArgs,
@@ -1510,7 +1510,7 @@
const Type *Ty = *I;
if (Ty->isFloatingPointTy())
return true;
- if (isa<StructType>(Ty) && containsFPField(Ty))
+ if (Ty->isStructTy() && containsFPField(Ty))
return true;
const ArrayType *ATy = dyn_cast<ArrayType>(Ty);
if (ATy && containsFPField(ATy->getElementType()))
@@ -2344,7 +2344,7 @@
// Not clear what this is supposed to do on big endian machines...
assert(!BYTES_BIG_ENDIAN && "Unsupported case - please report");
- assert(isa<IntegerType>(LLVMTy) && "Expected an integer value!");
+ assert(LLVMTy->isIntegerTy() && "Expected an integer value!");
const Type *LoadType = IntegerType::get(Context, RealSize * 8);
L = Builder.CreateBitCast(L, LoadType->getPointerTo());
Value *Val = Builder.CreateLoad(L);
@@ -2722,7 +2722,7 @@
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Callee)) {
if (CallOperands.empty() && CE->getOpcode() == Instruction::BitCast) {
Constant *RealCallee = CE->getOperand(0);
- assert(isa<PointerType>(RealCallee->getType()) &&
+ assert(RealCallee->getType()->isPointerTy() &&
"Bitcast to ptr not from ptr?");
const PointerType *RealPT = cast<PointerType>(RealCallee->getType());
if (const FunctionType *RealFT =
@@ -3312,7 +3312,7 @@
/// Undef values may be specified by passing in -1 as the result value.
///
Value *TreeToLLVM::BuildVectorShuffle(Value *InVec1, Value *InVec2, ...) {
- assert(isa<VectorType>(InVec1->getType()) &&
+ assert(InVec1->getType()->isVectorTy() &&
InVec1->getType() == InVec2->getType() && "Invalid shuffle!");
unsigned NumElements = cast<VectorType>(InVec1->getType())->getNumElements();
@@ -6816,8 +6816,8 @@
const Type *OTy = (Match < CallResultTypes.size())
? CallResultTypes[Match] : 0;
if (OTy && OTy != OpTy) {
- if (!(isa<IntegerType>(OTy) || isa<PointerType>(OTy)) ||
- !(isa<IntegerType>(OpTy) || isa<PointerType>(OpTy))) {
+ if (!(OTy->isIntegerTy() || OTy->isPointerTy()) ||
+ !(OpTy->isIntegerTy() || OpTy->isPointerTy())) {
error_at(gimple_location(stmt),
"unsupported inline asm: input constraint with a matching "
"output constraint of incompatible type!");
@@ -7752,7 +7752,7 @@
Constant *RHS = Convert(TREE_OPERAND(exp, 1));
bool RHSIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp,1)));
Instruction::CastOps opcode;
- if (isa<PointerType>(LHS->getType())) {
+ if (LHS->getType()->isPointerTy()) {
const Type *IntPtrTy = getTargetData().getIntPtrType(Context);
opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, IntPtrTy, false);
LHS = TheFolder->CreateCast(opcode, LHS, IntPtrTy);
Modified: dragonegg/trunk/x86/llvm-target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.cpp?rev=96346&r1=96345&r2=96346&view=diff
==============================================================================
--- dragonegg/trunk/x86/llvm-target.cpp (original)
+++ dragonegg/trunk/x86/llvm-target.cpp Tue Feb 16 06:26:55 2010
@@ -1296,7 +1296,7 @@
for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end();
I != E; ++I) {
const Type *STy = I->get();
- if (!STy->isIntOrIntVectorTy() && !isa<PointerType>(STy))
+ if (!STy->isIntOrIntVectorTy() && !STy->isPointerTy())
return false;
}
return true;
@@ -1332,7 +1332,7 @@
EltTy == Type::getInt64Ty(Context) ||
EltTy == Type::getFloatTy(Context) ||
EltTy == Type::getDoubleTy(Context) ||
- isa<PointerType>(EltTy)) {
+ EltTy->isPointerTy()) {
Elts.push_back(EltTy);
continue;
}
@@ -1401,7 +1401,7 @@
else
// All other vector scalar values are passed in XMM registers.
++NumXMMs;
- } else if (Ty->isIntegerTy() || isa<PointerType>(Ty)) {
+ } else if (Ty->isIntegerTy() || Ty->isPointerTy()) {
++NumGPRs;
} else if (Ty==Type::getVoidTy(Context)) {
// Padding bytes that are not passed anywhere
@@ -1996,7 +1996,7 @@
Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DestFieldNo);
Idxs[2] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DestElemNo);
Value *GEP = Builder.CreateGEP(Dest, Idxs, Idxs+3, "mrv_gep");
- if (isa<VectorType>(STy->getElementType(SrcFieldNo))) {
+ if (STy->getElementType(SrcFieldNo)->isVectorTy()) {
Value *ElemIndex = ConstantInt::get(Type::getInt32Ty(Context), SrcElemNo);
Value *EVIElem = Builder.CreateExtractElement(EVI, ElemIndex, "mrv");
Builder.CreateStore(EVIElem, GEP, isVolatile);
@@ -2060,7 +2060,7 @@
}
// Special treatement for _Complex.
- if (isa<StructType>(DestElemType)) {
+ if (DestElemType->isStructTy()) {
llvm::Value *Idxs[3];
Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0);
Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DNO);
More information about the llvm-commits
mailing list