public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Expr Constructor Question Part 2
@ 2004-03-13  1:51 Weihaw Chuang
  2004-03-16  9:02 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Weihaw Chuang @ 2004-03-13  1:51 UTC (permalink / raw)
  To: gcc

Hi,
I would like to force a struct to a temporary on stack.  This is so I can 
use a special x86 opcode (bounds) that needs to access data from memory 
rather than registers.

Basically I think I want to force a constructor (struct) to reside in 
memory, in a temporary.  Is there some analog that already exists to do 
this?  If not any suggestions?

If I understand how gcc works correctly (and please correct me where I'm 
wrong), constructors act very much like containers for structs (and arrays). 
   Some constructors created for DECLs are used to allocate stack or 
constant data section memory.  However it seems that many constructors dont 
get materialized into memory.  For example COMPONENT_REF works on 
constructors, but these constructors dont necessarily exist in memory, 
though the fields might.

Store_constructors seems to do some things I need.  However I am unclear how 
the "target" parameter works... i.e.
static void
store_constructor (exp, target, align, cleared, size)
    tree exp;
    rtx target;
    unsigned int align;
    int cleared;
    HOST_WIDE_INT size;

FYI the earlier hacking involving assignments of multiple pointers works, 
after much hacking.  This question involves extending bounds to other cases, 
and unfortunately there are many of these.

-Wei

_________________________________________________________________
Get a FREE online computer virus scan from McAfee when you click here. 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Expr Constructor Question Part 2
  2004-03-13  1:51 Expr Constructor Question Part 2 Weihaw Chuang
@ 2004-03-16  9:02 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2004-03-16  9:02 UTC (permalink / raw)
  To: Weihaw Chuang; +Cc: gcc

Weihaw Chuang wrote:
> I would like to force a struct to a temporary on stack.

In a user program, or internally to gcc?  You weren't clear about this.

Internally to gcc, you probably want to call 
lang_hooks.mark_addressable, which sets TREE_ADDRESSABLE, which should 
force it to the stack.

In a user program, taking the address of a variable used to force it to 
the stack, but the optimizers have gotten smarter, so this might not be 
safe anymore.  You might have to declare it volatile, and take its address.

-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-16  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-13  1:51 Expr Constructor Question Part 2 Weihaw Chuang
2004-03-16  9:02 ` Jim Wilson

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).