RFC: support for multiple CFGs (necessary for the tree-profiling branch)

Stuart Hastings stuart@apple.com
Mon May 24 19:46:00 GMT 2004


On May 24, 2004, at 9:38 AM, Richard Henderson wrote:

On Sun, May 23, 2004 at 11:00:29PM +0200, Steven Bosscher wrote:
+#define ENTRY_BLOCK_PTR(FN)            ((FN)->cfg->entry_block_ptr)
+#define EXIT_BLOCK_PTR(FN)             ((FN)->cfg->exit_block_ptr)
+#define BASIC_BLOCK_INFO(FN)           ((FN)->cfg->basic_block_info)
+#define N_BASIC_BLOCKS(FN)             ((FN)->cfg->n_basic_blocks)
+#define N_EDGES(FN)                    ((FN)->cfg->n_edges)
+#define LAST_BASIC_BLOCK(FN)           ((FN)->cfg->last_basic_block)
+#define LABEL_TO_BLOCK_MAP(FN)         
((FN)->cfg->label_to_block_map)
It would seem to be an easier change to imply cfun in these macros
and to use a separate set (or none at all) for the rare case of
having to access a different function's cfg.
Sounds like you'd prefer what I had originally:

	#define ENTRY_BLOCK_PTR ENTRY_BLOCK_PTR_FN(cfun)

Others similar.

Attached is my current patch for the tree-profiling-branch, offered 
here for comments.  This is an inliner that works on CFGs, a necessary 
step towards a profile-driven inliner for 3.5.  Since this patch is 
probably too huge and drastic to apply to the FSF mainline at one go, 
Steven graciously agreed to extract the multiple-CFG stuff and offer 
that as a first step.

The patch below is against the current top of the tree-profiling 
branch.  The C compiler will bootstrap (on my Apple system); I'm 
working on the C++ boootstrap now.  I hope to get bootstraps of 
C/C++/ObjC working this week, and then I'll offer this as a patch for 
the tree-profiling-branch.

*This is not ready for mainline yet.*

Important changes are
1) n_basic_blocks -> N_BASIC_BLOCKS &etc everywhere
2) parameterized versions of the above, e.g. N_BASIC_BLOCKS_FN(cfun), 
needed for inliner and callgraph
3) many changes to tree_inline.c:expand_call_inline()

I plan to fold the 'cfg' struct back into 'struct function'; there's no 
benefit to having them be separate (eliminating the "->cfg" in the 
fragment above).

When I get C++ and ObjC to bootstrap (and make check), I was planning 
to offer a patch to the tree-profiling branch.

Comments appreciated,

stuart hastings
Apple Computer
Attachment:
gcc.tprofa.diffs.txt
Description: Text document


P.S. the changes under 'fastjar/' are some sort of merge screwup on my 
part; please ignore them.


More information about the Gcc mailing list