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

Duncan Sands baldrick at free.fr
Mon Jun 7 08:59:37 PDT 2010


Author: baldrick
Date: Mon Jun  7 10:59:37 2010
New Revision: 105530

URL: http://llvm.org/viewvc/llvm-project?rev=105530&view=rev
Log:
There is no need to defer output of globals: at the point we see them, the front-end will
never change them.  Also, do not rely on the LTO infrastructure passing us all static global
variables.  It doesn't do so for globals with defer-output set.  Instead just output such when
used.  This fixes Fortran common variables, for which only the declaration was being output
before.  It also takes care of exception handling type infos when -fno-rtti is used, so remove
the previous fix for that, namely the call to mark_decl_referenced.

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=105530&r1=105529&r2=105530&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Mon Jun  7 10:59:37 2010
@@ -987,11 +987,6 @@
   if (TREE_CODE(decl) == VAR_DECL && DECL_REGISTER(decl))
     return;
 
-  // If tree nodes says defer output then do not emit global yet.
-  if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)
-      && (DECL_DEFER_OUTPUT(decl)))
-      return;
-
   // If we encounter a forward declaration then do not emit the global yet.
   if (!TYPE_SIZE(TREE_TYPE(decl)))
     return;
@@ -1426,11 +1421,6 @@
 /// make_definition_llvm - Ensures that the body or initial value of the given
 /// GCC global will be output, and returns a declaration for it.
 Value *make_definition_llvm(tree decl) {
-  // Inform cgraph that we used the global.  Usually it knows this already, but
-  // in some cases, for example if decl is an exception handling typeinfo, it
-  // expects to be told explicitly.
-  mark_decl_referenced(decl);
-
   // Only need to do something special for global variables.
   if (TREE_CODE(decl) != CONST_DECL && TREE_CODE(decl) != VAR_DECL)
     return DECL_LLVM(decl);
@@ -1442,10 +1432,6 @@
     assert(!DECL_INITIAL(decl) && "Non-static global has initial value!");
     return DECL_LLVM(decl);
   }
-  // Public static variables will be output later anyway, so there is no point
-  // in outputting them here.
-  if (TREE_CODE(decl) == VAR_DECL && TREE_PUBLIC(decl))
-    return DECL_LLVM(decl);
   GlobalValue *GV = cast<GlobalValue>(DECL_LLVM(decl));
   // If we already output a definition for this declaration, then reuse it.
   if (!GV->isDeclaration())





More information about the llvm-commits mailing list