Rename the 'const' parameter attribute to 'readnone',
authorDuncan Sands <baldrick@free.fr>
Thu, 22 Nov 2007 20:23:04 +0000 (20:23 +0000)
committerDuncan Sands <baldrick@free.fr>
Thu, 22 Nov 2007 20:23:04 +0000 (20:23 +0000)
and the 'pure' parameter attribute to 'readonly'.
Names suggested by DannyB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44273 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LangRef.html
include/llvm/ParameterAttributes.h
lib/AsmParser/LLLexer.cpp
lib/AsmParser/llvmAsmParser.y
lib/VMCore/Function.cpp
lib/VMCore/Verifier.cpp

index 9c4bbf094d3fd17f0227dbfd0c0eddb62e90e65c..0c2f8ca8c13fd49c7df9af6cb21919448b67fd7e 100644 (file)
@@ -813,13 +813,13 @@ a power of 2.</p>
     <dt><tt>nest</tt></dt>
     <dd>This indicates that the parameter can be excised using the
     <a href="#int_trampoline">trampoline intrinsics</a>.</dd>
-    <dt><tt>pure</tt></dt>
+    <dt><tt>readonly</tt></dt>
     <dd>This function attribute indicates that the function has no side-effects
-    except for producing a return value.  The value returned must only depend on
-    the function arguments and/or global variables.  It may use values obtained
-    by dereferencing pointers.</dd>
-    <dt><tt>const</tt></dt>
-    <dd>A <tt>const</tt> function has the same restrictions as a <tt>pure</tt>
+    except for producing a return value or throwing an exception.  The value
+    returned must only depend on the function arguments and/or global variables.
+    It may use values obtained by dereferencing pointers.</dd>
+    <dt><tt>readnone</tt></dt>
+    <dd>A <tt>readnone</tt> function has the same restrictions as a <tt>readonly</tt>
     function, but in addition it is not allowed to dereference any pointer arguments
     or global variables.
   </dl>
index 5d3ef9aba72ee59bc9aa610af131a3ef67580c9e..4c48d8707fbfeb9a9c3e492555b98f79059519f3 100644 (file)
@@ -39,8 +39,8 @@ enum Attributes {
   NoAlias    = 1 << 6,  ///< Considered to not alias after call
   ByVal      = 1 << 7,  ///< Pass structure by value
   Nest       = 1 << 8,  ///< Nested function static chain
-  Pure       = 1 << 9,  ///< Function is pure
-  Const      = 1 << 10  ///< Function is const
+  ReadNone   = 1 << 9,  ///< Function does not access memory
+  ReadOnly   = 1 << 10  ///< Function only reads from memory
 };
 
 }
index 27798be618e7f13199163ef1749516f74695a07d..5b1f0740dce25750d1930dc75d912c02bc50d795 100644 (file)
@@ -484,8 +484,8 @@ int LLLexer::LexIdentifier() {
   KEYWORD("noalias", NOALIAS);
   KEYWORD("byval", BYVAL);
   KEYWORD("nest", NEST);
-  KEYWORD("pure", PURE);
-  KEYWORD("const", CONST);
+  KEYWORD("readnone", READNONE);
+  KEYWORD("readonly", READONLY);
   
   KEYWORD("type", TYPE);
   KEYWORD("opaque", OPAQUE);
index 599300d30f5688248e7067a057ab21137ac261d2..a1373ce18da2cc0e3e910757060fb49de0688629 100644 (file)
@@ -1090,7 +1090,7 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
 
 // Function Attributes
 %token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST
-%token CONST PURE
+%token READNONE READONLY
 
 // Visibility Styles
 %token DEFAULT HIDDEN PROTECTED
@@ -1234,8 +1234,8 @@ FuncAttr      : NORETURN { $$ = ParamAttr::NoReturn; }
               | NOUNWIND { $$ = ParamAttr::NoUnwind; }
               | ZEROEXT  { $$ = ParamAttr::ZExt;     }
               | SIGNEXT  { $$ = ParamAttr::SExt;     }
-              | PURE     { $$ = ParamAttr::Pure;     }
-              | CONST    { $$ = ParamAttr::Const;    }
+              | READNONE { $$ = ParamAttr::ReadNone; }
+              | READONLY { $$ = ParamAttr::ReadOnly; }
               ;
 
 OptFuncAttrs  : /* empty */ { $$ = ParamAttr::None; }
index a011aaea3384c4eaac4db8000cc1de3e04007716..6c29371862652585285c8daaea452cbc3a492563 100644 (file)
@@ -108,10 +108,10 @@ ParamAttrsList::getParamAttrsText(uint16_t Attrs) {
     Result += "byval ";
   if (Attrs & ParamAttr::Nest)
     Result += "nest ";
-  if (Attrs & ParamAttr::Pure)
-    Result += "pure ";
-  if (Attrs & ParamAttr::Const)
-    Result += "const ";  
+  if (Attrs & ParamAttr::ReadNone)
+    Result += "readnone ";
+  if (Attrs & ParamAttr::ReadOnly)
+    Result += "readonly ";
   return Result;
 }
 
index 6597af101c0f8082beb2e094d6195d5ae358436d..1f726afa5d76fee63c64eb59e9b6cf30c1665f10 100644 (file)
@@ -399,7 +399,7 @@ void Verifier::visitFunction(Function &F) {
 
   const uint16_t ParameterIncompatible =
     ParamAttr::NoReturn | ParamAttr::NoUnwind |
-    ParamAttr::Const    | ParamAttr::Pure;
+    ParamAttr::ReadNone | ParamAttr::ReadOnly;
 
   const uint16_t MutuallyIncompatible[3] = {
     ParamAttr::ByVal | ParamAttr::InReg |
@@ -407,7 +407,7 @@ void Verifier::visitFunction(Function &F) {
 
     ParamAttr::ZExt | ParamAttr::SExt,
 
-    ParamAttr::Pure | ParamAttr::Const
+    ParamAttr::ReadNone | ParamAttr::ReadOnly
   };
 
   const uint16_t IntegerTypeOnly =