From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18931 invoked by alias); 1 Apr 2003 14:50:08 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 18924 invoked from network); 1 Apr 2003 14:50:07 -0000 Received: from unknown (HELO gauvain.u-strasbg.fr) (130.79.74.5) by sources.redhat.com with SMTP; 1 Apr 2003 14:50:07 -0000 Received: from pop by gauvain.u-strasbg.fr with local (Exim 3.36 #1 (Debian)) id 190N5T-0006iy-00 for ; Tue, 01 Apr 2003 16:50:07 +0200 Date: Tue, 01 Apr 2003 16:11:00 -0000 To: gcc@gcc.gnu.org Subject: [RFC] CFG hooks for rtl/tree specificities Message-ID: <20030401145007.GA25362@gauvain.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i From: =?iso-8859-1?Q?Pop_S=E9bastian?= X-SW-Source: 2003-04/txt/msg00033.txt.bz2 Hi, I would like to have your opinion on the following reorganization of the CFG functions. I propose to keep all the functions that deal with IR specificities into a hook structure a little bit the same way we handle the specificities of a language front-end in langhooks. These functions are initialized during the CFG construction. This would allow the CFG analyzers and optimizers to work at both the RTL and the tree levels. cfghooks.h will contain something like: ---- /* Initializations specific to either the tree or the rtl level. */ extern void tree_register_cfg_hooks PARAMS ((void)); extern void rtl_register_cfg_hooks PARAMS ((void)); struct cfg_hooks { basic_block (*cfgh_split_edge) PARAMS ((edge)); void (*cfgh_cfg_layout_initialize) PARAMS ((struct loops *)); void (*cfgh_cfg_layout_finalize) PARAMS ((void)); void (*cfgh_verify_flow_info) PARAMS ((void)); }; /* The following macros act either at the tree level or at the rtl level. */ #define split_edge(e) cfg_hooks.cfgh_split_edge (e) #define cfg_layout_initialize(l) cfg_hooks.cfgh_cfg_layout_initialize (l) #define cfg_layout_finalize() cfg_hooks.cfgh_cfg_layout_finalize () #define verify_flow_info() cfg_hooks.cfgh_verify_flow_info () extern struct cfg_hooks cfg_hooks; ---- cfghooks.c looks like: ---- struct cfg_hooks cfg_hooks; /* Static declarations. */ static void cfgh_do_nothing PARAMS ((void)); static void cfgh_do_nothing_loops PARAMS ((struct loops *)); /* Initialization of functions specific to the tree IR. */ void tree_register_cfg_hooks () { cfg_hooks.cfgh_split_edge = &tree_split_edge; cfg_hooks.cfgh_cfg_layout_initialize = &cfgh_do_nothing_loops; cfg_hooks.cfgh_cfg_layout_finalize = &cfgh_do_nothing; cfg_hooks.cfgh_verify_flow_info = &cfgh_do_nothing; } /* Initialization of functions specific to the rtl IR. */ void rtl_register_cfg_hooks () { cfg_hooks.cfgh_split_edge = &rtl_split_edge; cfg_hooks.cfgh_cfg_layout_initialize = &rtl_cfg_layout_initialize; cfg_hooks.cfgh_cfg_layout_finalize = &rtl_cfg_layout_finalize; cfg_hooks.cfgh_verify_flow_info = &rtl_verify_flow_info; } /* Do-nothing functions. */ static void cfgh_do_nothing () { } static void cfgh_do_nothing_loops (l) struct loops *l ATTRIBUTE_UNUSED; { } ----