Hi,

(Sorry for the delay.)

I suppose the proposed API doesn’t cover all the needs of your Python
bindings and their applications, does it?  How do you plan to export the
GIMPLE and tree.h APIs?

Regarding iterators, there are things like:

  GCC_IMPLEMENT_PUBLIC_API(bool)
  gcc_cfg_for_each_block(gcc_cfg cfg,
                       bool (*cb)(gcc_cfg_block block, void *user_data),
                       void *user_data)
  {
      int i;

      for (i = 0; i < cfg.inner->x_n_basic_blocks; i++) {

Instead of the callback API, could the details of the containers be
exposed a little more, like:

  /* Return the number of basic blocks in CFG.  */
  unsigned int gcc_cfg_block_count (gcc_cfg cfg);

  /* Return a pointer to the array of basic blocks in CFG.  */
  gcc_cfg_block *gcc_cfg_blocks (gcc_cfg cfg);

That would allow higher-level language bindings to provide idiomatic
ways to iterate over basic blocks, such as (lazy) list iterators.

WDYT?

Thanks,
Ludo’.

Reply via email to