diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-08-07 14:34:28 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-08-07 14:34:28 +0000 |
| commit | b23b65f1ba6eb3ee019e9c65c85e8b3e7e443ffe (patch) | |
| tree | e0857817db1a09925dcbf6dd8e9e5056d2a32d67 /llvm/docs | |
| parent | 76fb226fd4532b6cba5434b7d585fd0e12ecaa08 (diff) | |
| download | bcm5719-llvm-b23b65f1ba6eb3ee019e9c65c85e8b3e7e443ffe.tar.gz bcm5719-llvm-b23b65f1ba6eb3ee019e9c65c85e8b3e7e443ffe.zip | |
Describe the global/local naming convention.
llvm-svn: 40890
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/LangRef.html | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/docs/LangRef.html b/llvm/docs/LangRef.html index 35990bdcdd9..bf9464bc7db 100644 --- a/llvm/docs/LangRef.html +++ b/llvm/docs/LangRef.html @@ -296,25 +296,27 @@ the parser.</p> <div class="doc_text"> -<p>LLVM uses three different forms of identifiers, for different -purposes:</p> + <p>LLVM identifiers come in two basic types: global and local. Global + identifiers (functions, global variables) begin with the @ character. Local + identifiers (register names, types) begin with the % character. Additionally, + there are three different formats for identifiers, for different purposes: <ol> - <li>Named values are represented as a string of characters with a '%' prefix. - For example, %foo, %DivisionByZero, %a.really.long.identifier. The actual - regular expression used is '<tt>%[a-zA-Z$._][a-zA-Z$._0-9]*</tt>'. + <li>Named values are represented as a string of characters with their prefix. + For example, %foo, @DivisionByZero, %a.really.long.identifier. The actual + regular expression used is '<tt>[%@][a-zA-Z$._][a-zA-Z$._0-9]*</tt>'. Identifiers which require other characters in their names can be surrounded - with quotes. In this way, anything except a <tt>"</tt> character can be used - in a name.</li> + with quotes. In this way, anything except a <tt>"</tt> character can + be used in a named value.</li> - <li>Unnamed values are represented as an unsigned numeric value with a '%' - prefix. For example, %12, %2, %44.</li> + <li>Unnamed values are represented as an unsigned numeric value with their + prefix. For example, %12, @2, %44.</li> <li>Constants, which are described in a <a href="#constants">section about constants</a>, below.</li> </ol> -<p>LLVM requires that values start with a '%' sign for two reasons: Compilers +<p>LLVM requires that values start with a prefix for two reasons: Compilers don't need to worry about name clashes with reserved words, and the set of reserved words may be expanded in the future without penalty. Additionally, unnamed identifiers allow a compiler to quickly come up with a temporary @@ -327,7 +329,7 @@ languages. There are keywords for different opcodes '<tt><a href="#i_ret">ret</a></tt>', etc...), for primitive type names ('<tt><a href="#t_void">void</a></tt>', '<tt><a href="#t_primitive">i32</a></tt>', etc...), and others. These reserved words cannot conflict with variable names, because -none of them start with a '%' character.</p> +none of them start with a prefix character ('%' or '@').</p> <p>Here is an example of LLVM code to multiply the integer variable '<tt>%X</tt>' by 8:</p> |

