summaryrefslogtreecommitdiffstats
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-15 10:41:13 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-15 10:41:13 +0000
commitffda9ae34e3c95a9dd401728ccacfffa513d089b (patch)
tree148a3d7dce2cb42680ee7534e42f3dec39e30ca7 /gcc/ada/gcc-interface
parentbc0dfc8d56508f3390307d85291503b954f2a17f (diff)
downloadppe42-gcc-ffda9ae34e3c95a9dd401728ccacfffa513d089b.tar.gz
ppe42-gcc-ffda9ae34e3c95a9dd401728ccacfffa513d089b.zip
PR ada/53592
* gcc-interface/gigi.h (maybe_vector_array): Make static inline. * gcc-interface/utils.c (maybe_vector_array): Delete. * gcc-interface/trans.c (gnat_to_gnu) <N_Indexed_Component>: Mark the array object as addressable if it has vector type and is on the LHS. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188653 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/gigi.h18
-rw-r--r--gcc/ada/gcc-interface/trans.c7
-rw-r--r--gcc/ada/gcc-interface/utils.c14
3 files changed, 20 insertions, 19 deletions
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index e2aac80b665..cfa52b069db 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -783,10 +783,6 @@ extern tree remove_conversions (tree exp, bool true_address);
likewise return an expression pointing to the underlying array. */
extern tree maybe_unconstrained_array (tree exp);
-/* If EXP's type is a VECTOR_TYPE, return EXP converted to the associated
- TYPE_REPRESENTATIVE_ARRAY. */
-extern tree maybe_vector_array (tree exp);
-
/* Return an expression that does an unchecked conversion of EXPR to TYPE.
If NOTRUNC_P is true, truncation operations should be suppressed. */
extern tree unchecked_convert (tree type, tree expr, bool notrunc_p);
@@ -1033,6 +1029,20 @@ extern void enumerate_modes (void (*f) (const char *, int, int, int, int, int,
/* Convenient shortcuts. */
#define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE)
+/* If EXP's type is a VECTOR_TYPE, return EXP converted to the associated
+ TYPE_REPRESENTATIVE_ARRAY. */
+
+static inline tree
+maybe_vector_array (tree exp)
+{
+ tree etype = TREE_TYPE (exp);
+
+ if (VECTOR_TYPE_P (etype))
+ exp = convert (TYPE_REPRESENTATIVE_ARRAY (etype), exp);
+
+ return exp;
+}
+
static inline unsigned HOST_WIDE_INT
ceil_pow2 (unsigned HOST_WIDE_INT x)
{
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 6e651f43123..65231bde848 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -5372,7 +5372,12 @@ gnat_to_gnu (Node_Id gnat_node)
/* Convert vector inputs to their representative array type, to fit
what the code below expects. */
- gnu_array_object = maybe_vector_array (gnu_array_object);
+ if (VECTOR_TYPE_P (TREE_TYPE (gnu_array_object)))
+ {
+ if (present_in_lhs_or_actual_p (gnat_node))
+ gnat_mark_addressable (gnu_array_object);
+ gnu_array_object = maybe_vector_array (gnu_array_object);
+ }
gnu_array_object = maybe_unconstrained_array (gnu_array_object);
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 62a4b319dfb..d2183bbe160 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -5149,20 +5149,6 @@ maybe_unconstrained_array (tree exp)
return exp;
}
-
-/* If EXP's type is a VECTOR_TYPE, return EXP converted to the associated
- TYPE_REPRESENTATIVE_ARRAY. */
-
-tree
-maybe_vector_array (tree exp)
-{
- tree etype = TREE_TYPE (exp);
-
- if (VECTOR_TYPE_P (etype))
- exp = convert (TYPE_REPRESENTATIVE_ARRAY (etype), exp);
-
- return exp;
-}
/* Return true if EXPR is an expression that can be folded as an operand
of a VIEW_CONVERT_EXPR. See ada-tree.h for a complete rationale. */
OpenPOWER on IntegriCloud