md/define_c_enum: support value assignation
authorYunQiang Su <yunqiang.su@cipunited.com>
Tue, 31 Aug 2021 11:19:49 +0000 (07:19 -0400)
committerYunQiang Su <syq@debian.org>
Wed, 1 Sep 2021 10:12:17 +0000 (18:12 +0800)
commit7c922606b75370d5b4c3589dcf0fc757dfb4fcaa
tree0fd0ae30e7a6fc7bcc8477378de60249f6a92569
parent45ff12512e568089a4c7b85b5322ab8019723cd9
md/define_c_enum: support value assignation

Currently, the enums from define_c_enum and define_enum can only
has values one by one from 0.

In fact we can support the behaviour just like C, aka like
  (define_enum "mips_isa" [(mips1 1) mips2 (mips32 32) mips32r2]),
then we can get
  enum mips_isa {
    MIPS_ISA_MIPS1 = 1,
    MIPS_ISA_MIPS2 = 2,
    MIPS_ISA_MIPS32 = 32,
    MIPS_ISA_MIPS32R2 = 33
  };

gcc/ChangeLog:
* read-md.c (md_reader::handle_enum): support value assignation.
* doc/md.texi: record define_c_enum value assignation support.
gcc/doc/md.texi
gcc/read-md.c