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

Avoid duplicating lots of field definitions.

Signed-off-by: Richard Henderson <rth@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.

"Code, Mode, Size" and "Code, Op, source Flag"

which are the two field tuples. A comment would have been handy, I admit.

r~