OSDN Git Service

* cp-tree.def (EMPTY_CLASS_EXPR): New tree node.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Oct 1999 07:10:36 +0000 (07:10 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Oct 1999 07:10:36 +0000 (07:10 +0000)
* call.c (build_call): Use EMPTY_CLASS_EXPR instead of RTL_EXPR.
* expr.c (cplus_expand_expr): Expand it.
* ir.texi: Document EMPTY_CLASS_EXPR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30116 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.def
gcc/cp/ir.texi

index 2a9e50f..2c146e3 100644 (file)
@@ -1,3 +1,10 @@
+1999-10-21  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.def (EMPTY_CLASS_EXPR): New tree node.
+       * call.c (build_call): Use EMPTY_CLASS_EXPR instead of RTL_EXPR.
+       * expr.c (cplus_expand_expr): Expand it.
+       * ir.texi: Document EMPTY_CLASS_EXPR.
+       
 1999-10-20  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (DECL_NAMESPACE_SCOPE_P): Don't treat template
index dd4e442..b83efd5 100644 (file)
@@ -395,10 +395,7 @@ build_call (function, result_type, parms)
       if (is_empty_class (TREE_TYPE (TREE_VALUE (tmp)))
          && ! TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (tmp))))
        {
-         tree t = make_node (RTL_EXPR);
-         TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp));
-         RTL_EXPR_RTL (t) = const0_rtx;
-         RTL_EXPR_SEQUENCE (t) = NULL_RTX;
+         tree t = build (EMPTY_CLASS_EXPR, TREE_TYPE (TREE_VALUE (tmp)));
          TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t),
                                    TREE_VALUE (tmp), t);
        }
index 372ad77..d8eb62f 100644 (file)
@@ -70,6 +70,10 @@ DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3)
    else it is NULL_TREE.  */
 DEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1)
 
+/* An empty class object.  The TREE_TYPE gives the class type.  We use
+   these to avoid actually creating instances of the empty classes.  */
+DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0)
+
 /* Template definition.  The following fields have the specified uses,
    although there are other macros in cp-tree.h that should be used for
    accessing this data.
index df9c5db..2298413 100644 (file)
@@ -682,9 +682,10 @@ there is no @code{FIELD_DECL} for the ``base-class portion'' of an
 object.
 
 The @code{TYPE_VFIELD} is a compiler-generated field used to point to
-virtual function tables.  It does not appear on the @code{TYPE_FIELDS}
-list.  However, back-ends should handle the @code{TYPE_VFIELD} just like
-all the entries on the @code{TYPE_FIELDS} list.
+virtual function tables.  It may or may not appear on the
+@code{TYPE_FIELDS} list.  However, back-ends should handle the
+@code{TYPE_VFIELD} just like all the entries on the @code{TYPE_FIELDS}
+list.
 
 The function members are available on the @code{TYPE_METHODS} list.
 Again, subsequent members are found by following the @code{TREE_CHAIN}
@@ -1078,6 +1079,7 @@ the function.
 @tindex DO_STMT
 @findex DO_BODY
 @findex DO_COND
+@tindex EMPTY_CLASS_EXPR
 @tindex EXPR_STMT
 @findex EXPR_STMT_EXPR
 @tindex FOR_STMT
@@ -1286,6 +1288,12 @@ Used to represent a @code{do} loop.  The body of the loop is given by
 @code{DO_COND}.  The condition for a @code{do}-statement is always an
 expression.
 
+@item EMPTY_CLASS_EXPR
+
+Used to represent a temporary object of a class with no data whose
+address is never taken.  (All such objects are interchangeable.)  The
+@code{TREE_TYPE} represents the type of the object.
+
 @item EXPR_STMT
 
 Used to represent an expression statement.  Use @code{EXPR_STMT_EXPR} to