Repository: llvm/llvm-project
File: llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp (C++)

Code before:
  bool selectExtInst(Register ResVReg, SPIRVTypeInst RestType, MachineInstr &I,
                     GL::GLSLExtInst GLInst) const;
  bool selectExtInst(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                     CL::OpenCLExtInst CLInst) const;
  bool selectExtInst(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                     CL::OpenCLExtInst CLInst, GL::GLSLExtInst GLInst) const;
  bool selectExtInst(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                     const ExtInstList &ExtInsts) const;
  bool selectExtInstForLRound(Register ResVReg, SPIRVTypeInst ResType,
                              MachineInstr &I, CL::OpenCLExtInst CLInst,
                              GL::GLSLExtInst GLInst) const;
  bool selectExtInstForLRound(Register ResVReg, SPIRVTypeInst ResType,
                              MachineInstr &I,
                              const ExtInstList &ExtInsts) const;
  bool selectExtInstWithSrcs(Register ResVReg, SPIRVTypeInst RestType,
                             MachineInstr &I, std::vector<Register> SrcRegs,
                             GL::GLSLExtInst GLInst) const;
  bool selectExtInstWithSrcs(Register ResVReg, SPIRVTypeInst ResType,
                             MachineInstr &I, std::vector<Register> SrcRegs,
                             CL::OpenCLExtInst CLInst) const;
  bool selectExtInstWithSrcs(Register ResVReg, SPIRVTypeInst ResType,
                             MachineInstr &I, std::vector<Register> SrcRegs,
                             CL::OpenCLExtInst CLInst,
                             GL::GLSLExtInst GLInst) const;
  bool selectExtInstWithSrcs(Register ResVReg, SPIRVTypeInst ResType,
                             MachineInstr &I, std::vector<Register> SrcRegs,
                             const ExtInstList &ExtInsts) const;

  bool selectLog10(Register ResVReg, SPIRVTypeInst ResType,
                   MachineInstr &I) const;

  bool selectSaturate(Register ResVReg, SPIRVTypeInst ResType,
                      MachineInstr &I) const;

  bool selectWaveOpInst(Register ResVReg, SPIRVTypeInst ResType,
                        MachineInstr &I, unsigned Opcode) const;

  bool selectWaveActiveCountBits(Register ResVReg, SPIRVTypeInst ResType,
                                 MachineInstr &I) const;

  bool selectUnmergeValues(MachineInstr &I) const;

  bool selectHandleFromBinding(Register &ResVReg, SPIRVTypeInst ResType,
                               MachineInstr &I) const;

  bool selectCounterHandleFromBinding(Register &ResVReg, SPIRVTypeInst ResType,
                                      MachineInstr &I) const;

  bool selectReadImageIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                MachineInstr &I) const;
  bool selectSampleBasicIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,

Review comment (suggestion):
Can you turn the `std::vector` into an `ArrayRef` ?

This would help avoid the awkward `std::vector` construction when passing the parameter.

Code after:
                     GL::GLSLExtInst GLInst, bool setMIFlags = true,
                     bool useMISrc = true,
                     ArrayRef<Register> SrcRegs = {}) const;
  bool selectExtInst(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                     CL::OpenCLExtInst CLInst, bool setMIFlags = true,
                     bool useMISrc = true,
                     ArrayRef<Register> SrcRegs = {}) const;
  bool selectExtInst(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                     CL::OpenCLExtInst CLInst, GL::GLSLExtInst GLInst,
                     bool setMIFlags = true, bool useMISrc = true,
                     ArrayRef<Register> SrcRegs = {}) const;
  bool selectExtInst(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                     const ExtInstList &ExtInsts, bool setMIFlags = true,
                     bool useMISrc = true,
                     ArrayRef<Register> SrcRegs = {}) const;

  bool selectLog10(Register ResVReg, SPIRVTypeInst ResType,
                   MachineInstr &I) const;

  bool selectSaturate(Register ResVReg, SPIRVTypeInst ResType,
                      MachineInstr &I) const;

  bool selectWaveOpInst(Register ResVReg, SPIRVTypeInst ResType,
                        MachineInstr &I, unsigned Opcode) const;

  bool selectWaveActiveCountBits(Register ResVReg, SPIRVTypeInst ResType,
                                 MachineInstr &I) const;

  bool selectUnmergeValues(MachineInstr &I) const;

  bool selectHandleFromBinding(Register &ResVReg, SPIRVTypeInst ResType,
                               MachineInstr &I) const;

  bool selectCounterHandleFromBinding(Register &ResVReg, SPIRVTypeInst ResType,
                                      MachineInstr &I) const;

  bool selectReadImageIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                MachineInstr &I) const;
  bool selectSampleBasicIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                  MachineInstr &I) const;
  bool selectSampleBiasIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                 MachineInstr &I) const;
  bool selectSampleGradIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                 MachineInstr &I) const;
  bool selectSampleLevelIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                  MachineInstr &I) const;
  bool selectSampleCmpIntrinsic(Register &ResVReg, SPIRVTypeInst ResType,
                                MachineInstr &I) const;
  bool selectSampleCmpLevelZeroIntrinsic(Register &ResVReg,
                                         SPIRVTypeInst ResType,
                                         MachineInstr &I) const;