From b0dfcbf584bb6acf6e8adb087c42fbd28ec90b12 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 10 Nov 2002 23:46:51 +0000 Subject: [PATCH] Add code to be able to merge two call sites git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4685 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DSSupport.h | 11 +++++++++++ include/llvm/Analysis/DataStructure/DSSupport.h | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h index 3a5341fb35c..32aec2c4634 100644 --- a/include/llvm/Analysis/DSSupport.h +++ b/include/llvm/Analysis/DSSupport.h @@ -218,6 +218,17 @@ public: } } + // MergeWith - Merge the return value and parameters of the these two call + // sites. + void mergeWith(DSCallSite &CS) { + getRetVal().mergeWith(CS.getRetVal()); + unsigned MinArgs = getNumPtrArgs(); + if (CS.getNumPtrArgs() < MinArgs) MinArgs = CS.getNumPtrArgs(); + + for (unsigned a = 0; a != MinArgs; ++a) + getPtrArg(a).mergeWith(CS.getPtrArg(a)); + } + bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! if (Callee > CS.Callee) return false; diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h index 3a5341fb35c..32aec2c4634 100644 --- a/include/llvm/Analysis/DataStructure/DSSupport.h +++ b/include/llvm/Analysis/DataStructure/DSSupport.h @@ -218,6 +218,17 @@ public: } } + // MergeWith - Merge the return value and parameters of the these two call + // sites. + void mergeWith(DSCallSite &CS) { + getRetVal().mergeWith(CS.getRetVal()); + unsigned MinArgs = getNumPtrArgs(); + if (CS.getNumPtrArgs() < MinArgs) MinArgs = CS.getNumPtrArgs(); + + for (unsigned a = 0; a != MinArgs; ++a) + getPtrArg(a).mergeWith(CS.getPtrArg(a)); + } + bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! if (Callee > CS.Callee) return false;