public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Rename ADDR_EXPR to NONCAP_ADDR_EXPR
@ 2022-05-05 12:08 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-05 12:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:dd6403aea0ea9267cb71de88ff50a3c98e674ed3

commit dd6403aea0ea9267cb71de88ff50a3c98e674ed3
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Apr 12 07:58:55 2022 +0100

    Rename ADDR_EXPR to NONCAP_ADDR_EXPR
    
    After previous patches to replace most direct uses of
    ADDR_EXPR, this patch renames all remaining direct references
    to NONCAP_ADDR_EXPR.  That's initially a misnomer for purecap,
    since we already use the code to get capability addresses,
    but a follow-up patch makes things consistent again.

Diff:
---
 gcc/ada/gcc-interface/ada-tree.def |  6 +++---
 gcc/cp/cp-tree.h                   |  3 ++-
 gcc/cp/lex.c                       |  6 ++++++
 gcc/doc/generic.texi               |  6 +++---
 gcc/doc/gimple.texi                |  2 +-
 gcc/genmatch.c                     |  2 +-
 gcc/match.pd                       |  2 +-
 gcc/range-op.cc                    |  4 ++--
 gcc/tree-core.h                    |  4 ++--
 gcc/tree.c                         |  4 ++--
 gcc/tree.def                       |  7 ++++---
 gcc/tree.h                         | 13 +++++++------
 12 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/gcc/ada/gcc-interface/ada-tree.def b/gcc/ada/gcc-interface/ada-tree.def
index 8eb4688e749..818b7d48cf2 100644
--- a/gcc/ada/gcc-interface/ada-tree.def
+++ b/gcc/ada/gcc-interface/ada-tree.def
@@ -52,9 +52,9 @@ DEFTREECODE (MINUS_NOMOD_EXPR, "minus_nomod_expr", tcc_binary, 2)
    used internally to describe fixed point types scale factors.  */
 DEFTREECODE (POWER_EXPR, "power_expr", tcc_binary, 2)
 
-/* Same as ADDR_EXPR, except that if the operand represents a bit field,
-   return the address of the byte containing the bit.  This is used
-   for the Address attribute and never shows up in the tree.  */
+/* Same as NONCAP_ADDR_EXPR, except that if the operand represents
+   a bit field, return the address of the byte containing the bit.
+   This is used for the Address attribute and never shows up in the tree.  */
 DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1)
 
 /* Here are the tree codes for the statement types known to Ada.  These
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index f175587857f..cf8cb8490fd 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4498,7 +4498,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 /* Indicates when overload resolution may resolve to a pointer to
    member function. [expr.unary.op]/3 */
 #define PTRMEM_OK_P(NODE) \
-  TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), ADDR_EXPR, OFFSET_REF, SCOPE_REF))
+  TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), NONCAP_ADDR_EXPR, OFFSET_REF, \
+				 SCOPE_REF))
 
 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
    pointer to member function.  TYPE_PTRMEMFUNC_P _must_ be true,
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 8a69bc4f170..ddf9659c249 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -90,7 +90,9 @@ ovl_op_info_t ovl_op_info[2][OVL_OP_MAX] =
       {NULL_TREE, NAME, MANGLING, CODE, OVL_OP_##CODE, FLAGS},
 #define OPERATOR_TRANSITION }, {			\
       {NULL_TREE, NULL, NULL, ERROR_MARK, OVL_OP_ERROR_MARK, 0},
+#define ADDR_EXPR NONCAP_ADDR_EXPR
 #include "operators.def"
+#undef ADDR_EXPR
     }
   };
 unsigned char ovl_op_mapping[MAX_TREE_CODES];
@@ -162,6 +164,8 @@ init_operators (void)
   for (unsigned ix = OVL_OP_MAX; --ix;)
     {
       ovl_op_info_t *op_ptr = &ovl_op_info[false][ix];
+      if (ADDR_EXPR_CODE_P (op_ptr->tree_code))
+	op_ptr->tree_code = unqualified_addr_expr ();
 
       if (op_ptr->name)
 	{
@@ -192,6 +196,8 @@ init_operators (void)
 	}
 
       ovl_op_info_t *as_ptr = &ovl_op_info[true][ix];
+      if (ADDR_EXPR_CODE_P (as_ptr->tree_code))
+	as_ptr->tree_code = unqualified_addr_expr ();
       if (as_ptr->name)
 	{
 	  /* These will be placed at the start of the array, move to
diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi
index fb98727928a..ec200dfabc9 100644
--- a/gcc/doc/generic.texi
+++ b/gcc/doc/generic.texi
@@ -1189,7 +1189,7 @@ the others being multipliers that are applied to the runtime parameters.
 
 @node Storage References
 @subsection References to storage
-@tindex ADDR_EXPR
+@tindex NONCAP_ADDR_EXPR
 @tindex INDIRECT_REF
 @tindex MEM_REF
 @tindex ARRAY_REF
@@ -1235,13 +1235,13 @@ The sixth argument is the reference to the original memory access, which
 is preserved for the purposes of the RTL alias analysis.  The seventh
 argument is a tag representing the results of tree level alias analysis.
 
-@item ADDR_EXPR
+@item NONCAP_ADDR_EXPR
 These nodes are used to represent the address of an object.  (These
 expressions will always have pointer or reference type.)  The operand may
 be another expression, or it may be a declaration.
 
 As an extension, GCC allows users to take the address of a label.  In
-this case, the operand of the @code{ADDR_EXPR} will be a
+this case, the operand of the @code{NONCAP_ADDR_EXPR} will be a
 @code{LABEL_DECL}.  The type of such an expression is @code{void*}.
 
 If the object addressed is not an lvalue, a temporary is created, and
diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index f01c3083835..4aa9e60e9ba 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -798,7 +798,7 @@ global variable but not of a local one).
 @end deftypefn
 
 @deftypefn {GIMPLE function} bool is_gimple_ip_invariant_address (tree t)
-Return true if t is an @code{ADDR_EXPR} that does not change once the
+Return true if t is a @code{NONCAP_ADDR_EXPR} that does not change once the
 program is running (and which is valid in all functions).
 @end deftypefn
 
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 11a89c5e70a..3ffdcf1e502 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -257,7 +257,7 @@ enum combined_fn {
 static inline bool
 ADDR_EXPR_CODE_P (tree_code code)
 {
-  return code == ADDR_EXPR;
+  return code == NONCAP_ADDR_EXPR;
 }
 
 /* Return true if CODE represents a commutative tree code.  Otherwise
diff --git a/gcc/match.pd b/gcc/match.pd
index 8ea22628a86..fb13535c8e8 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -110,7 +110,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 		   TYPE_VECTOR_SUBPARTS (TREE_TYPE (@0)))
       && tree_nop_conversion_p (TREE_TYPE (type), TREE_TYPE (TREE_TYPE (@0))))))
 
-(match (any_addr) (ADDR_EXPR))
+(match (any_addr) (NONCAP_ADDR_EXPR))
 
 /* Transform likes of (char) ABS_EXPR <(int) x> into (char) ABSU_EXPR <x>
    ABSU_EXPR returns unsigned absolute value of the operand and the operand
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 125ef0e2c6a..3510fc2c335 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -3234,7 +3234,7 @@ integral_table::integral_table ()
   set (ABS_EXPR, op_abs);
   set (ABSU_EXPR, op_absu);
   set (NEGATE_EXPR, op_negate);
-  set (ADDR_EXPR, op_addr);
+  set (NONCAP_ADDR_EXPR, op_addr);
 }
 
 // Instantiate a range op table for pointer operations.
@@ -3260,7 +3260,7 @@ pointer_table::pointer_table ()
   set (GT_EXPR, op_gt);
   set (GE_EXPR, op_ge);
   set (SSA_NAME, op_identity);
-  set (ADDR_EXPR, op_addr);
+  set (NONCAP_ADDR_EXPR, op_addr);
   set (NOP_EXPR, op_convert);
   set (CONVERT_EXPR, op_convert);
 
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 7f90eec095c..5947fcb33fd 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1106,7 +1106,7 @@ struct GTY(()) tree_base {
            CONSTRUCTOR
 
        TREE_NO_TRAMPOLINE in
-           ADDR_EXPR
+           NONCAP_ADDR_EXPR
 
        BINFO_VIRTUAL_P in
            TREE_BINFO
@@ -1370,7 +1370,7 @@ struct GTY(()) tree_base {
            BIT_FIELD_REF, MEM_REF
 
        FUNC_ADDR_BY_DESCRIPTOR in
-           ADDR_EXPR
+           NONCAP_ADDR_EXPR
 
        CALL_EXPR_BY_DESCRIPTOR in
            CALL_EXPR
diff --git a/gcc/tree.c b/gcc/tree.c
index 3488d8ec229..d95291292f6 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -14192,7 +14192,7 @@ addr_expr_code (const_tree res_type)
     res_type = ptr_type_node;
   (void) res_type;
 #endif
-  return ADDR_EXPR;
+  return NONCAP_ADDR_EXPR;
 }
 
 /* Return the *ADDR_EXPR code that should be used if the type of the
@@ -16321,7 +16321,7 @@ test_fold_drop_capability (void)
 	- INIT_EXPR
 	- TARGET_EXPR
 	- COND_EXPR
-	- ADDR_EXPR
+	- NONCAP_ADDR_EXPR
 	- PREDECREMENT_EXPR
 	- PREINCREMENT_EXPR
 	- POSTDECREMENT_EXPR
diff --git a/gcc/tree.def b/gcc/tree.def
index 6b96a9f66ad..6e8bc255910 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -868,9 +868,10 @@ DEFTREECODE (COMPOUND_LITERAL_EXPR, "compound_literal_expr", tcc_expression, 1)
    will be replaced by the temporary variable that holds the value.  */
 DEFTREECODE (SAVE_EXPR, "save_expr", tcc_expression, 1)
 
-/* & in C.  Value is the address at which the operand's value resides.
-   Operand may have any mode.  Result mode is Pmode.  */
-DEFTREECODE (ADDR_EXPR, "addr_expr", tcc_expression, 1)
+/* & in C, returning a non-capability type.  Value is the address at
+   which the operand's value resides.  Operand may have any mode.
+   Result mode is a valid non-capability pointer mode.  */
+DEFTREECODE (NONCAP_ADDR_EXPR, "noncap_addr_expr", tcc_expression, 1)
 
 /* Operand0 is a function constant; result is part N of a function
    descriptor of type ptr_mode.  */
diff --git a/gcc/tree.h b/gcc/tree.h
index 477e68e488a..0e498f24a68 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -474,7 +474,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
 static inline bool
 ADDR_EXPR_CODE_P (tree_code code)
 {
-  return code == ADDR_EXPR;
+  return code == NONCAP_ADDR_EXPR;
 }
 
 /* Test if EXP takes the address of an object.  If so, the object
@@ -483,7 +483,7 @@ ADDR_EXPR_CODE_P (tree_code code)
 
 /* Case statements for codes that satisfy ADDR_EXPR_CODE_P.  */
 #define CASE_ADDR_EXPR \
-  case ADDR_EXPR
+  case NONCAP_ADDR_EXPR
 
 /* Tests if CODE is a conversion expr (NOP_EXPR or CONVERT_EXPR).  */
 #define CONVERT_EXPR_CODE_P(CODE)				\
@@ -702,8 +702,9 @@ ADDR_EXPR_CODE_P (tree_code code)
    In a CONSTRUCTOR, nonzero means allocate static storage.  */
 #define TREE_STATIC(NODE) ((NODE)->base.static_flag)
 
-/* In an ADDR_EXPR, nonzero means do not use a trampoline.  */
-#define TREE_NO_TRAMPOLINE(NODE) (ADDR_EXPR_CHECK (NODE)->base.static_flag)
+/* In an *ADDR_EXPR, nonzero means do not use a trampoline.  */
+#define TREE_NO_TRAMPOLINE(NODE) \
+  (NONCAP_ADDR_EXPR_CHECK (NODE)->base.static_flag)
 
 /* In a TARGET_EXPR or WITH_CLEANUP_EXPR, means that the pertinent cleanup
    should only be executed if an exception is thrown, not on normal exit
@@ -1009,10 +1010,10 @@ ADDR_EXPR_CODE_P (tree_code code)
 #define REF_REVERSE_STORAGE_ORDER(NODE) \
   (TREE_CHECK2 (NODE, BIT_FIELD_REF, MEM_REF)->base.default_def_flag)
 
-  /* In an ADDR_EXPR, indicates that this is a pointer to nested function
+/* In an *ADDR_EXPR, indicates that this is a pointer to nested function
    represented by a descriptor instead of a trampoline.  */
 #define FUNC_ADDR_BY_DESCRIPTOR(NODE) \
-  (TREE_CHECK (NODE, ADDR_EXPR)->base.default_def_flag)
+  (TREE_CHECK (NODE, NONCAP_ADDR_EXPR)->base.default_def_flag)
 
 /* In a CALL_EXPR, indicates that this is an indirect call for which
    pointers to nested function are descriptors instead of trampolines.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-05 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 12:08 [gcc(refs/vendors/ARM/heads/morello)] Rename ADDR_EXPR to NONCAP_ADDR_EXPR Matthew Malcomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).