aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-10-21 07:10:36 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-10-21 07:10:36 +0000
commit699ed0ce1fc3e4a843fc18769af68b1340d23df1 (patch)
tree80fdf4e389ef86cb22b9b7328436d61ac9cbbb87
parente54635a2f345d548f9c488b41e296708f1b76068 (diff)
downloadgcc-699ed0ce1fc3e4a843fc18769af68b1340d23df1.zip
gcc-699ed0ce1fc3e4a843fc18769af68b1340d23df1.tar.gz
gcc-699ed0ce1fc3e4a843fc18769af68b1340d23df1.tar.bz2
cp-tree.def (EMPTY_CLASS_EXPR): New tree node.
* 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. From-SVN: r30116
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/call.c5
-rw-r--r--gcc/cp/cp-tree.def4
-rw-r--r--gcc/cp/ir.texi14
4 files changed, 23 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2a9e50f..2c146e3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index dd4e442..b83efd5 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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);
}
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index 372ad77..d8eb62f 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -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.
diff --git a/gcc/cp/ir.texi b/gcc/cp/ir.texi
index df9c5db..2298413 100644
--- a/gcc/cp/ir.texi
+++ b/gcc/cp/ir.texi
@@ -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