[llvm-commits] CVS: llvm/docs/LangRef.html

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 12 11:30:37 PST 2005



Changes in directory llvm/docs:

LangRef.html updated: 1.83 -> 1.84
---
Log message:

Document the newly generalized model for constant globals.


---
Diffs of the changes:  (+17 -7)

 LangRef.html |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.83 llvm/docs/LangRef.html:1.84
--- llvm/docs/LangRef.html:1.83	Fri Dec 10 09:51:16 2004
+++ llvm/docs/LangRef.html	Sat Feb 12 13:30:21 2005
@@ -423,12 +423,22 @@
 
 <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
@@ -2914,7 +2924,7 @@
 
   <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
   <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2004/12/10 15:51:16 $
+  Last modified: $Date: 2005/02/12 19:30:21 $
 </address>
 </body>
 </html>






More information about the llvm-commits mailing list