[llvm-commits] CVS: llvm-gcc/gcc/varasm.c
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 14 13:23:13 PST 2005
Changes in directory llvm-gcc/gcc:
varasm.c updated: 1.5 -> 1.6
---
Log message:
Be more generous with what we consider to be a constant.
---
Diffs of the changes: (+14 -1)
varasm.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletion(-)
Index: llvm-gcc/gcc/varasm.c
diff -u llvm-gcc/gcc/varasm.c:1.5 llvm-gcc/gcc/varasm.c:1.6
--- llvm-gcc/gcc/varasm.c:1.5 Mon Aug 9 14:38:40 2004
+++ llvm-gcc/gcc/varasm.c Mon Feb 14 15:22:56 2005
@@ -3523,7 +3523,20 @@
case ADDR_EXPR:
case FDESC_EXPR:
- return staticp (TREE_OPERAND (value, 0)) ? TREE_OPERAND (value, 0) : 0;
+ value = staticp (TREE_OPERAND (value, 0));
+ /* "&(*a).f" is like unto pointer arithmetic. If "a" turns out to
+ be a constant, this is old-skool offsetof-like nonsense. */
+ if (value
+ && TREE_CODE (value) == INDIRECT_REF
+ && TREE_CONSTANT (TREE_OPERAND (value, 0)))
+ return null_pointer_node;
+ /* Taking the address of a nested function involves a trampoline. */
+ if (value
+ && TREE_CODE (value) == FUNCTION_DECL
+ && ((decl_function_context (value) && !DECL_NO_STATIC_CHAIN (value))
+ || DECL_NON_ADDR_CONST_P (value)))
+ return NULL_TREE;
+ return value;
case VIEW_CONVERT_EXPR:
case NON_LVALUE_EXPR:
More information about the llvm-commits
mailing list