[llvm] [RISCV] Add generateMCInstSeq in RISCVMatInt (PR #84462)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 03:27:18 PST 2024


================
@@ -436,6 +437,46 @@ InstSeq generateInstSeq(int64_t Val, const MCSubtargetInfo &STI) {
   return Res;
 }
 
+SmallVector<MCInst, 8>
+generateMCInstSeq(int64_t Val, const MCSubtargetInfo &STI, MCRegister DestReg) {
----------------
lukel97 wrote:

I think SmallVectors are typically "returned" by a reference argument to avoid a copy

```suggestion
void
generateMCInstSeq(int64_t Val, const MCSubtargetInfo &STI, MCRegister DestReg, SmallVectorImpl<MCInst> &Insts) {
```

And you can use SmallVectorImpl so you don't hardcode the small size: https://www.llvm.org/docs/ProgrammersManual.html#id47

https://github.com/llvm/llvm-project/pull/84462


More information about the llvm-commits mailing list