[llvm] [CodeGen][NPM] Port LiveDebugValues to NPM (PR #131563)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 17 23:10:47 PDT 2025
================
@@ -77,36 +78,68 @@ class LiveDebugValues : public MachineFunctionPass {
AU.setPreservesCFG();
MachineFunctionPass::getAnalysisUsage(AU);
}
+};
+
+struct LiveDebugValues {
+ LiveDebugValues();
+ ~LiveDebugValues() = default;
+ bool run(MachineFunction &MF, bool ShouldEmitDebugEntryValues);
private:
std::unique_ptr<LDVImpl> InstrRefImpl;
std::unique_ptr<LDVImpl> VarLocImpl;
- TargetPassConfig *TPC = nullptr;
MachineDominatorTree MDT;
};
} // namespace
-char LiveDebugValues::ID = 0;
+char LiveDebugValuesLegacy::ID = 0;
-char &llvm::LiveDebugValuesID = LiveDebugValues::ID;
+char &llvm::LiveDebugValuesID = LiveDebugValuesLegacy::ID;
-INITIALIZE_PASS(LiveDebugValues, DEBUG_TYPE, "Live DEBUG_VALUE analysis", false,
- false)
+INITIALIZE_PASS(LiveDebugValuesLegacy, DEBUG_TYPE, "Live DEBUG_VALUE analysis",
+ false, false)
/// Default construct and initialize the pass.
-LiveDebugValues::LiveDebugValues() : MachineFunctionPass(ID) {
- initializeLiveDebugValuesPass(*PassRegistry::getPassRegistry());
+LiveDebugValuesLegacy::LiveDebugValuesLegacy() : MachineFunctionPass(ID) {
+ initializeLiveDebugValuesLegacyPass(*PassRegistry::getPassRegistry());
+}
+
+LiveDebugValues::LiveDebugValues() {
InstrRefImpl =
std::unique_ptr<LDVImpl>(llvm::makeInstrRefBasedLiveDebugValues());
VarLocImpl = std::unique_ptr<LDVImpl>(llvm::makeVarLocBasedLiveDebugValues());
}
-bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) {
+PreservedAnalyses
+LiveDebugValuesPass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ if (!LiveDebugValues().run(MF, ShouldEmitDebugEntryValues))
+ return PreservedAnalyses::all();
+ auto PA = getMachineFunctionPassPreservedAnalyses();
----------------
optimisan wrote:
I see, will do
https://github.com/llvm/llvm-project/pull/131563
More information about the llvm-commits
mailing list