[llvm-dev] [iovisor-dev] [PATCH, BPF 2/5] BPF: Rearrange instruction classes

Alexei Starovoitov via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 15 22:23:29 PDT 2016


On Wed, Jun 15, 2016 at 2:37 PM, Richard Henderson via iovisor-dev
<iovisor-dev at lists.iovisor.org> wrote:
> Avoid duplicating lots of field definitions.
>
> Signed-off-by: Richard Henderson <rth at twiddle.net>
> ---
>  lib/Target/BPF/BPFInstrFormats.td |  45 +++-
>  lib/Target/BPF/BPFInstrInfo.td    | 536 +++++++++++++++-----------------------
>  2 files changed, 247 insertions(+), 334 deletions(-)
>
> diff --git a/lib/Target/BPF/BPFInstrFormats.td b/lib/Target/BPF/BPFInstrFormats.td
> index 53f3ad6..79479e6 100644
> --- a/lib/Target/BPF/BPFInstrFormats.td
> +++ b/lib/Target/BPF/BPFInstrFormats.td
> @@ -8,7 +8,8 @@
>  //===----------------------------------------------------------------------===//
>
>  class InstBPF<dag outs, dag ins, string asmstr, list<dag> pattern>
> -  : Instruction {
> +  : Instruction
> +{

please keep original llvm coding style.

>  // Pseudo instructions
>  class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
> -  : InstBPF<outs, ins, asmstr, pattern> {
> +  : InstBPF<outs, ins, asmstr, pattern>
> +{

same here

>    let Inst{63-0} = 0;
>    let isPseudo = 1;
>  }
> +
> +class F_CMS<bits<3> cls, bits<3> mode, bits<2> sz,
...
> +class F_COF<bits<3> cls, bits<4> op, bits<1> srcf,

what F_CMS and F_COF abbreviations mean?

overall removal of duplicated code is very nice.


More information about the llvm-dev mailing list