-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Exegesis][RISCV] Remove the usage of RISCVSubtarget #129568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Exegesis][RISCV] Remove the usage of RISCVSubtarget #129568
Conversation
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.
@llvm/pr-subscribers-tools-llvm-exegesis @llvm/pr-subscribers-backend-risc-v Author: Min-Yih Hsu (mshockwave) ChangesReplace 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. Full diff: https://github.com/llvm/llvm-project/pull/129568.diff 1 Files Affected:
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp
index 7f1cfd9ea52df..69a02e94ecb39 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/RISCVExegesisPreprocessing.cpp
@@ -12,9 +12,10 @@
#include "RISCV.h"
#include "RISCVExegesisPasses.h"
#include "RISCVRegisterInfo.h"
-#include "RISCVSubtarget.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/TargetInstrInfo.h"
+#include "llvm/MC/MCContext.h"
using namespace llvm;
@@ -63,10 +64,13 @@ static bool processAVLOperand(MachineInstr &MI, MachineRegisterInfo &MRI,
bool RISCVExegesisPreprocessing::runOnMachineFunction(MachineFunction &MF) {
MachineRegisterInfo &MRI = MF.getRegInfo();
- const auto &STI = MF.getSubtarget<RISCVSubtarget>();
- if (!STI.hasVInstructions())
+ // We could have use RISCVSubtarget::hasVInstructions here but including
+ // RISCVSubtarget.h would serialize the build of components outside
+ // LLVMRISCVCodeGen.
+ const MCSubtargetInfo &STI = *MF.getContext().getSubtargetInfo();
+ if (!STI.hasFeature(RISCV::FeatureStdExtZve32x))
return false;
- const TargetInstrInfo &TII = *STI.getInstrInfo();
+ const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
LLVM_DEBUG(MF.print(dbgs() << "===Before RISCVExegesisPoreprocessing===\n");
dbgs() << "\n");
|
Isn't the dependency on RISCVMCTargetDesc.h through the RISCV.h the same issue? |
const auto &STI = MF.getSubtarget<RISCVSubtarget>(); | ||
if (!STI.hasVInstructions()) | ||
// We could have use RISCVSubtarget::hasVInstructions here but including | ||
// RISCVSubtarget.h would serialize the build of components outside |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the build ordering be defined by the CMake target dependencies and not what headers get included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the RISCV part of llvm-exegesis already depends on RISCVCommonTableGen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nico I assumed you raised the original concern when you're dealing with GN, how are dependencies in this case got resolved in GN?
@nico do you mind sharing how GN resolves dependencies? #129568 (comment) |
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.