diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2006-03-15 03:43:59 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-03-15 03:43:59 +0000 |
commit | 24b1ea159e9d03bd1585486ad6aa2b28a69f9373 (patch) | |
tree | a0a27e6c62843e31c626cf67f70b66fd1aa61ef8 /lib/Analysis/DataStructure/Local.cpp | |
parent | 71c3bc3d966bd874f760abf055c559673f925029 (diff) | |
download | llvm-24b1ea159e9d03bd1585486ad6aa2b28a69f9373.tar.gz llvm-24b1ea159e9d03bd1585486ad6aa2b28a69f9373.tar.bz2 llvm-24b1ea159e9d03bd1585486ad6aa2b28a69f9373.tar.xz |
improve mem intrinsics and add a few things povray uses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 10c9bb2847..783f87d974 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -545,10 +545,18 @@ void GraphBuilder::visitCallSite(CallSite CS) { return; case Intrinsic::vaend: return; // noop - case Intrinsic::memmove_i32: case Intrinsic::memcpy_i32: - case Intrinsic::memmove_i64: case Intrinsic::memcpy_i64: { + //write first location + if (DSNode *N = getValueDest(**CS.arg_begin()).getNode()) + N->setHeapNodeMarker()->setModifiedMarker(); + //and read second pointer + if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode()) + N->setReadMarker(); + return; + } + 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()); @@ -676,7 +684,6 @@ void GraphBuilder::visitCallSite(CallSite CS) { Link.mergeWith(getValueDest(**CS.arg_begin())); } } - return; } else if (F->getName() == "fopen" || F->getName() == "fdopen" || F->getName() == "freopen") { @@ -981,6 +988,26 @@ void GraphBuilder::visitCallSite(CallSite CS) { N->mergeTypeInfo(Type::DoubleTy, H.getOffset()); } return; + } else if (F->getName() == "qsort") { + CallSite::arg_iterator AI = CS.arg_begin(); + if (DSNode *N = getValueDest(**AI).getNode()) + N->setModifiedMarker(); + //How do you mark a function pointer as being called? Assume it is a read + AI += 3; + if (DSNode *N = getValueDest(**AI).getNode()) + N->setReadMarker(); + return; + } else if (F->getName() == "strcat" || F->getName() == "strncat") { + //This might be making unsafe assumptions about usage + //Merge return and first arg + DSNodeHandle RetNH = getValueDest(*CS.getInstruction()); + RetNH.mergeWith(getValueDest(**CS.arg_begin())); + if (DSNode *N = RetNH.getNode()) + N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker(); + //and read second pointer + if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode()) + N->setReadMarker(); + return; } else { // Unknown function, warn if it returns a pointer type or takes a // pointer argument. |