Hit a showstopper issue

David Malcolm dmalcolm@redhat.com
Thu Jan 1 00:00:00 GMT 2015


On Mon, 2015-06-15 at 22:18 +0100, Dibyendu Majumdar wrote:
> On 15 June 2015 at 21:54, David Malcolm <dmalcolm@redhat.com> wrote:
> > Yes: the IR exposed by the libgccjit API is not SSA-form.  The optimizer
> > does use SSA-form internally.
> >
> > I think my opinion at the time was that forcing users to create phi
> > nodes was unnecessary work for them; let the API do it automatically,
> > internally.   I don't know if the loss of this kind of validation is a
> > show-stopper; it feels to me more like a fussy API that the user has to
> > do extra work to appease.  But I could be wrong.
> >
> 
> In LLVM I hardly ever specify phi-nodes - it constructs them during
> optimization when it detects a scenario requiring a phi-node. I just
> declare my locals and use them appropriately - but yes one can
> explicitly code phi-nodes and to me (who is not so familiar with the
> concept) this is painful.
> 
> >> In any case a warning about unreachable bocks may be more appropriate
> >> than errors.
> >
> > FWIW I've experimented in the past with turning on warnings about
> > uninitialized vars, so maybe we need an API setting for validations,
> > with each validation having a tri-state:
> >   * perform validation, as error
> >   * perform validate, as warnings to stderr
> >   * don't validate

I'm thinking of something like this:

enum gcc_jit_validation_check
{
  GCC_JIT_VALIDATION_CHECK_UNREACHABLE_BLOCKS,
  GCC_JIT_VALIDATION_CHECK_UNINITIALIZED_LOCALS,

  GCC_JIT_NUM_VALIDATION_CHECKS
};

enum gcc_jit_validation_response
{
  GCC_JIT_VALIDATION_IGNORE,
  GCC_JIT_VALIDATION_LOG_TO_STDERR,
  GCC_JIT_VALIDATION_ERROR,

  GCC_JIT_NUM_VALIDATION_RESPONSES
};

extern void
gcc_jit_context_set_validation (gcc_jit_context *ctxt,
                                gcc_jit_validation_check check,
                                gcc_jit_validation_response response);

I'm not in love with any of the above names ("IGNORE" is really "don't
bother running this", it's not really a "response").

I wonder if there are any other existing gcc warnings that might be
useful to libgccjit users.  Thoughts?

Dave




More information about the Jit mailing list