Skip to content

[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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Copy link
Contributor

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?

Copy link
Collaborator

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

Copy link
Member Author

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?

// 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");
Expand Down