[llvm-commits] [poolalloc] r131251 - /poolalloc/trunk/lib/DSA/Local.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Thu May 12 14:53:19 PDT 2011
Author: aggarwa4
Date: Thu May 12 16:53:19 2011
New Revision: 131251
URL: http://llvm.org/viewvc/llvm-project?rev=131251&view=rev
Log:
Added support for handling va_arg in x86_64.
Modified:
poolalloc/trunk/lib/DSA/Local.cpp
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=131251&r1=131250&r2=131251&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Thu May 12 16:53:19 2011
@@ -415,20 +415,48 @@
}
void GraphBuilder::visitVAArgInst(VAArgInst &I) {
- assert(0 && "What frontend generates this?");
- //FIXME: also updates the argument
- DSNodeHandle Ptr = getValueDest(I.getOperand(0));
- if (Ptr.isNull()) return;
+ Module *M = FB->getParent();
+ Triple TargetTriple(M->getTargetTriple());
+ Triple::ArchType Arch = TargetTriple.getArch();
+ switch(Arch) {
+ case Triple::x86_64: {
+ // On x86_64, we have va_list as a struct {i32, i32, i8*, i8* }
+ // The first i8* is where arguments generally go, but the second i8* can
+ // be used also to pass arguments by register.
+ // We model this by having both the i8*'s point to an array of pointers
+ // to the arguments.
+ DSNodeHandle Ptr = G.getVANodeFor(*FB);
+ DSNodeHandle Dest = getValueDest(&I);
+ if (Ptr.isNull()) return;
+
+ // Make that the node is read and written
+ Ptr.getNode()->setReadMarker()->setModifiedMarker();
+
+ // Not updating type info, as it is already a collapsed node
+
+ if (isa<PointerType>(I.getType()))
+ Dest.mergeWith(Ptr);
+ return;
+ }
- // Make that the node is read and written
- Ptr.getNode()->setReadMarker()->setModifiedMarker();
+ default: {
+ assert(0 && "What frontend generates this?");
+ DSNodeHandle Ptr = getValueDest(I.getOperand(0));
- // Ensure a type record exists.
- DSNode *PtrN = Ptr.getNode();
- PtrN->mergeTypeInfo(I.getType(), Ptr.getOffset());
+ //FIXME: also updates the argument
+ if (Ptr.isNull()) return;
- if (isa<PointerType>(I.getType()))
- setDestTo(I, getLink(Ptr));
+ // Make that the node is read and written
+ Ptr.getNode()->setReadMarker()->setModifiedMarker();
+
+ // Ensure a type record exists.
+ DSNode *PtrN = Ptr.getNode();
+ PtrN->mergeTypeInfo(I.getType(), Ptr.getOffset());
+
+ if (isa<PointerType>(I.getType()))
+ setDestTo(I, getLink(Ptr));
+ }
+ }
}
void GraphBuilder::visitIntToPtrInst(IntToPtrInst &I) {
More information about the llvm-commits
mailing list