-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Make RISCVIndirectBranchTracking visible in debug output #141623
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
Conversation
@llvm/pr-subscribers-backend-risc-v Author: Jesse Huang (jaidTw) ChangesFix RISC-V Indirect Branch Tracking pass was not showing in the pass debug output due to not initialized properly. Full diff: https://github.com/llvm/llvm-project/pull/141623.diff 2 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVIndirectBranchTracking.cpp b/llvm/lib/Target/RISCV/RISCVIndirectBranchTracking.cpp
index 4660a975b20ae..da89589bee47a 100644
--- a/llvm/lib/Target/RISCV/RISCVIndirectBranchTracking.cpp
+++ b/llvm/lib/Target/RISCV/RISCVIndirectBranchTracking.cpp
@@ -20,6 +20,9 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
+#define DEBUG_TYPE "riscv-indrect-branch-tracking"
+#define PASS_NAME "RISC-V Indirect Branch Tracking"
+
using namespace llvm;
cl::opt<uint32_t> PreferredLandingPadLabel(
@@ -27,27 +30,29 @@ cl::opt<uint32_t> PreferredLandingPadLabel(
cl::desc("Use preferred fixed label for all labels"));
namespace {
-class RISCVIndirectBranchTrackingPass : public MachineFunctionPass {
+class RISCVIndirectBranchTracking : public MachineFunctionPass {
public:
- RISCVIndirectBranchTrackingPass() : MachineFunctionPass(ID) {}
+ static char ID;
+ RISCVIndirectBranchTracking() : MachineFunctionPass(ID) {}
StringRef getPassName() const override {
- return "RISC-V Indirect Branch Tracking";
+ return PASS_NAME;
}
bool runOnMachineFunction(MachineFunction &MF) override;
private:
- static char ID;
const Align LpadAlign = Align(4);
};
} // end anonymous namespace
-char RISCVIndirectBranchTrackingPass::ID = 0;
+INITIALIZE_PASS(RISCVIndirectBranchTracking, DEBUG_TYPE, PASS_NAME, false, false)
+
+char RISCVIndirectBranchTracking::ID = 0;
FunctionPass *llvm::createRISCVIndirectBranchTrackingPass() {
- return new RISCVIndirectBranchTrackingPass();
+ return new RISCVIndirectBranchTracking();
}
static void emitLpad(MachineBasicBlock &MBB, const RISCVInstrInfo *TII,
@@ -57,7 +62,7 @@ static void emitLpad(MachineBasicBlock &MBB, const RISCVInstrInfo *TII,
.addImm(Label);
}
-bool RISCVIndirectBranchTrackingPass::runOnMachineFunction(
+bool RISCVIndirectBranchTracking::runOnMachineFunction(
MachineFunction &MF) {
const auto &Subtarget = MF.getSubtarget<RISCVSubtarget>();
const RISCVInstrInfo *TII = Subtarget.getInstrInfo();
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 15dd4d57727dd..8342845ec6f24 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -147,6 +147,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
initializeRISCVDAGToDAGISelLegacyPass(*PR);
initializeRISCVMoveMergePass(*PR);
initializeRISCVPushPopOptPass(*PR);
+ initializeRISCVIndirectBranchTrackingPass(*PR);
initializeRISCVLoadStoreOptPass(*PR);
initializeRISCVExpandAtomicPseudoPass(*PR);
initializeRISCVRedundantCopyEliminationPass(*PR);
|
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.
LGTM
✅ With the latest revision this PR passed the C/C++ code formatter. |
…m#141623) Fix RISC-V Indirect Branch Tracking pass was not showing in the pass debug output due to not initialized properly.
Fix RISC-V Indirect Branch Tracking pass was not showing in the pass debug output due to not initialized properly.