mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 13:36:28 +00:00
Add special case handling for calloc and realloc
llvm-svn: 8630
This commit is contained in:
parent
b12a8a6177
commit
372fe6873d
@ -412,6 +412,22 @@ void GraphBuilder::visitInvokeInst(InvokeInst &II) {
|
||||
}
|
||||
|
||||
void GraphBuilder::visitCallSite(CallSite CS) {
|
||||
// Special case handling of certain libc allocation functions here.
|
||||
if (Function *F = CS.getCalledFunction())
|
||||
if (F->isExternal())
|
||||
if (F->getName() == "calloc") {
|
||||
setDestTo(*CS.getInstruction(),
|
||||
createNode()->setHeapNodeMarker()->setModifiedMarker());
|
||||
return;
|
||||
} else if (F->getName() == "realloc") {
|
||||
DSNodeHandle RetNH = getValueDest(*CS.getInstruction());
|
||||
RetNH.mergeWith(getValueDest(**CS.arg_begin()));
|
||||
DSNode *N = RetNH.getNode();
|
||||
if (N) N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Set up the return value...
|
||||
DSNodeHandle RetVal;
|
||||
Instruction *I = CS.getInstruction();
|
||||
|
Loading…
Reference in New Issue
Block a user