public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Pop Sébastian" <pop@gauvain.u-strasbg.fr>
To: gcc@gcc.gnu.org
Subject: [RFC] CFG hooks for rtl/tree specificities
Date: Tue, 01 Apr 2003 16:11:00 -0000	[thread overview]
Message-ID: <20030401145007.GA25362@gauvain.u-strasbg.fr> (raw)

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;
{
} 

----

             reply	other threads:[~2003-04-01 14:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01 16:11 Pop Sébastian [this message]
2003-04-01 16:23 ` Jan Hubicka
2003-04-01 17:05   ` Pop Sébastian
2003-04-01 17:08     ` Jan Hubicka
2003-04-01 18:12     ` Diego Novillo
2003-04-02 14:19       ` Pop Sébastian
2003-06-14 13:13         ` Jan Hubicka
2003-06-14 19:42           ` Pop Sébastian
2003-06-14 21:01             ` Jan Hubicka
2003-06-15 16:38               ` Jan Hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030401145007.GA25362@gauvain.u-strasbg.fr \
    --to=pop@gauvain.u-strasbg.fr \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).