diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2013-11-17 16:14:46 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@gcc.gnu.org> | 2013-11-17 16:14:46 +0000 |
commit | 1fe37220afe33a180e8fcfaae485fe878a62938e (patch) | |
tree | 86e0ab203b8850bdf532fcbf7bc776dcbb9acde7 /gcc/tree.c | |
parent | fd4da58cd8bee25149f50a249073b20487b5bb41 (diff) | |
download | gcc-1fe37220afe33a180e8fcfaae485fe878a62938e.zip gcc-1fe37220afe33a180e8fcfaae485fe878a62938e.tar.gz gcc-1fe37220afe33a180e8fcfaae485fe878a62938e.tar.bz2 |
gimple.h: Reorder prototypes to match .c declaration order...
* gimple.h: Reorder prototypes to match .c declaration order, and remove
protyotypes for functions not in gimple.c.
(LABEL): Move to tree-into-ssa.c.
* gimple.c: Remove unused prototypes.
(get_base_address): Move to tree.c.
* tree.c (get_base_address): Relocate from gimple.c.
* builtins.h (validate_gimple_arglist): Add prototype.
* trans-mem.h (compute_transaction_bits, is_tm_ending): Add prototype.
* cfgexpand.h: New File.
(gimple_assign_rhs_to_tree, estimated_stack_frame_size): Add protoype.
* tree.h (build_addr): Move to tree-nested.h.
* tree-nested.h: New File.
(build_addr, lower_nested_functions, insert_field_into_struct): Add
prototypes.
* tree-inline.h (estimated_stack_frame_size): Remove prototype.
* ipa-inline-analysis.c: Include cfgexpand.h.
* cgraphunit.c: Include tree-nested.h.
* omp-low.c: Likewise.
* tree-parloops.c: Likewise.
* gimple-low.h: Likewise.
* tree-profile.h: Likewise.
* expr.c: Include cfgexpand.h.
* tree-affine.c: Likewise.
* tree-ssa.c: Likewise.
* tree-ssa-loop-im.c: Include trans-mem.h.
* tree-ssa-tail-merge.c: Likewise.
* value-prof.c: Include builtins.h and tree-nested.h.
* tree-into-ssa.c (LABEL): Define here.
* fortran/trans-intrinsic.c: Include tree-nested.h.
From-SVN: r204919
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -12267,4 +12267,32 @@ drop_tree_overflow (tree t) return t; } +/* Given a memory reference expression T, return its base address. + The base address of a memory reference expression is the main + object being referenced. For instance, the base address for + 'array[i].fld[j]' is 'array'. You can think of this as stripping + away the offset part from a memory address. + + This function calls handled_component_p to strip away all the inner + parts of the memory reference until it reaches the base object. */ + +tree +get_base_address (tree t) +{ + while (handled_component_p (t)) + t = TREE_OPERAND (t, 0); + + if ((TREE_CODE (t) == MEM_REF + || TREE_CODE (t) == TARGET_MEM_REF) + && TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR) + t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); + + /* ??? Either the alias oracle or all callers need to properly deal + with WITH_SIZE_EXPRs before we can look through those. */ + if (TREE_CODE (t) == WITH_SIZE_EXPR) + return NULL_TREE; + + return t; +} + #include "gt-tree.h" |