[llvm-commits] [parallel] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp LevelRaise.cpp TransformInternals.cpp
Misha Brukman
brukman at cs.uiuc.edu
Mon Mar 1 18:02:53 PST 2004
Changes in directory llvm/lib/Transforms:
ExprTypeConvert.cpp updated: 1.88 -> 1.88.2.1
LevelRaise.cpp updated: 1.93 -> 1.93.2.1
TransformInternals.cpp updated: 1.43 -> 1.43.2.1
---
Log message:
Merge from trunk
---
Diffs of the changes: (+16 -15)
Index: llvm/lib/Transforms/ExprTypeConvert.cpp
diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.88 llvm/lib/Transforms/ExprTypeConvert.cpp:1.88.2.1
--- llvm/lib/Transforms/ExprTypeConvert.cpp:1.88 Mon Jan 12 12:12:44 2004
+++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Mar 1 17:58:15 2004
@@ -304,8 +304,7 @@
//
const PointerType *PT = cast<PointerType>(I->getOperand(0)->getType());
const FunctionType *FT = cast<FunctionType>(PT->getElementType());
- std::vector<const Type *> ArgTys(FT->getParamTypes().begin(),
- FT->getParamTypes().end());
+ std::vector<const Type *> ArgTys(FT->param_begin(), FT->param_end());
const FunctionType *NewTy =
FunctionType::get(Ty, ArgTys, FT->isVarArg());
if (!ExpressionConvertibleToType(I->getOperand(0),
@@ -513,8 +512,7 @@
//
const PointerType *PT = cast<PointerType>(I->getOperand(0)->getType());
const FunctionType *FT = cast<FunctionType>(PT->getElementType());
- std::vector<const Type *> ArgTys(FT->getParamTypes().begin(),
- FT->getParamTypes().end());
+ std::vector<const Type *> ArgTys(FT->param_begin(), FT->param_end());
const FunctionType *NewTy =
FunctionType::get(Ty, ArgTys, FT->isVarArg());
const PointerType *NewPTy = PointerType::get(NewTy);
@@ -862,9 +860,8 @@
// reason for this is that we prefer to have resolved functions but casted
// arguments if possible.
//
- const FunctionType::ParamTypes &PTs = FTy->getParamTypes();
- for (unsigned i = 0, NA = PTs.size(); i < NA; ++i)
- if (!PTs[i]->isLosslesslyConvertibleTo(I->getOperand(i+1)->getType()))
+ for (unsigned i = 0, NA = FTy->getNumParams(); i < NA; ++i)
+ if (!FTy->getParamType(i)->isLosslesslyConvertibleTo(I->getOperand(i+1)->getType()))
return false; // Operands must have compatible types!
// Okay, at this point, we know that all of the arguments can be
@@ -878,7 +875,7 @@
const FunctionType *FTy = cast<FunctionType>(MPtr->getElementType());
if (!FTy->isVarArg()) return false;
- if ((OpNum-1) < FTy->getParamTypes().size())
+ if ((OpNum-1) < FTy->getNumParams())
return false; // It's not in the varargs section...
// If we get this far, we know the value is in the varargs section of the
@@ -1175,7 +1172,6 @@
if (Meth == OldVal) { // Changing the function pointer?
const PointerType *NewPTy = cast<PointerType>(NewVal->getType());
const FunctionType *NewTy = cast<FunctionType>(NewPTy->getElementType());
- const FunctionType::ParamTypes &PTs = NewTy->getParamTypes();
if (NewTy->getReturnType() == Type::VoidTy)
Name = ""; // Make sure not to name a void call!
@@ -1191,12 +1187,13 @@
// Convert over all of the call operands to their new types... but only
// convert over the part that is not in the vararg section of the call.
//
- for (unsigned i = 0; i < PTs.size(); ++i)
- if (Params[i]->getType() != PTs[i]) {
+ for (unsigned i = 0; i != NewTy->getNumParams(); ++i)
+ if (Params[i]->getType() != NewTy->getParamType(i)) {
// Create a cast to convert it to the right type, we know that this
// is a lossless cast...
//
- Params[i] = new CastInst(Params[i], PTs[i], "callarg.cast." +
+ Params[i] = new CastInst(Params[i], NewTy->getParamType(i),
+ "callarg.cast." +
Params[i]->getName(), It);
}
Meth = NewVal; // Update call destination to new value
Index: llvm/lib/Transforms/LevelRaise.cpp
diff -u llvm/lib/Transforms/LevelRaise.cpp:1.93 llvm/lib/Transforms/LevelRaise.cpp:1.93.2.1
--- llvm/lib/Transforms/LevelRaise.cpp:1.93 Mon Jan 12 12:12:44 2004
+++ llvm/lib/Transforms/LevelRaise.cpp Mon Mar 1 17:58:16 2004
@@ -375,12 +375,12 @@
const Type *IdxType;
if (const StructType *CurSTy = dyn_cast<StructType>(CurCTy)) {
// Check for a zero element struct type... if we have one, bail.
- if (CurSTy->getElementTypes().size() == 0) break;
+ if (CurSTy->getNumElements() == 0) break;
// Grab the first element of the struct type, which must lie at
// offset zero in the struct.
//
- ElTy = CurSTy->getElementTypes()[0];
+ ElTy = CurSTy->getElementType(0);
IdxType = Type::UByteTy; // FIXME when PR82 is fixed.
} else {
ElTy = cast<ArrayType>(CurCTy)->getElementType();
@@ -538,6 +538,10 @@
else
NewCast = new CastInst(CI->getCalledValue(), NewPFunTy,
CI->getCalledValue()->getName()+"_c",CI);
+
+ // Strip off unneeded CPR's.
+ if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(NewCast))
+ NewCast = CPR->getValue();
// Create a new call instruction...
CallInst *NewCall = new CallInst(NewCast,
Index: llvm/lib/Transforms/TransformInternals.cpp
diff -u llvm/lib/Transforms/TransformInternals.cpp:1.43 llvm/lib/Transforms/TransformInternals.cpp:1.43.2.1
--- llvm/lib/Transforms/TransformInternals.cpp:1.43 Thu Jan 8 23:53:38 2004
+++ llvm/lib/Transforms/TransformInternals.cpp Mon Mar 1 17:58:16 2004
@@ -62,7 +62,7 @@
uint64_t ThisOffset;
const Type *NextType;
if (const StructType *STy = dyn_cast<StructType>(Ty)) {
- if (STy->getElementTypes().empty()) {
+ if (STy->getNumElements()) {
Offset = 0;
return STy;
}
More information about the llvm-commits
mailing list