From dc89737bcdbb8f69d8ae7578bdfa904cabcfc5ed Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sat, 6 Jul 2013 00:29:58 +0000 Subject: Extend 'readonly' and 'readnone' to work on function arguments as well as functions. Make the function attributes pass add it to known library functions and when it can deduce it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185735 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/CallSite.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/llvm/Support') diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index 961c38e..2a1c5ca 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -257,6 +257,15 @@ public: return paramHasAttr(ArgNo + 1, Attribute::ByVal); } + bool doesNotAccessMemory(unsigned ArgNo) const { + return paramHasAttr(ArgNo + 1, Attribute::ReadNone); + } + + bool onlyReadsMemory(unsigned ArgNo) const { + return paramHasAttr(ArgNo + 1, Attribute::ReadOnly) || + paramHasAttr(ArgNo + 1, Attribute::ReadNone); + } + /// hasArgument - Returns true if this CallSite passes the given Value* as an /// argument to the called function. bool hasArgument(const Value *Arg) const { -- cgit v1.1