This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Is there a GIMPLE equivalent of UNSPEC?
- From: "Unruh, Erwin" <Erwin dot Unruh at fujitsu-siemens dot com>
- To: "Steven Bosscher" <stevenb at suse dot de>
- Cc: "GCC mailing list" <gcc at gcc dot gnu dot org>
- Date: Thu, 17 Nov 2005 14:18:32 +0100
- Subject: RE: Is there a GIMPLE equivalent of UNSPEC?
OK, here are the details:
first, I have a PDImode pointer and do not want to have general arithmetic on that. So I invented a special RTL instruction to align a pointer. Within the va_arg sometimes I need to align the pointer. In 3.3.2 the code snippet in EXPAND_BUILTIN_VA_ARG looked like
tree t = ... // address of next parameter
/* If the value is more aligned than a word, align the pointer. */
if (align > PARM_BOUNDARY)
{
rtx r;
r = expand_expr (t, addr_rtx, Pmode, EXPAND_NORMAL);
r = private_align_pmode (r, align / BITS_PER_UNIT);
t = make_tree (TREE_TYPE (ovf), r);
t = build (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
t = save_expr (ovf);
}
Second, when passing a pointer (Pmode) via va_arg, I need a special instruction to retrieve its value. In 3.3.2 I used
rtx addr_rtx = ... // address of parameter
rtx value_rtx = gen_reg_rtx (Pmode);
rtx r = gen_rtx_MEM (Pmode, addr_rtx);
set_mem_alias_set (r, get_varargs_alias_set ());
emit_insn (gen_private_va_arg_pdi (value_rtx, r));
addr_rtx = gen_reg_rtx (Pmode);
r = gen_rtx_ADDRESSOF (Pmode, value_rtx, REGNO (value_rtx), 0);
emit_move_insn (addr_rtx, r);
// addr_rtx can now be used as a normal pointer to a Pmode entity
In both cases using an RTL unspec was a convenient way to go. All optimizing phases knew how to handle that.
If I do not find a simple way to represent those constructs in GIMPLE, I have to think about other ways to handle the underlying problem.
Erwin
Erwin Unruh, Fujitsu Siemens Computers, C/C++ compiler group
-----Original Message-----
From: Steven Bosscher [mailto:stevenb@suse.de]
Sent: Thursday, November 17, 2005 1:22 PM
To: Unruh, Erwin
Cc: GCC mailing list
Subject: Re: Is there a GIMPLE equivalent of UNSPEC?
On Nov 17, 2005 01:11 PM, "Unruh, Erwin"
<Erwin.Unruh@fujitsu-siemens.com> wrote:
> is there some
> equivalent.
No, there isn't.? You are not being very specific about the problem you are trying to solve.? You'll have to tell more before anyone can give you a more helpful answer.
?
Gr.
Steven
?
?