21 #define DEBUG_TYPE "functionattrs"
38 STATISTIC(NumReadNone,
"Number of functions marked readnone");
39 STATISTIC(NumReadOnly,
"Number of functions marked readonly");
40 STATISTIC(NumNoCapture,
"Number of arguments marked nocapture");
41 STATISTIC(NumReadNoneArg,
"Number of arguments marked readnone");
42 STATISTIC(NumReadOnlyArg,
"Number of arguments marked readonly");
43 STATISTIC(NumNoAlias,
"Number of function returns marked noalias");
44 STATISTIC(NumAnnotated,
"Number of attributes added to library functions");
72 void setDoesNotAccessMemory(
Function &
F) {
79 void setOnlyReadsMemory(
Function &F) {
93 void setDoesNotCapture(
Function &F,
unsigned n) {
100 void setOnlyReadsMemory(
Function &F,
unsigned n) {
107 void setDoesNotAlias(
Function &F,
unsigned n) {
117 bool inferPrototypeAttributes(
Function &F);
138 "Deduce function attributes",
false,
false)
149 bool FunctionAttrs::AddReadAttrs(
const CallGraphSCC &SCC) {
155 SCCNodes.
insert((*I)->getFunction());
159 bool ReadsMemory =
false;
192 if (CS.getCalledFunction() && SCCNodes.
count(CS.getCalledFunction()))
209 if (!AA->pointsToConstantMemory(Loc,
true)) {
228 }
else if (
LoadInst *
LI = dyn_cast<LoadInst>(I)) {
230 if (!
LI->isVolatile()) {
232 if (AA->pointsToConstantMemory(Loc,
true))
235 }
else if (
StoreInst *SI = dyn_cast<StoreInst>(I)) {
237 if (!SI->isVolatile()) {
239 if (AA->pointsToConstantMemory(Loc,
true))
242 }
else if (
VAArgInst *VI = dyn_cast<VAArgInst>(I)) {
245 if (AA->pointsToConstantMemory(Loc,
true))
262 bool MadeChange =
false;
282 AttributeSet::FunctionIndex, B));
301 struct ArgumentGraphNode {
306 class ArgumentGraph {
309 typedef std::map<Argument*, ArgumentGraphNode> ArgumentMapTy;
311 ArgumentMapTy ArgumentMap;
319 ArgumentGraphNode SyntheticRoot;
322 ArgumentGraph() { SyntheticRoot.Definition = 0; }
326 iterator
begin() {
return SyntheticRoot.Uses.
begin(); }
327 iterator
end() {
return SyntheticRoot.Uses.
end(); }
328 ArgumentGraphNode *getEntryNode() {
return &SyntheticRoot; }
330 ArgumentGraphNode *operator[](
Argument *
A) {
331 ArgumentGraphNode &Node = ArgumentMap[
A];
333 SyntheticRoot.Uses.push_back(&Node);
343 : Captured(
false), SCCNodes(SCCNodes) {}
345 void tooManyUses() { Captured =
true; }
347 bool captured(
Use *U) {
349 if (!CS.getInstruction()) { Captured =
true;
return true; }
351 Function *F = CS.getCalledFunction();
352 if (!F || !SCCNodes.
count(F)) { Captured =
true;
return true; }
357 PI != PE; ++PI, ++AI) {
359 assert(F->
isVarArg() &&
"More params than args in non-varargs call");
369 assert(Found &&
"Capturing call-site captured nothing?");
388 return N->Uses.begin();
391 return N->Uses.end();
397 return AG->getEntryNode();
425 Use *U = &UI.getUse();
430 while (!Worklist.
empty()) {
436 case Instruction::BitCast:
437 case Instruction::GetElementPtr:
443 Use *U = &UI.getUse();
450 case Instruction::Invoke: {
470 "More params than args in non-varargs call.");
473 if (SCCNodes.
count(AI))
488 case Instruction::ICmp:
501 bool FunctionAttrs::AddArgumentAttrs(
const CallGraphSCC &SCC) {
502 bool Changed =
false;
539 if (
A->getType()->isPointerTy() && !
A->hasNoCaptureAttr()) {
540 A->addAttr(AttributeSet::get(F->
getContext(),
A->getArgNo() + 1, B));
550 if (!
A->getType()->isPointerTy())
continue;
551 bool HasNonLocalUses =
false;
552 if (!
A->hasNoCaptureAttr()) {
553 ArgumentUsesTracker Tracker(SCCNodes);
555 if (!Tracker.Captured) {
556 if (Tracker.Uses.empty()) {
558 A->addAttr(AttributeSet::get(F->
getContext(),
A->getArgNo()+1, B));
565 ArgumentGraphNode *Node = AG[
A];
567 UE = Tracker.Uses.end(); UI != UE; ++UI) {
568 Node->Uses.push_back(AG[*UI]);
570 HasNonLocalUses =
true;
576 if (!HasNonLocalUses && !
A->onlyReadsMemory()) {
587 A->addAttr(AttributeSet::get(
A->getContext(),
A->getArgNo() + 1, B));
604 std::vector<ArgumentGraphNode*> &ArgumentSCC = *
I;
605 if (ArgumentSCC.size() == 1) {
606 if (!ArgumentSCC[0]->Definition)
continue;
609 if (ArgumentSCC[0]->Uses.size() == 1 &&
610 ArgumentSCC[0]->Uses[0] == ArgumentSCC[0]) {
611 Argument *
A = ArgumentSCC[0]->Definition;
619 bool SCCCaptured =
false;
620 for (std::vector<ArgumentGraphNode*>::iterator I = ArgumentSCC.begin(),
621 E = ArgumentSCC.end(); I != E && !SCCCaptured; ++
I) {
622 ArgumentGraphNode *Node = *
I;
623 if (Node->Uses.empty()) {
624 if (!Node->Definition->hasNoCaptureAttr())
628 if (SCCCaptured)
continue;
633 for (std::vector<ArgumentGraphNode*>::iterator I = ArgumentSCC.begin(),
634 E = ArgumentSCC.end(); I != E; ++
I) {
635 ArgumentSCCNodes.
insert((*I)->Definition);
638 for (std::vector<ArgumentGraphNode*>::iterator I = ArgumentSCC.begin(),
639 E = ArgumentSCC.end(); I != E && !SCCCaptured; ++
I) {
640 ArgumentGraphNode *
N = *
I;
642 UE = N->Uses.end(); UI != UE; ++UI) {
650 if (SCCCaptured)
continue;
652 for (
unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
653 Argument *A = ArgumentSCC[i]->Definition;
671 for (
unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
672 Argument *A = ArgumentSCC[i]->Definition;
687 for (
unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
688 Argument *A = ArgumentSCC[i]->Definition;
701 bool FunctionAttrs::IsFunctionMallocLike(
Function *F,
705 if (
ReturnInst *
Ret = dyn_cast<ReturnInst>(I->getTerminator()))
706 FlowsToReturn.
insert(
Ret->getReturnValue());
708 for (
unsigned i = 0; i != FlowsToReturn.
size(); ++i) {
709 Value *RetVal = FlowsToReturn[i];
711 if (
Constant *
C = dyn_cast<Constant>(RetVal)) {
712 if (!
C->isNullValue() && !isa<UndefValue>(
C))
718 if (isa<Argument>(RetVal))
721 if (
Instruction *RVI = dyn_cast<Instruction>(RetVal))
722 switch (RVI->getOpcode()) {
724 case Instruction::BitCast:
725 case Instruction::GetElementPtr:
726 FlowsToReturn.
insert(RVI->getOperand(0));
735 PHINode *PN = cast<PHINode>(RVI);
742 case Instruction::Alloca:
745 case Instruction::Invoke: {
749 if (CS.getCalledFunction() &&
750 SCCNodes.
count(CS.getCalledFunction()))
765 bool FunctionAttrs::AddNoAliasAttrs(
const CallGraphSCC &SCC) {
771 SCCNodes.
insert((*I)->getFunction());
796 if (!IsFunctionMallocLike(F, SCCNodes))
800 bool MadeChange =
false;
817 bool FunctionAttrs::inferPrototypeAttributes(
Function &F) {
820 if (!(TLI->getLibFunc(F.
getName(), TheLibFunc) && TLI->has(TheLibFunc)))
823 switch (TheLibFunc) {
827 setOnlyReadsMemory(F);
829 setDoesNotCapture(F, 1);
837 setOnlyReadsMemory(F);
851 setDoesNotCapture(F, 2);
852 setOnlyReadsMemory(F, 1);
864 setDoesNotCapture(F, 2);
865 setOnlyReadsMemory(F, 2);
873 setDoesNotCapture(F, 1);
874 setDoesNotCapture(F, 2);
875 setOnlyReadsMemory(F, 2);
888 setOnlyReadsMemory(F);
890 setDoesNotCapture(F, 1);
891 setDoesNotCapture(F, 2);
897 setOnlyReadsMemory(F);
899 setDoesNotCapture(F, 2);
906 setDoesNotCapture(F, 2);
907 setOnlyReadsMemory(F, 2);
913 setDoesNotCapture(F, 1);
914 setOnlyReadsMemory(F, 1);
921 setDoesNotCapture(F, 1);
929 setDoesNotAlias(F, 0);
930 setDoesNotCapture(F, 1);
931 setOnlyReadsMemory(F, 1);
940 setDoesNotCapture(F, 1);
941 setDoesNotCapture(F, 2);
942 setOnlyReadsMemory(F, 1);
950 setDoesNotCapture(F, 1);
951 setDoesNotCapture(F, 2);
952 setOnlyReadsMemory(F, 1);
953 setOnlyReadsMemory(F, 2);
961 setDoesNotCapture(F, 1);
962 setDoesNotCapture(F, 2);
963 setOnlyReadsMemory(F, 2);
971 setDoesNotCapture(F, 1);
972 setDoesNotCapture(F, 3);
973 setOnlyReadsMemory(F, 3);
981 setDoesNotCapture(F, 2);
982 setDoesNotCapture(F, 3);
983 setOnlyReadsMemory(F, 2);
990 setDoesNotCapture(F, 1);
991 setOnlyReadsMemory(F, 1);
998 setDoesNotAlias(F, 0);
1005 setOnlyReadsMemory(F);
1007 setDoesNotCapture(F, 1);
1008 setDoesNotCapture(F, 2);
1014 setOnlyReadsMemory(F);
1024 setDoesNotCapture(F, 2);
1033 setDoesNotCapture(F, 2);
1034 setOnlyReadsMemory(F, 2);
1039 setDoesNotAlias(F, 0);
1046 setDoesNotCapture(F, 1);
1047 setOnlyReadsMemory(F, 1);
1054 setDoesNotCapture(F, 1);
1062 setDoesNotAlias(F, 0);
1063 setDoesNotCapture(F, 1);
1070 setDoesNotCapture(F, 2);
1077 setDoesNotCapture(F, 1);
1086 setDoesNotCapture(F, 1);
1087 setOnlyReadsMemory(F, 1);
1095 setDoesNotCapture(F, 1);
1096 setDoesNotCapture(F, 2);
1097 setOnlyReadsMemory(F, 1);
1098 setOnlyReadsMemory(F, 2);
1106 setDoesNotCapture(F, 1);
1107 setDoesNotCapture(F, 2);
1108 setOnlyReadsMemory(F, 1);
1114 setDoesNotCapture(F, 2);
1115 setOnlyReadsMemory(F, 2);
1123 setDoesNotCapture(F, 1);
1124 setDoesNotCapture(F, 2);
1125 setOnlyReadsMemory(F, 1);
1133 setOnlyReadsMemory(F);
1134 setDoesNotCapture(F, 1);
1135 setDoesNotCapture(F, 2);
1141 setDoesNotCapture(F, 1);
1148 setDoesNotAlias(F, 0);
1155 setDoesNotCapture(F, 1);
1156 setOnlyReadsMemory(F, 1);
1164 setDoesNotCapture(F, 1);
1173 setOnlyReadsMemory(F);
1174 setDoesNotCapture(F, 1);
1180 setDoesNotCapture(F, 1);
1181 setOnlyReadsMemory(F, 1);
1190 setDoesNotAlias(F, 0);
1191 setDoesNotCapture(F, 1);
1192 setDoesNotCapture(F, 2);
1193 setOnlyReadsMemory(F, 1);
1194 setOnlyReadsMemory(F, 2);
1202 setDoesNotAlias(F, 0);
1203 setDoesNotCapture(F, 2);
1204 setOnlyReadsMemory(F, 2);
1223 setDoesNotCapture(F, 1);
1229 setDoesNotCapture(F, 1);
1230 setOnlyReadsMemory(F);
1241 setDoesNotCapture(F, 2);
1249 setDoesNotCapture(F, 3);
1257 setDoesNotCapture(F, 1);
1258 setDoesNotCapture(F, 4);
1266 setDoesNotCapture(F, 1);
1267 setDoesNotCapture(F, 4);
1275 setDoesNotCapture(F, 1);
1276 setDoesNotCapture(F, 2);
1277 setOnlyReadsMemory(F, 1);
1286 setDoesNotCapture(F, 1);
1287 setDoesNotCapture(F, 2);
1288 setOnlyReadsMemory(F, 2);
1296 setDoesNotCapture(F, 1);
1297 setDoesNotCapture(F, 2);
1305 setDoesNotCapture(F, 1);
1311 setOnlyReadsMemory(F);
1312 setDoesNotCapture(F, 1);
1322 setDoesNotCapture(F, 2);
1328 setDoesNotCapture(F, 1);
1329 setOnlyReadsMemory(F, 1);
1335 setDoesNotCapture(F, 2);
1341 setDoesNotCapture(F, 1);
1347 setDoesNotCapture(F, 1);
1348 setOnlyReadsMemory(F, 1);
1354 setDoesNotCapture(F, 1);
1355 setOnlyReadsMemory(F, 1);
1364 setDoesNotCapture(F, 1);
1365 setDoesNotCapture(F, 2);
1366 setOnlyReadsMemory(F, 1);
1367 setOnlyReadsMemory(F, 2);
1373 setDoesNotCapture(F, 2);
1381 setDoesNotCapture(F, 1);
1382 setOnlyReadsMemory(F, 1);
1388 setDoesNotCapture(F, 2);
1394 setDoesNotCapture(F, 2);
1395 setOnlyReadsMemory(F, 2);
1407 setDoesNotAlias(F, 0);
1408 setDoesNotCapture(F, 1);
1409 setDoesNotCapture(F, 2);
1410 setOnlyReadsMemory(F, 1);
1411 setOnlyReadsMemory(F, 2);
1417 setDoesNotCapture(F, 1);
1423 setDoesNotCapture(F, 1);
1424 setOnlyReadsMemory(F, 1);
1432 setDoesNotCapture(F, 1);
1433 setDoesNotCapture(F, 2);
1434 setOnlyReadsMemory(F, 1);
1435 setOnlyReadsMemory(F, 2);
1443 setDoesNotCapture(F, 1);
1444 setDoesNotCapture(F, 2);
1445 setOnlyReadsMemory(F, 2);
1451 setDoesNotAlias(F, 0);
1457 setDoesNotCapture(F, 1);
1458 setOnlyReadsMemory(F, 1);
1467 setDoesNotCapture(F, 1);
1468 setDoesNotCapture(F, 2);
1469 setOnlyReadsMemory(F, 2);
1477 setDoesNotCapture(F, 1);
1478 setDoesNotCapture(F, 3);
1479 setOnlyReadsMemory(F, 3);
1485 setDoesNotCapture(F, 1);
1486 setOnlyReadsMemory(F, 1);
1494 setDoesNotAlias(F, 0);
1495 setDoesNotCapture(F, 1);
1496 setOnlyReadsMemory(F, 1);
1502 setDoesNotAlias(F, 0);
1508 setDoesNotCapture(F, 1);
1515 setDoesNotAccessMemory(F);
1523 setDoesNotCapture(F, 1);
1524 setDoesNotCapture(F, 2);
1525 setOnlyReadsMemory(F, 1);
1531 setDoesNotCapture(F, 1);
1532 setOnlyReadsMemory(F, 1);
1538 setDoesNotCapture(F, 4);
1547 setDoesNotAlias(F, 0);
1548 setDoesNotCapture(F, 1);
1549 setOnlyReadsMemory(F, 1);
1556 setDoesNotCapture(F, 2);
1557 setOnlyReadsMemory(F, 2);
1563 setDoesNotCapture(F, 1);
1569 setDoesNotCapture(F, 2);
1576 setDoesNotCapture(F, 1);
1577 setOnlyReadsMemory(F, 1);
1587 setDoesNotCapture(F, 1);
1588 setDoesNotCapture(F, 2);
1589 setOnlyReadsMemory(F, 1);
1597 setDoesNotCapture(F, 1);
1598 setDoesNotCapture(F, 2);
1599 setOnlyReadsMemory(F, 1);
1600 setOnlyReadsMemory(F, 2);
1609 setDoesNotAlias(F, 0);
1610 setDoesNotCapture(F, 1);
1611 setDoesNotCapture(F, 2);
1612 setOnlyReadsMemory(F, 1);
1613 setOnlyReadsMemory(F, 2);
1620 setDoesNotCapture(F, 1);
1626 setDoesNotAlias(F, 0);
1633 setDoesNotCapture(F, 2);
1639 setDoesNotCapture(F, 1);
1640 setOnlyReadsMemory(F, 1);
1650 setDoesNotCapture(F, 1);
1651 setDoesNotCapture(F, 2);
1662 bool FunctionAttrs::annotateLibraryCalls(
const CallGraphSCC &SCC) {
1663 bool MadeChange =
false;
1671 MadeChange |= inferPrototypeAttributes(*F);
1678 AA = &getAnalysis<AliasAnalysis>();
1679 TLI = &getAnalysis<TargetLibraryInfo>();
1681 bool Changed = annotateLibraryCalls(SCC);
1682 Changed |= AddReadAttrs(SCC);
1683 Changed |= AddArgumentAttrs(SCC);
1684 Changed |= AddNoAliasAttrs(SCC);
void initializeFunctionAttrsPass(PassRegistry &)
bool hasNoCaptureAttr() const
Return true if this argument has the nocapture attribute on it in its containing function.
void flockfile(FILE *file);
int strcmp(const char *s1, const char *s2);
static ChildIteratorType nodes_end(ArgumentGraph *AG)
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
int fseeko(FILE *stream, off_t offset, int whence);
long ftell(FILE *stream);
int uname(struct utsname *name);
int sscanf(const char *s, const char *format, ... );
size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
int sprintf(char *str, const char *format, ...);
static PassRegistry * getPassRegistry()
LLVMContext & getContext() const
void bcopy(const void *s1, void *s2, size_t n);
int remove(const char *path);
LLVM Argument representation.
void *memcpy(void *s1, const void *s2, size_t n);
int fstatvfs64(int fildes, struct statvfs64 *buf);
char *__strndup(const char *s, size_t n);
int chmod(const char *path, mode_t mode);
int fstat(int fildes, struct stat *buf);
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
char *strpbrk(const char *s1, const char *s2);
off64_t ftello64(FILE *stream)
unsigned getNumParams() const
std::vector< CallGraphNode * >::const_iterator iterator
int fstat64(int filedes, struct stat64 *buf)
void funlockfile(FILE *file);
FILE *fdopen(int fildes, const char *mode);.
int printf(const char *format, ...);
int strncasecmp(const char *s1, const char *s2, size_t n);
long int strtol(const char *nptr, char **endptr, int base);
int lstat64(const char *path, struct stat64 *buf);
int open(const char *path, int oflag, ... );
DIR *opendir(const char *dirname);.
double frexp(double num, int *exp);
float strtof(const char *nptr, char **endptr);
const_iterator begin(StringRef path)
Get begin iterator over path.
float modff(float, float *iptr);
Type * getReturnType() const
int putc(int c, FILE *stream);
char *strcat(char *s1, const char *s2);
FILE *fopen(const char *filename, const char *mode);.
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
int __isoc99_sscanf(const char *s, const char *format, ...)
ssize_t read(int fildes, void *buf, size_t nbyte);
size_type size() const
Determine the number of elements in the SetVector.
int fclose(FILE *stream);
virtual void getAnalysisUsage(AnalysisUsage &Info) const
LoopInfoBase< BlockT, LoopT > * LI
double strtod(const char *nptr, char **endptr);
bool doesNotAlias(unsigned n) const
Determine if the parameter does not alias other parameters.
StringRef getName() const
Pass * createFunctionAttrsPass()
void addAttr(AttributeSet AS)
Add a Attribute to an argument.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
int access(const char *path, int amode);
char *fgets(char *s, int n, FILE *stream);
long double frexpl(long double num, int *exp);
inst_iterator inst_begin(Function *F)
bool doesNotThrow() const
Determine if the function cannot unwind.
int ftrylockfile(FILE *file);
uint32_t ntohl(uint32_t netlong);
int _IO_getc(_IO_FILE * __fp);
off_t ftello(FILE *stream);
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
INITIALIZE_PASS_BEGIN(FunctionAttrs,"functionattrs","Deduce function attributes", false, false) INITIALIZE_PASS_END(FunctionAttrs
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
No attributes have been set.
double modf(double x, double *iptr);
double atof(const char *str);
char *strchr(const char *s, int c);
int gettimeofday(struct timeval *tp, void *tzp);
int strcoll(const char *s1, const char *s2);
ID
LLVM Calling Convention Representation.
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
Function does not access memory.
Function creates no aliases of pointer.
scc_iterator< T > scc_begin(const T &G)
int atoi(const char *str);
int statvfs(const char *path, struct statvfs *buf);
long long atoll(const char *nptr);
ssize_t readlink(const char *path, char *buf, size_t bufsize);
int system(const char *command);
bool insert(const value_type &X)
Insert a new element into the SetVector.
bool mayReadFromMemory() const
bool count(PtrType Ptr) const
count - Return true if the specified pointer is in the set.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
long long int strtoll(const char *nptr, char **endptr, int base);
size_t strxfrm(char *s1, const char *s2, size_t n);
char *stpncpy(char *s1, const char *s2, size_t n);
int rename(const char *old, const char *new);
int ungetc(int c, FILE *stream);
char *strndup(const char *s1, size_t n);
void removeAttributes(unsigned i, AttributeSet attr)
removes the attributes from the list of attributes.
bool doesNotAccessMemory() const
Determine if the function does not access memory.
Considered to not alias after call.
bool onlyReadsMemory(ImmutableCallSite CS)
int rmdir(const char *path);
int vprintf(const char *restrict format, va_list ap);
unsigned getNumIncomingValues() const
void setDoesNotCapture(unsigned n)
User::op_iterator arg_iterator
int memcmp(const void *s1, const void *s2, size_t n);
Type * getParamType(unsigned i) const
Parameter type accessors.
char *realpath(const char *file_name, char *resolved_name);
int setvbuf(FILE *stream, char *buf, int type, size_t size);
friend const_iterator end(StringRef path)
Get end iterator over path.
char *strrchr(const char *s, int c);
void setOnlyReadsMemory()
int vfprintf(FILE *stream, const char *format, va_list ap);
int pclose(FILE *stream);
value_use_iterator< User > use_iterator
int lstat(const char *path, struct stat *buf);
void clearerr(FILE *stream);
uint16_t ntohs(uint16_t netshort);
int getitimer(int which, struct itimerval *value);
static bool mayBeOverridden(LinkageTypes Linkage)
int vsnprintf(char *s, size_t n, const char *format, va_list ap);
scc_iterator< T > scc_end(const T &G)
LLVM Constant Representation.
int fstatvfs(int fildes, struct statvfs *buf);
int bcmp(const void *s1, const void *s2, size_t n);
int fgetpos(FILE *stream, fpos_t *pos);
static ChildIteratorType child_end(NodeType *N)
void setDoesNotAlias(unsigned n)
int fsetpos(FILE *stream, const fpos_t *pos);
void *realloc(void *ptr, size_t size);
int utimes(const char *path, const struct timeval times[2]);
int vfscanf(FILE *stream, const char *format, va_list arg);
long double strtold(const char *nptr, char **endptr);
static NodeType * getEntryNode(NodeType *A)
int fseeko64(FILE *stream, off64_t offset, int whence)
int unlink(const char *path);
void *valloc(size_t size);
int snprintf(char *s, size_t n, const char *format, ...);
float frexpf(float num, int *exp);
void *memchr(const void *s, int c, size_t n);
void perror(const char *s);
int _IO_putc(int __c, _IO_FILE * __fp);
void *memmove(void *s1, const void *s2, size_t n);
uint16_t htons(uint16_t hostshort);
Location - A description of a memory location.
int mkdir(const char *path, mode_t mode);
#define INITIALIZE_AG_DEPENDENCY(depName)
static bool doesAccessArgPointees(ModRefBehavior MRB)
char *strstr(const char *s1, const char *s2);
bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, bool StoreCaptures)
LLVMContext & getContext() const
All values hold a context through their type.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
FILE *fopen64(const char *filename, const char *opentype)
const Value * getTrueValue() const
bool mayWriteToMemory() const
int stat(const char *path, struct stat *buf);
int fputs(const char *s, FILE *stream);
clock_t times(struct tms *buffer);
int stat64(const char *path, struct stat64 *buf);
char *strdup(const char *s1);
char * __strdup(const char *s);
void setbuf(FILE *stream, char *buf);
int getc_unlocked(FILE *stream);
int chown(const char *path, uid_t owner, gid_t group);
A SetVector that performs no allocations if smaller than a certain size.
char *strncat(char *s1, const char *s2, size_t n);
bool doesNotAccessMemory() const
Determine if the call does not access memory.
struct passwd *getpwnam(const char *name);
Value * getIncomingValue(unsigned i) const
friend const_iterator begin(StringRef path)
Get begin iterator over path.
int fprintf(FILE *stream, const char *format, ...);
int vsprintf(char *s, const char *format, va_list ap);
void *memccpy(void *s1, const void *s2, int c, size_t n);
MDNode * getMetadata(unsigned KindID) const
size_t strcspn(const char *s1, const char *s2);
unsigned long int strtoul(const char *nptr, char **endptr, int base);
int fflush(FILE *stream);
size_t strlen(const char *s);
char *stpcpy(char *s1, const char *s2);
void rewind(FILE *stream);
int open64(const char *filename, int flags[, mode_t mode])
void addAttribute(unsigned i, Attribute::AttrKind attr)
adds the attribute to the list of attributes.
FILE *popen(const char *command, const char *mode);.
Function only reads from memory.
int statvfs64(const char *path, struct statvfs64 *buf)
int fscanf(FILE *stream, const char *format, ... );
int vsscanf(const char *s, const char *format, va_list arg);
int fputc(int c, FILE *stream);
ssize_t write(int fildes, const void *buf, size_t nbyte);
int unsetenv(const char *name);
int ferror(FILE *stream);
STATISTIC(NumReadNone,"Number of functions marked readnone")
ArgumentGraphNode NodeType
static bool onlyAccessesArgPointees(ModRefBehavior MRB)
void *malloc(size_t size);
bool isDeclaration() const
void setDoesNotAccessMemory()
int fseek(FILE *stream, long offset, int whence);
int utime(const char *path, const struct utimbuf *times);
char * __strtok_r(char *s, const char *delim, char **save_ptr);
void bzero(void *s, size_t n);
FunctionType * getFunctionType() const
Deduce function attributes
static ChildIteratorType child_begin(NodeType *N)
long double modfl(long double value, long double *iptr);
static uint64_t const UnknownSize
int strcasecmp(const char *s1, const char *s2);
int getlogin_r(char *name, size_t namesize);
int fileno(FILE *stream);
Type * getReturnType() const
int lchown(const char *path, uid_t owner, gid_t group);
LLVM Value Representation.
bool doesNotCapture(unsigned n) const
Determine if the parameter can be captured.
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
static ChildIteratorType nodes_begin(ArgumentGraph *AG)
time_t mktime(struct tm *timeptr);
int scanf(const char *restrict format, ... );
char *strcpy(char *s1, const char *s2);
print Print MemDeps of function
void *memalign(size_t boundary, size_t size);
const Value * getFalseValue() const
inst_iterator inst_end(Function *F)
int __isoc99_scanf (const char *format, ...)
int strncmp(const char *s1, const char *s2, size_t n);
int vscanf(const char *format, va_list arg);
char *getenv(const char *name);
uint32_t htonl(uint32_t hostlong);
void *calloc(size_t count, size_t size);
SmallVectorImpl< ArgumentGraphNode * >::iterator ChildIteratorType
static Attribute::AttrKind determinePointerReadAttrs(Argument *A, const SmallPtrSet< Argument *, 8 > &SCCNodes)
static NodeType * getEntryNode(ArgumentGraph *AG)
size_t strspn(const char *s1, const char *s2);
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
FunTy * getCalledFunction() const
long atol(const char *str);
char *strncpy(char *s1, const char *s2, size_t n);