public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: "J. Johnston" <jjohnstn@cygnus.com>
To: cgen@sources.redhat.com
Subject: CGEN Regex support
Date: Thu, 12 Jul 2001 14:51:00 -0000	[thread overview]
Message-ID: <3B4E1BCF.73F24B77@cygnus.com> (raw)

I have just checked in some changes originally written by Graydon which enhance insn parsing.  They
take advantage of the regex support just recently added to libiberty.  At initialization, various
insn formats are translated into simple regular expressions (operands are treated as .*).  Before
parsing an insn, a check is made to see if the insn at least has all the fixed characters in the
right position before parsing any further.  This reduces the chance that a valid error message from
one of the parsing routines gets stomped on because a bad match is attempted because it has the same
mnemonic.

For example, if you had two insns:

    move k,reg
    move reg,k

where "k" is a fixed register and reg cannot be "k", then if a user has

    move k,l,m

This should give a message about unexpected characters found at the end of the line.  In the old
scenario, the parser would fail the first attempt and then try the second form of the move insn. 
This would then result in an error regarding the fact that "k" is not valid as a reg which is not
meaningful to the user.  The new code will not attempt the second case so the error message from the
first parsing is preserved.

The following are the ChangeLogs:

From cgen:

2001-07-12  Jeff Johnston  <jjohnstn@redhat.com>

        * opc-itab.scm (@arch@_cgen_init_opcode_table): Unconditionally
        call @arch@_cgen_build_insn_regex now that regex support is in
        libiberty.


From opcodes:

2001-07-12  Jeff Johnston  <jjohnstn@redhat.com>

        * cgen-asm.in: Include "xregex.h" always to enable the libiberty
        regex support.
        (@arch@_cgen_build_insn_regex): New routine from Graydon.
        (@arch@_cgen_assemble_insn): Add Graydon's code to use regex
        to verify if it is worth parsing the insn as insn "x".  Also update
        error message when insn is not a recognized format of the insn vs
        when the insn is completely unrecognized.

and from include:

2001-07-12  Jeff Johnston  <jjohnstn@redhat.com>

        * opcode/cgen.h (CGEN_INSN): Add regex support.
        (build_insn_regex): Declare.

-- Jeff J.

                 reply	other threads:[~2001-07-12 14:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3B4E1BCF.73F24B77@cygnus.com \
    --to=jjohnstn@cygnus.com \
    --cc=cgen@sources.redhat.com \
    /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).