[llvm-commits] [see] CVS: llvm-poolalloc/lib/DSA/Local.cpp Makefile
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Fri May 18 10:38:46 PDT 2007
Changes in directory llvm-poolalloc/lib/DSA:
Local.cpp updated: 1.158.2.4.2.9 -> 1.158.2.4.2.10
Makefile updated: 1.5.2.2 -> 1.5.2.2.2.1
---
Log message:
new memcpy
---
Diffs of the changes: (+70 -16)
Local.cpp | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------
Makefile | 1
2 files changed, 70 insertions(+), 16 deletions(-)
Index: llvm-poolalloc/lib/DSA/Local.cpp
diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.9 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.10
--- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.4.2.9 Mon Apr 9 15:20:07 2007
+++ llvm-poolalloc/lib/DSA/Local.cpp Fri May 18 12:38:28 2007
@@ -12,7 +12,6 @@
// external interface to this file is the DSGraph constructor.
//
//===----------------------------------------------------------------------===//
-
#include "llvm/ADT/Statistic.h"
#include "dsa/DataStructure.h"
#include "dsa/DSGraph.h"
@@ -650,12 +649,21 @@
case Intrinsic::memcpy_i64:
case Intrinsic::memmove_i32:
case Intrinsic::memmove_i64: {
- // Merge the first & second arguments, and mark the memory read and
- // modified.
- DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
- RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1)));
- if (DSNode *N = RetNH.getNode())
- N->setModifiedMarker()->setReadMarker();
+ DSNodeHandle destNH = getValueDest(**CS.arg_begin());
+ DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1));
+ if (!destNH.getNode()) {
+ setDestTo(**CS.arg_begin(), createNode());
+ destNH = getValueDest(**CS.arg_begin());
+ }
+ if (!srcNH.getNode()) {
+ setDestTo(**(CS.arg_begin() + 1), createNode());
+ srcNH = getValueDest(**(CS.arg_begin() + 1));
+ }
+ destNH.getNode()->foldNodeCompletely();
+ srcNH.getNode()->foldNodeCompletely();
+ getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode()));
+ destNH.getNode()->setModifiedMarker();
+ srcNH.getNode()->setReadMarker();
return true;
}
case Intrinsic::memset_i32:
@@ -788,7 +796,7 @@
N->setModifiedMarker()->setUnknownNodeMarker();
const Type *RetTy = F->getFunctionType()->getReturnType();
if (const PointerType *PTy = dyn_cast<PointerType>(RetTy))
- N->mergeTypeInfo(PTy->getElementType(), Result.getOffset());
+ N->mergeTypeInfo(PTy->getElementType(), Result.getOffset());
}
// If this is freopen, merge the file descriptor passed in with the
@@ -1101,12 +1109,21 @@
} else if (F->getName() == "llva_memcpy") {
if (CS.getCaller()->getName() == "kmem_cache_alloc")
return false;
- // Merge the first & second arguments, and mark the memory read and
- // modified.
- DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
- RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1)));
- if (DSNode *N = RetNH.getNode())
- N->setModifiedMarker()->setReadMarker();
+ DSNodeHandle destNH = getValueDest(**CS.arg_begin());
+ DSNodeHandle srcNH = getValueDest(**(CS.arg_begin()+1));
+ if (!destNH.getNode()) {
+ setDestTo(**CS.arg_begin(), createNode());
+ destNH = getValueDest(**CS.arg_begin());
+ }
+ if (!srcNH.getNode()) {
+ setDestTo(**(CS.arg_begin() + 1), createNode());
+ srcNH = getValueDest(**(CS.arg_begin() + 1));
+ }
+ destNH.getNode()->foldNodeCompletely();
+ srcNH.getNode()->foldNodeCompletely();
+ getLink(destNH.getNode()).mergeWith(getLink(srcNH.getNode()));
+ destNH.getNode()->setModifiedMarker();
+ srcNH.getNode()->setReadMarker();
return true;
#if 1
} else if (F->getName() == "llva_save_stackp") {
@@ -1137,7 +1154,7 @@
#endif
}
#endif
-
+
return false;
}
@@ -1145,6 +1162,16 @@
Value *Callee = CS.getCalledValue();
if (Function *F = dyn_cast<Function>(Callee)) {
+// if (F->getName() == "printk") {
+// CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end();
+// for (; AI != E; ++AI) {
+// // printf reads all pointer arguments.
+// if (isPointerType((*AI)->getType()))
+// if (DSNode *N = getValueDest(**AI).getNode())
+// N->setReadMarker();
+// }
+// return;
+// }
if (F->isExternal())
if (F->isIntrinsic() && visitIntrinsic(CS, F))
return;
@@ -1171,6 +1198,34 @@
if (visitExternal(CS,F))
return;
+
+ if (F->getName() == "llva_invoke") {
+ Value* FF = *(CS.arg_begin() + 1);
+ if (isa<CastInst>(FF)) {
+ FF = cast<CastInst>(FF)->getOperand(0);
+ }
+ if (isa<ConstantExpr>(FF) && cast<ConstantExpr>(FF)->getOpcode() == Instruction::Cast) {
+ FF = cast<ConstantExpr>(FF)->getOperand(0);
+ }
+ //std::cerr << "invoke special for: "; FF->dump(); std::cerr << "\n";
+ std::vector<DSNodeHandle> Args;
+ // Calculate the arguments vector...
+ for (CallSite::arg_iterator I = CS.arg_begin() + 2, E = CS.arg_end(); I != E; ++I) {
+ Value* AA = *I;
+ if (isa<CastInst>(AA)) {
+ AA = cast<CastInst>(AA)->getOperand(0);
+ }
+ if (isPointerType(AA->getType()))
+ Args.push_back(getValueDest(*AA));
+ }
+ // Add a new function call entry...
+ if (isa<Function>(FF))
+ FunctionCalls->push_back(DSCallSite(CS, DSNodeHandle(), cast<Function>(FF), Args));
+ else
+ FunctionCalls->push_back(DSCallSite(CS, DSNodeHandle(), getValueDest(*FF).getNode(), Args));
+ return;
+ }
+
// Unknown function, warn if it returns a pointer type or takes a
// pointer argument.
bool Warn = isPointerType(CS.getInstruction()->getType());
Index: llvm-poolalloc/lib/DSA/Makefile
diff -u llvm-poolalloc/lib/DSA/Makefile:1.5.2.2 llvm-poolalloc/lib/DSA/Makefile:1.5.2.2.2.1
--- llvm-poolalloc/lib/DSA/Makefile:1.5.2.2 Thu Jan 11 16:29:43 2007
+++ llvm-poolalloc/lib/DSA/Makefile Fri May 18 12:38:28 2007
@@ -6,7 +6,6 @@
# the University of Illinois Open Source License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
-
LEVEL = ../..
SHARED_LIBRARY=1
LOADABLE_MODULE = 1
More information about the llvm-commits
mailing list