[llvm-commits] [llvm-gcc-4.2] r96347 - in /llvm-gcc-4.2/trunk/gcc: config/arm/llvm-arm.cpp config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp cp/cfns.h llvm-abi-default.cpp llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Tue Feb 16 04:37:42 PST 2010
Author: baldrick
Date: Tue Feb 16 06:37:42 2010
New Revision: 96347
URL: http://llvm.org/viewvc/llvm-project?rev=96347&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:
llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
llvm-gcc-4.2/trunk/gcc/cp/cfns.h
llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=96347&r1=96346&r2=96347&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Tue Feb 16 06:37:42 2010
@@ -2560,7 +2560,7 @@
default:
assert(0);
}
- } else if (Ty->isIntegerTy() || isa<PointerType>(Ty) ||
+ } else if (Ty->isIntegerTy() || Ty->isPointerTy() ||
Ty==Type::getVoidTy(Context)) {
;
} else {
@@ -2648,7 +2648,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);
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=96347&r1=96346&r2=96347&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Feb 16 06:37:42 2010
@@ -655,7 +655,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;
@@ -688,7 +688,7 @@
// (which can be picked as the type for a union of 16 bytes) is not fine,
// as loads and stores of it get only 10 bytes.
if (EltTy->isIntegerTy(32) || EltTy->isIntegerTy(64) ||
- EltTy->isFloatTy() || EltTy->isDoubleTy() || isa<PointerType>(EltTy)) {
+ EltTy->isFloatTy() || EltTy->isDoubleTy() || EltTy->isPointerTy()) {
Elts.push_back(EltTy);
continue;
}
@@ -757,7 +757,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->isVoidTy()) {
// Padding bytes that are not passed anywhere
@@ -1374,7 +1374,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);
@@ -1438,7 +1438,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);
Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=96347&r1=96346&r2=96347&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Tue Feb 16 06:37:42 2010
@@ -395,7 +395,7 @@
const Type *Ty = ScalarElts[i];
if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
abort();
- } else if (isa<PointerType>(Ty)) {
+ } else if (Ty->isPointerTy()) {
NumGPRs++;
} else if (Ty->isIntegerTy()) {
unsigned TypeSize = Ty->getPrimitiveSizeInBits();
@@ -453,8 +453,8 @@
}
}
} else if (!(Ty->isFloatingPointTy() ||
- isa<VectorType>(Ty) ||
- isa<PointerType>(Ty))) {
+ Ty->isVectorTy() ||
+ Ty->isPointerTy())) {
abort();
}
Modified: llvm-gcc-4.2/trunk/gcc/cp/cfns.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cfns.h?rev=96347&r1=96346&r2=96347&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cfns.h (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cfns.h Tue Feb 16 06:37:42 2010
@@ -1,5 +1,5 @@
-/* ANSI-C code produced by gperf version 3.0.1 */
-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C ../../gcc/gcc/cp/cfns.gperf */
+/* ANSI-C code produced by gperf version 3.0.3 */
+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C ../../gcc-4.2.llvm/gcc/cp/cfns.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -28,7 +28,7 @@
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf at gnu.org>."
#endif
-#line 1 "../../gcc/gcc/cp/cfns.gperf"
+#line 1 "../../gcc-4.2.llvm/gcc/cp/cfns.gperf"
#ifdef __GNUC__
__inline
@@ -57,13 +57,13 @@
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 0, 0,
- 1, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 1, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 28, 90, 0,
95, 0, 51, 93, 114, 26, 109, 124, 5, 1,
- 6, 13, 37, 128, 3, 0, 0, 49, 38, 0,
+ 6, 13, 37, 128, 3, 0, 0, 49, 38, 0,
104, 45, 0, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
@@ -84,29 +84,32 @@
switch (hval)
{
default:
- hval += asso_values[(unsigned char)str[5]+1];
+ hval += asso_values[(unsigned char)str[5]+1];
/*FALLTHROUGH*/
case 5:
- hval += asso_values[(unsigned char)str[4]];
+ hval += asso_values[(unsigned char)str[4]];
/*FALLTHROUGH*/
case 4:
- hval += asso_values[(unsigned char)str[3]];
+ hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
- hval += asso_values[(unsigned char)str[2]];
+ hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
- hval += asso_values[(unsigned char)str[1]];
+ hval += asso_values[(unsigned char)str[1]];
/*FALLTHROUGH*/
case 1:
- hval += asso_values[(unsigned char)str[0]];
- break;
+ hval += asso_values[(unsigned char)str[0]];
+ break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
#ifdef __GNUC__
__inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
#endif
const char *
libc_name_p (register const char *str, register unsigned int len)
@@ -329,17 +332,17 @@
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int index = lookup[key];
+ {
+ register int index = lookup[key];
- if (index >= 0)
- {
- register const char *s = wordlist[index];
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return s;
- }
- }
+ if (index >= 0)
+ {
+ register const char *s = wordlist[index];
+
+ if (*str == *s && !strcmp (str + 1, s + 1))
+ return s;
+ }
+ }
}
return 0;
}
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp?rev=96347&r1=96346&r2=96347&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi-default.cpp Tue Feb 16 06:37:42 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.
@@ -78,7 +78,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)) {
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=96347&r1=96346&r2=96347&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Feb 16 06:37:42 2010
@@ -223,7 +223,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() >=
@@ -334,7 +334,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);
@@ -642,7 +642,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,
@@ -1130,7 +1130,7 @@
// FIXME: The vector stuff isn't straight-forward. Sometimes X86 can
// pass it back as a scalar value. Disable checking if it's a
// vector. This should be made better, though.
- isa<VectorType>(ConvertType(TREE_TYPE(exp))) ||
+ ConvertType(TREE_TYPE(exp))->isVectorTy() ||
// FIXME: The handling of MODIFY_EXPR doesn't always produce results
// that pass this check; the return type might be the LHS type or
// the RHS type, neither of which is guaranteed to be the
@@ -1447,7 +1447,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()))
@@ -2520,7 +2520,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);
@@ -2888,7 +2888,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,15 +3312,15 @@
// If the source is a pointer, use ptrtoint to get it to something
// bitcast'able. This supports things like v_c_e(foo*, float).
- if (isa<PointerType>(OpVal->getType())) {
- if (isa<PointerType>(DestTy)) // ptr->ptr is a simple bitcast.
+ if (OpVal->getType()->isPointerTy()) {
+ if (DestTy->isPointerTy()) // ptr->ptr is a simple bitcast.
return Builder.CreateBitCast(OpVal, DestTy);
// Otherwise, ptrtoint to intptr_t first.
OpVal = Builder.CreatePtrToInt(OpVal, TD.getIntPtrType(Context));
}
// If the destination type is a pointer, use inttoptr.
- if (isa<PointerType>(DestTy))
+ if (DestTy->isPointerTy())
return Builder.CreateIntToPtr(OpVal, DestTy);
// Otherwise, use a bitcast.
@@ -3332,7 +3332,7 @@
Value *V = Emit(TREE_OPERAND(exp, 0), 0);
if (V->getType()->isFPOrFPVectorTy())
return Builder.CreateFNeg(V);
- if (!isa<PointerType>(V->getType())) {
+ if (!V->getType()->isPointerTy()) {
bool HasNSW = !TYPE_OVERFLOW_WRAPS(TREE_TYPE(exp));
return HasNSW ? Builder.CreateNSWNeg(V) : Builder.CreateNeg(V);
}
@@ -3430,13 +3430,13 @@
Value *TreeToLLVM::EmitBIT_NOT_EXPR(tree exp) {
Value *Op = Emit(TREE_OPERAND(exp, 0), 0);
const Type *Ty = Op->getType();
- if (isa<PointerType>(Ty)) {
+ if (Ty->isPointerTy()) {
assert (TREE_CODE(TREE_TYPE(exp)) == INTEGER_TYPE &&
"Expected integer type here");
Ty = ConvertType(TREE_TYPE(exp));
Op = CastToType(Instruction::PtrToInt, Op, Ty);
} else if (Ty->isFloatingPointTy() ||
- (isa<VectorType>(Ty) &&
+ (Ty->isVectorTy() &&
cast<VectorType>(Ty)->getElementType()->isFloatingPointTy())) {
Op = BitCastToType(Op, getSuitableBitCastIntType(Ty));
}
@@ -3509,9 +3509,9 @@
///
Value *TreeToLLVM::EmitBinOp(tree exp, const MemRef *DestLoc, unsigned Opc) {
const Type *Ty = ConvertType(TREE_TYPE(exp));
- if (isa<PointerType>(Ty))
+ if (Ty->isPointerTy())
return EmitPtrBinOp(exp, Opc); // Pointer arithmetic!
- if (isa<StructType>(Ty))
+ if (Ty->isStructTy())
return EmitComplexBinOp(exp, DestLoc);
assert(Ty->isSingleValueType() && DestLoc == 0 &&
"Bad binary operation!");
@@ -3537,7 +3537,7 @@
const Type *ResTy = Ty;
if (isLogicalOp &&
(Ty->isFloatingPointTy() ||
- (isa<VectorType>(Ty) &&
+ (Ty->isVectorTy() &&
cast<VectorType>(Ty)->getElementType()->isFloatingPointTy()))) {
Ty = getSuitableBitCastIntType(Ty);
LHS = BitCastToType(LHS, Ty);
@@ -3632,7 +3632,7 @@
Value *TreeToLLVM::EmitShiftOp(tree exp, const MemRef *DestLoc, unsigned Opc) {
assert(DestLoc == 0 && "aggregate shift?");
const Type *Ty = ConvertType(TREE_TYPE(exp));
- assert(!isa<PointerType>(Ty) && "Pointer arithmetic!?");
+ assert(!Ty->isPointerTy() && "Pointer arithmetic!?");
Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
@@ -3647,7 +3647,7 @@
Value *In = Emit(TREE_OPERAND(exp, 0), 0);
Value *Amt = Emit(TREE_OPERAND(exp, 1), 0);
- if (isa<PointerType>(In->getType())) {
+ if (In->getType()->isPointerTy()) {
const Type *Ty =
IntegerType::get(Context,
TYPE_PRECISION(TREE_TYPE (TREE_OPERAND (exp, 0))));
@@ -4641,8 +4641,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("%Hunsupported inline asm: input constraint with a matching "
"output constraint of incompatible type!",
&EXPR_LOCATION(exp));
@@ -4861,7 +4861,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();
@@ -7607,7 +7607,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);
More information about the llvm-commits
mailing list