[llvm-commits] CVS: llvm-gcc/gcc/c-typeck.c

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 13 19:22:09 PST 2005



Changes in directory llvm-gcc/gcc:

c-typeck.c updated: 1.5 -> 1.6
---
Log message:

Now that GCC can properly realize new things are constants (e.g. &Global[10]),
we can get rid of the gross hackery we have added in the past to handle
global initializers.



---
Diffs of the changes:  (+3 -10)

 c-typeck.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)


Index: llvm-gcc/gcc/c-typeck.c
diff -u llvm-gcc/gcc/c-typeck.c:1.5 llvm-gcc/gcc/c-typeck.c:1.6
--- llvm-gcc/gcc/c-typeck.c:1.5	Mon Jan  3 16:13:16 2005
+++ llvm-gcc/gcc/c-typeck.c	Sun Feb 13 21:21:56 2005
@@ -46,8 +46,6 @@
 #include "target.h"
 #include "llvm-out.h"
 
-extern int parsing_initializer;
-
 /* Nonzero if we've already printed a "missing braces around initializer"
    message within this initializer.  */
 static int missing_braces_mentioned;
@@ -2417,7 +2415,7 @@
           /* DON'T fold this, unless its a constant expression which might 
            * initialize a global.
            */
-          if (!EMIT_LLVM || parsing_initializer)
+          if (!EMIT_LLVM)
 	  return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
 				  TREE_OPERAND (arg, 1), 1);
 	}
@@ -2468,10 +2466,8 @@
 		return error_mark_node;
 	      }
 
-	    if (EMIT_LLVM && !parsing_initializer) {
-              /* For LLVM, don't fold pointer arithmetic unless doing so
-               * produces a constant!
-               */
+	    if (EMIT_LLVM) {
+              /* For LLVM, don't fold pointer arithmetic! */
               addr = build1 (code, argtype, arg);
             }
             else
@@ -4347,8 +4343,6 @@
   if (asmspec_tree)
     asmspec = TREE_STRING_POINTER (asmspec_tree);
 
-  ++parsing_initializer;
-
   p->decl = constructor_decl;
   p->asmspec = constructor_asmspec;
   p->require_constant_value = require_constant_value;
@@ -4431,7 +4425,6 @@
   constructor_top_level = p->top_level;
   initializer_stack = p->next;
   free (p);
-  --parsing_initializer;
 }
 
 /* Call here when we see the initializer is surrounded by braces.






More information about the llvm-commits mailing list