bpf: New decoder namespace for 32-bit subregister load/store
authorYonghong Song <yhs@fb.com>
Fri, 23 Feb 2018 23:49:31 +0000 (23:49 +0000)
committerYonghong Song <yhs@fb.com>
Fri, 23 Feb 2018 23:49:31 +0000 (23:49 +0000)
commitae961bb06127330c6ee04c1c584271f66829d74e
tree1764d13c43b870bb9c756b83d3806467cc7e1caf
parentca31c3bb3ff149850b664838fbbc7d40ce571879
bpf: New decoder namespace for 32-bit subregister load/store

When -mattr=+alu32 passed to the disassembler, use decoder namespace for
32-bit subregister.

This is to disassemble load and store instructions in preferred B format
as described in previous commit:

      w = *(u8 *) (r + off) // BPF_LDX | BPF_B
      w = *(u16 *)(r + off) // BPF_LDX | BPF_H
      w = *(u32 *)(r + off) // BPF_LDX | BPF_W

      *(u8 *) (r + off) = w // BPF_STX | BPF_B
      *(u16 *)(r + off) = w // BPF_STX | BPF_H
      *(u32 *)(r + off) = w // BPF_STX | BPF_W

NOTE: all other instructions should still use the default decoder
      namespace.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 325990
llvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp