[llvm-commits] CVS: llvm/lib/VMCore/AutoUpgrade.cpp
Jim Laskey
jlaskey at apple.com
Thu Mar 23 12:13:38 PST 2006
Changes in directory llvm/lib/VMCore:
AutoUpgrade.cpp updated: 1.15 -> 1.16
---
Log message:
Add some more bulletproofing to auto upgrade of llvm.dbg intrinsics.
---
Diffs of the changes: (+9 -13)
AutoUpgrade.cpp | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
Index: llvm/lib/VMCore/AutoUpgrade.cpp
diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.15 llvm/lib/VMCore/AutoUpgrade.cpp:1.16
--- llvm/lib/VMCore/AutoUpgrade.cpp:1.15 Thu Mar 23 12:03:20 2006
+++ llvm/lib/VMCore/AutoUpgrade.cpp Thu Mar 23 14:13:25 2006
@@ -153,35 +153,31 @@
// of zero in the array indicates replacing with UndefValue for the arg type.
// NULL is returned if there is no permutation. It's assumed that the function
// name is in the form "llvm.?????"
-static unsigned *getArgumentPermutation(Function* F) {
- const std::string& Name = F->getName();
- const FunctionType *FTy = F->getFunctionType();
- unsigned N = FTy->getNumParams();
+static unsigned *getArgumentPermutation(Function* Fn, Function* NewFn) {
+ const std::string& Name = Fn->getName();
+ unsigned N = Fn->getFunctionType()->getNumParams();
+ unsigned M = NewFn->getFunctionType()->getNumParams();
switch (Name[5]) {
case 'd':
if (Name == "llvm.dbg.stoppoint") {
static unsigned Permutation[] = { 2, 3, 4 };
- assert(F->getFunctionType()->getNumParams() ==
- (sizeof(Permutation) / sizeof(unsigned)) &&
+ assert(M == (sizeof(Permutation) / sizeof(unsigned)) &&
"Permutation is wrong length");
if (N == 4) return Permutation;
} else if (Name == "llvm.dbg.region.start") {
static unsigned Permutation[] = { 0 };
- assert(F->getFunctionType()->getNumParams() ==
- (sizeof(Permutation) / sizeof(unsigned)) &&
+ assert(M == (sizeof(Permutation) / sizeof(unsigned)) &&
"Permutation is wrong length");
if (N == 0) return Permutation;
} else if (Name == "llvm.dbg.region.end") {
static unsigned Permutation[] = { 0 };
- assert(F->getFunctionType()->getNumParams() ==
- (sizeof(Permutation) / sizeof(unsigned)) &&
+ assert(M == (sizeof(Permutation) / sizeof(unsigned)) &&
"Permutation is wrong length");
if (N == 0) return Permutation;
} else if (Name == "llvm.dbg.declare") {
static unsigned Permutation[] = { 0, 0 };
- assert(F->getFunctionType()->getNumParams() ==
- (sizeof(Permutation) / sizeof(unsigned)) &&
+ assert(M == (sizeof(Permutation) / sizeof(unsigned)) &&
"Permutation is wrong length");
if (N == 0) return Permutation;
}
@@ -259,7 +255,7 @@
const FunctionType *NewFnTy = NewFn->getFunctionType();
std::vector<Value*> Oprnds;
- unsigned *Permutation = getArgumentPermutation(F);
+ unsigned *Permutation = getArgumentPermutation(F, NewFn);
unsigned N = NewFnTy->getNumParams();
if (Permutation) {
More information about the llvm-commits
mailing list