Skip to content

Commit da38b72

Browse files
committed
[Exegesis][RISCV] Remove the usage of RISCVSubtarget
Replace the usage of RISCVSubtarget in RISCVExegesisPreprocessingPass with an equivalent. Because including RISCVSubtarget.h might slow down the build speed by hindering the degree of parallelism for components outside LLVMRISCVCodeGen.
1 parent 7c58089 commit da38b72

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
#include "RISCV.h"
1313
#include "RISCVExegesisPasses.h"
1414
#include "RISCVRegisterInfo.h"
15-
#include "RISCVSubtarget.h"
1615
#include "llvm/CodeGen/MachineFunctionPass.h"
1716
#include "llvm/CodeGen/MachineRegisterInfo.h"
17+
#include "llvm/CodeGen/TargetInstrInfo.h"
18+
#include "llvm/MC/MCContext.h"
1819

1920
using namespace llvm;
2021

@@ -63,10 +64,13 @@ static bool processAVLOperand(MachineInstr &MI, MachineRegisterInfo &MRI,
6364

6465
bool RISCVExegesisPreprocessing::runOnMachineFunction(MachineFunction &MF) {
6566
MachineRegisterInfo &MRI = MF.getRegInfo();
66-
const auto &STI = MF.getSubtarget<RISCVSubtarget>();
67-
if (!STI.hasVInstructions())
67+
// We could have use RISCVSubtarget::hasVInstructions here but including
68+
// RISCVSubtarget.h would serialize the build of components outside
69+
// LLVMRISCVCodeGen.
70+
const MCSubtargetInfo &STI = *MF.getContext().getSubtargetInfo();
71+
if (!STI.hasFeature(RISCV::FeatureStdExtZve32x))
6872
return false;
69-
const TargetInstrInfo &TII = *STI.getInstrInfo();
73+
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
7074

7175
LLVM_DEBUG(MF.print(dbgs() << "===Before RISCVExegesisPoreprocessing===\n");
7276
dbgs() << "\n");

0 commit comments

Comments
 (0)