[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for...
authorCraig Topper <craig.topper@sifive.com>
Wed, 9 Dec 2020 00:02:00 +0000 (16:02 -0800)
committerCraig Topper <craig.topper@sifive.com>
Wed, 9 Dec 2020 00:04:20 +0000 (16:04 -0800)
commita64998be99e1b692b56e379d3b6a72caebc8512d
treec3b4ecfe807f4fbfc48a9f5db3ba781f332c3e5d
parentd58f112ce03877f73200591cd3c9b38e41e46afe
[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for adding VSETVLI before vector instructions

This merges the SEW and LMUL enums that each used into singles enums in RISCVBaseInfo.h. The patch also adds a new encoding helper to take SEW, LMUL, tail agnostic, mask agnostic and turn it into a vtype immediate.

I also stopped storing the Encoding in the VTYPE operand in the assembler. It is easy to calculate when adding the operand which should only happen once per instruction.

Differential Revision: https://reviews.llvm.org/D92813
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.h