aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-12 19:30:21 +0000
committerChris Lattner <sabre@nondot.org>2005-02-12 19:30:21 +0000
commit3689a34489224a71c6306f55ce0718014c3b01cf (patch)
tree07b066633686f44dc9b53a2d9eae78b8b0cfa458
parente6f8c5a71682ffcc33d3c83a40821ded8f2c8033 (diff)
downloadexternal_llvm-3689a34489224a71c6306f55ce0718014c3b01cf.zip
external_llvm-3689a34489224a71c6306f55ce0718014c3b01cf.tar.gz
external_llvm-3689a34489224a71c6306f55ce0718014c3b01cf.tar.bz2
Document the newly generalized model for constant globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20136 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/LangRef.html22
1 files changed, 16 insertions, 6 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html
index e4e2d44..2ad6828 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -423,12 +423,22 @@ to have any linkage type other than "externally visible".</a></p>
<div class="doc_text">
-<p>Global variables define regions of memory allocated at compilation
-time instead of run-time. Global variables may optionally be
-initialized. A variable may be defined as a global "constant", which
-indicates that the contents of the variable will never be modified
-(enabling better optimization, allowing the global data to be placed in the
-read-only section of an executable, etc).</p>
+<p>Global variables define regions of memory allocated at compilation time
+instead of run-time. Global variables may optionally be initialized. A
+variable may be defined as a global "constant", which indicates that the
+contents of the variable will <b>never</b> be modified (enabling better
+optimization, allowing the global data to be placed in the read-only section of
+an executable, etc). Note that variables that need runtime initialization
+cannot be marked "constant", as there is a store to the variable.</p>
+
+<p>
+LLVM explicitly allows <em>declarations</em> of global variables to be marked
+constant, even if the final definition of the global is not. This capability
+can be used to enable slightly better optimization of the program, but requires
+the language definition to guarantee that optimizations based on the
+'constantness' are valid for the translation units that do not include the
+definition.
+</p>
<p>As SSA values, global variables define pointer values that are in
scope (i.e. they dominate) all basic blocks in the program. Global