This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto] PATCH: Add support for referencing types from function bodies

Kenneth Zadeck wrote:

I think that if you want to teach the gimplifier to do this, that is a
great way to get rid of them for any downstream part of the compiler.  I
have never touched the gimplifier and really do not want to make this
yet another learning experience, dwarf and gimple have been enough for
this project.

OK, we can cross that bridge as we come to it.

Let's talk about how we're going to wire up the reading side of things. I suggest that you provide this routine:

  void lto_read_function_body (lto_info_fd *fd,
                               lto_context *context,
                               tree fn,
                               const void *data);

Here, FD and CONTEXT are parameters that you will need to pass back to the routines that resolve references to global data from within the function body. (These are not global variables because we want to support concurrency and/or re-entrancy.) Otherwise, you won't make any use of them. FN is the FUNCTION_DECL for the function whose body you're about to read. DATA points to the memory-mapped data for the function, as you wrote it out to the object file.

So, by the time this function is called, the FUNCTION_DECL will already have been set up and mapping/un-mapping the data will be the caller's responsibility. This function's job is to set up DECL_SAVED_TREE and DECL_INITIAL for the FUNCTION_DECL, set flags on the FUNCTION_DECL, etc. This function does not need to actually pass the function off to the middle-end; this function is just for reading data from the object file.

How does that sound?

Mark Mitchell
(650) 331-3385 x713

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]