1 /* Convert language-specific tree expression to rtl instructions,
3 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
4 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
26 #include "coretypes.h"
37 /* Hook used by output_constant to expand language-specific
41 cplus_expand_constant (tree cst)
43 switch (TREE_CODE (cst))
47 tree type = TREE_TYPE (cst);
50 /* Find the member. */
51 member = PTRMEM_CST_MEMBER (cst);
53 if (TREE_CODE (member) == FIELD_DECL)
54 /* Find the offset for the field. */
55 cst = fold (build_nop (type, byte_position (member)));
61 expand_ptrmemfunc_cst (cst, &delta, &pfn);
62 cst = build_ptrmemfunc1 (type, delta, pfn);
68 /* There's nothing to do. */
75 /* Hook used by expand_expr to expand language-specific tree codes. */
78 cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier,
81 tree type = TREE_TYPE (exp);
82 enum machine_mode mode = TYPE_MODE (type);
83 enum tree_code code = TREE_CODE (exp);
86 /* No sense saving up arithmetic to be done
87 if it's all in the wrong mode to form part of an address.
88 And force_operand won't know whether to sign-extend or zero-extend. */
90 if (mode != Pmode && modifier == EXPAND_SUM)
91 modifier = EXPAND_NORMAL;
96 return expand_expr (cplus_expand_constant (exp),
97 target, tmode, modifier);
100 /* Offset refs should not make it through to here. */
105 expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
108 case MUST_NOT_THROW_EXPR:
109 expand_eh_region_start ();
110 ret = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
111 expand_eh_region_end_must_not_throw (build_call (terminate_node, 0));
114 case EMPTY_CLASS_EXPR:
115 /* We don't need to generate any code for an empty class. */
119 return expand_expr (BASELINK_FUNCTIONS (exp), target, tmode,
123 return c_expand_expr (exp, target, tmode, modifier, alt_rtl);