[llvm-commits] [llvm-gcc-4.2] r93000 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-convert.cpp llvm-types.cpp
Duncan Sands
baldrick at free.fr
Fri Jan 8 06:10:16 PST 2010
Author: baldrick
Date: Fri Jan 8 08:10:15 2010
New Revision: 93000
URL: http://llvm.org/viewvc/llvm-project?rev=93000&view=rev
Log:
Port dragonegg commit 92997: Use new isInteger predicate to avoid
going through the context.
Modified:
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/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
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=93000&r1=92999&r2=93000&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 Fri Jan 8 08:10:15 2010
@@ -687,11 +687,8 @@
// 32 and 64-bit integers are fine, as are float and double. Long double
// (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 == Type::getInt32Ty(Context) ||
- EltTy == Type::getInt64Ty(Context) ||
- EltTy->isFloatTy() ||
- EltTy->isDoubleTy() ||
- isa<PointerType>(EltTy)) {
+ if (EltTy->isInteger(32) || EltTy->isInteger(64) || EltTy->isFloatTy() ||
+ EltTy->isDoubleTy() || isa<PointerType>(EltTy)) {
Elts.push_back(EltTy);
continue;
}
@@ -721,8 +718,7 @@
return !((TARGET_64BIT && (EltTy->isInteger() ||
EltTy->isFloatTy() ||
EltTy->isDoubleTy())) ||
- EltTy == Type::getInt16Ty(Context) ||
- EltTy == Type::getInt8Ty(Context));
+ EltTy->isInteger(16) || EltTy->isInteger(8));
}
/* Target hook for llvm-abi.h. It returns true if an aggregate of the
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=93000&r1=92999&r2=93000&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 Fri Jan 8 08:10:15 2010
@@ -80,9 +80,9 @@
// GetAltivecTypeNumFromType - Given an LLVM type, return a unique ID for
// the type in the range 0-3.
static int GetAltivecTypeNumFromType(const Type *Ty) {
- return ((Ty == Type::getInt32Ty(Context)) ? 0 : \
- ((Ty == Type::getInt16Ty(Context)) ? 1 : \
- ((Ty == Type::getInt8Ty(Context)) ? 2 : \
+ return (Ty->isInteger(32) ? 0 : \
+ (Ty->isInteger(16) ? 1 : \
+ (Ty->isInteger(8) ? 2 : \
((Ty == Type::getFloatTy(Context)) ? 3 : -1))));
}
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=93000&r1=92999&r2=93000&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Jan 8 08:10:15 2010
@@ -335,8 +335,7 @@
// If this is just a mismatch between integer types, this is due
// to K&R prototypes, where the forward proto defines the arg as int
// and the actual impls is a short or char.
- assert(ArgVal->getType() == Type::getInt32Ty(Context) &&
- LLVMTy->isInteger() &&
+ assert(ArgVal->getType()->isInteger(32) && LLVMTy->isInteger() &&
"Lowerings don't match?");
ArgVal = Builder.CreateTrunc(ArgVal, LLVMTy,NameStack.back().c_str());
}
@@ -1112,7 +1111,7 @@
// Handle 'trunc (zext i1 X to T2) to i1' as X, because this occurs all over
// the place.
if (ZExtInst *CI = dyn_cast<ZExtInst>(V))
- if (Ty == Type::getInt1Ty(Context) && CI->getOperand(0)->getType() == Type::getInt1Ty(Context))
+ if (Ty->isInteger(1) && CI->getOperand(0)->getType()->isInteger(1))
return CI->getOperand(0);
return Builder.CreateCast(Instruction::CastOps(opcode), V, Ty,
@@ -1780,7 +1779,7 @@
if (FPPred == ~0U) {
Cond = Emit(exp_cond, 0);
// Comparison against zero to convert the result to i1.
- if (Cond->getType() != Type::getInt1Ty(Context))
+ if (!Cond->getType()->isInteger(1))
Cond = Builder.CreateIsNotNull(Cond, "toBool");
} else {
Cond = EmitCompare(exp_cond, UIPred, SIPred, FPPred, Type::getInt1Ty(Context));
@@ -6194,8 +6193,8 @@
Value *Offset = Emit(TREE_VALUE(arglist), 0);
Value *Handler = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0);
- Intrinsic::ID IID = (IntPtr == Type::getInt32Ty(Context) ?
- Intrinsic::eh_return_i32 : Intrinsic::eh_return_i64);
+ Intrinsic::ID IID = IntPtr->isInteger(32) ?
+ Intrinsic::eh_return_i32 : Intrinsic::eh_return_i64;
Offset = Builder.CreateIntCast(Offset, IntPtr, true);
Handler = BitCastToType(Handler, Type::getInt8PtrTy(Context));
@@ -7338,11 +7337,11 @@
unsigned Len = (unsigned)TREE_STRING_LENGTH(exp);
std::vector<Constant*> Elts;
- if (ElTy == Type::getInt8Ty(Context)) {
+ if (ElTy->isInteger(8)) {
const unsigned char *InStr =(const unsigned char *)TREE_STRING_POINTER(exp);
for (unsigned i = 0; i != Len; ++i)
Elts.push_back(ConstantInt::get(Type::getInt8Ty(Context), InStr[i]));
- } else if (ElTy == Type::getInt16Ty(Context)) {
+ } else if (ElTy->isInteger(16)) {
assert((Len&1) == 0 &&
"Length in bytes should be a multiple of element size");
const uint16_t *InStr =
@@ -7356,7 +7355,7 @@
else
Elts.push_back(ConstantInt::get(Type::getInt16Ty(Context), ByteSwap_16(InStr[i])));
}
- } else if (ElTy == Type::getInt32Ty(Context)) {
+ } else if (ElTy->isInteger(32)) {
assert((Len&3) == 0 &&
"Length in bytes should be a multiple of element size");
const uint32_t *InStr = (const uint32_t *)TREE_STRING_POINTER(exp);
@@ -7793,7 +7792,7 @@
if (GCCFieldOffsetInBits < NextFieldByteStart*8) {
unsigned ValBitSize = ValC->getBitWidth();
assert(!ResultElts.empty() && "Bitfield starts before first element?");
- assert(ResultElts.back()->getType() == Type::getInt8Ty(Context) &&
+ assert(ResultElts.back()->getType()->isInteger(8) &&
isa<ConstantInt>(ResultElts.back()) &&
"Merging bitfield with non-bitfield value?");
assert(NextFieldByteStart*8 - GCCFieldOffsetInBits < 8 &&
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=93000&r1=92999&r2=93000&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Jan 8 08:10:15 2010
@@ -975,8 +975,8 @@
if (KNRPromotion) {
if (type == float_type_node)
LLVMTy = ConvertType(double_type_node);
- else if (LLVMTy == Type::getInt16Ty(Context) || LLVMTy == Type::getInt8Ty(Context) ||
- LLVMTy == Type::getInt1Ty(Context))
+ else if (LLVMTy->isInteger(16) || LLVMTy->isInteger(8) ||
+ LLVMTy->isInteger(1))
LLVMTy = Type::getInt32Ty(Context);
}
ArgTypes.push_back(LLVMTy);
@@ -997,7 +997,8 @@
/// HandleFCAArgument - This callback is invoked if the aggregate function
/// argument is a first class aggregate passed by value.
- void HandleFCAArgument(const llvm::Type *LLVMTy, tree type) {
+ void HandleFCAArgument(const llvm::Type *LLVMTy,
+ tree type ATTRIBUTE_UNUSED) {
ArgTypes.push_back(LLVMTy);
}
};
@@ -1377,13 +1378,13 @@
const Type *LastType = Elements.back();
unsigned PadBytes = 0;
- if (LastType == Type::getInt8Ty(Context))
+ if (LastType->isInteger(8))
PadBytes = 1 - NoOfBytesToRemove;
- else if (LastType == Type::getInt16Ty(Context))
+ else if (LastType->isInteger(16))
PadBytes = 2 - NoOfBytesToRemove;
- else if (LastType == Type::getInt32Ty(Context))
+ else if (LastType->isInteger(32))
PadBytes = 4 - NoOfBytesToRemove;
- else if (LastType == Type::getInt64Ty(Context))
+ else if (LastType->isInteger(64))
PadBytes = 8 - NoOfBytesToRemove;
else
return;
More information about the llvm-commits
mailing list