[llvm-commits] [dragonegg] r92997 - in /dragonegg/trunk: llvm-convert.cpp llvm-types.cpp x86/llvm-target.cpp
Duncan Sands
baldrick at free.fr
Fri Jan 8 00:44:52 PST 2010
Author: baldrick
Date: Fri Jan 8 02:44:51 2010
New Revision: 92997
URL: http://llvm.org/viewvc/llvm-project?rev=92997&view=rev
Log:
Use new isInteger predicate to avoid going through the context.
Modified:
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-types.cpp
dragonegg/trunk/x86/llvm-target.cpp
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=92997&r1=92996&r2=92997&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Fri Jan 8 02:44:51 2010
@@ -448,8 +448,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());
}
@@ -3218,7 +3217,7 @@
Value *TreeToLLVM::EmitTRUTH_NOT_EXPR(tree type, tree op) {
Value *V = EmitRegister(op);
- if (V->getType() != Type::getInt1Ty(Context))
+ if (!V->getType()->isInteger(1))
V = Builder.CreateICmpNE(V,
Constant::getNullValue(V->getType()), "toBool");
V = Builder.CreateNot(V, (V->getNameStr()+"not").c_str());
@@ -5679,8 +5678,8 @@
Value *Offset = EmitRegister(gimple_call_arg(stmt, 0));
Value *Handler = EmitRegister(gimple_call_arg(stmt, 1));
- 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, /*isSigned*/true);
Handler = Builder.CreateBitCast(Handler, Type::getInt8PtrTy(Context));
@@ -7343,11 +7342,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 =
@@ -7361,7 +7360,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);
@@ -7825,7 +7824,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: dragonegg/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=92997&r1=92996&r2=92997&view=diff
==============================================================================
--- dragonegg/trunk/llvm-types.cpp (original)
+++ dragonegg/trunk/llvm-types.cpp Fri Jan 8 02:44:51 2010
@@ -955,8 +955,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);
@@ -1357,13 +1357,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;
Modified: dragonegg/trunk/x86/llvm-target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.cpp?rev=92997&r1=92996&r2=92997&view=diff
==============================================================================
--- dragonegg/trunk/x86/llvm-target.cpp (original)
+++ dragonegg/trunk/x86/llvm-target.cpp Fri Jan 8 02:44:51 2010
@@ -1363,8 +1363,7 @@
return !((TARGET_64BIT && (EltTy->isInteger() ||
EltTy == Type::getFloatTy(Context) ||
EltTy == Type::getDoubleTy(Context))) ||
- 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
More information about the llvm-commits
mailing list