From 2c45228651bc3bfbec214343f6896841c3cb1d04 Mon Sep 17 00:00:00 2001
From: Reid Spencer
Date: Tue, 7 Aug 2007 14:34:28 +0000
Subject: [PATCH] Describe the global/local naming convention.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40890 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/LangRef.html | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/docs/LangRef.html b/docs/LangRef.html
index 35990bdcdd9..bf9464bc7db 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -296,25 +296,27 @@ the parser.
-
LLVM uses three different forms of identifiers, for different
-purposes:
+
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:
- - 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 '%[a-zA-Z$._][a-zA-Z$._0-9]*'.
+
- 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 '[%@][a-zA-Z$._][a-zA-Z$._0-9]*'.
Identifiers which require other characters in their names can be surrounded
- with quotes. In this way, anything except a " character can be used
- in a name.
+ with quotes. In this way, anything except a " character can
+ be used in a named value.
- - Unnamed values are represented as an unsigned numeric value with a '%'
- prefix. For example, %12, %2, %44.
+ - Unnamed values are represented as an unsigned numeric value with their
+ prefix. For example, %12, @2, %44.
- Constants, which are described in a section about
constants, below.
-
LLVM requires that values start with a '%' sign for two reasons: Compilers
+
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
'ret', etc...), for primitive type names ('void', 'i32', etc...),
and others. These reserved words cannot conflict with variable names, because
-none of them start with a '%' character.
+none of them start with a prefix character ('%' or '@').
Here is an example of LLVM code to multiply the integer variable
'%X' by 8:
--
2.34.1