[llvm-commits] [dragonegg] r95875 - /dragonegg/trunk/llvm-backend.cpp

Duncan Sands baldrick at free.fr
Thu Feb 11 09:32:25 PST 2010


Author: baldrick
Date: Thu Feb 11 11:32:25 2010
New Revision: 95875

URL: http://llvm.org/viewvc/llvm-project?rev=95875&view=rev
Log:
Output static globals marked with the 'used' attribute.  With this change dragonegg
can successfully do a debug build of LLVM, and all "make check" tests pass except for
MultiplePluginPriorities.td, which involves raising and catching an exception (I didn't
add support for exception handling yet).

Modified:
    dragonegg/trunk/llvm-backend.cpp

Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95875&r1=95874&r2=95875&view=diff

==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Thu Feb 11 11:32:25 2010
@@ -1873,12 +1873,14 @@
   LazilyInitializeModule();
 
   // Output all externally visible global variables, whether they are used in
-  // this compilation unit or not.  Global variables that are not externally
-  // visible are output when their user is, or discarded if unused.
+  // this compilation unit or not, as well as any internal variables explicitly
+  // marked with the 'used' attribute.  All other internal variables are output
+  // when their user is, or discarded if unused.
   struct varpool_node *vnode;
   FOR_EACH_STATIC_VARIABLE (vnode) {
     tree var = vnode->decl;
-    if (TREE_CODE(var) == VAR_DECL && TREE_PUBLIC(var))
+    if (TREE_CODE(var) == VAR_DECL &&
+        (TREE_PUBLIC(var) || DECL_PRESERVE_P(var)))
       emit_global(var);
   }
 





More information about the llvm-commits mailing list