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

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 13 19:20:48 PST 2005



Changes in directory llvm-gcc/gcc:

tree.c updated: 1.4 -> 1.5
---
Log message:

Teach GCC that the address of a global is a constant!  This is the correct
solution to much hackery I have had to endure in the past.


---
Diffs of the changes:  (+9 -0)

 tree.c |    9 +++++++++
 1 files changed, 9 insertions(+)


Index: llvm-gcc/gcc/tree.c
diff -u llvm-gcc/gcc/tree.c:1.4 llvm-gcc/gcc/tree.c:1.5
--- llvm-gcc/gcc/tree.c:1.4	Mon Sep 27 21:30:02 2004
+++ llvm-gcc/gcc/tree.c	Sun Feb 13 21:20:33 2005
@@ -1305,6 +1305,10 @@
     case BIT_FIELD_REF:
       return 0;
 
+
+    case INDIRECT_REF:
+      return TREE_CONSTANT (TREE_OPERAND (arg, 0));
+
 #if 0
        /* This case is technically correct, but results in setting
 	  TREE_CONSTANT on ADDR_EXPRs that cannot be evaluated at
@@ -2481,6 +2485,11 @@
       TREE_READONLY (t) = 0;
       break;
 
+    case ADDR_EXPR:
+      if (node && staticp (node))
+        TREE_CONSTANT (t) = 1;
+      break;
+
     default:
       if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node))
 	TREE_CONSTANT (t) = 1;






More information about the llvm-commits mailing list