[llvm] [NewPM] Adds a port for AArch64PostLegalizerLowering (PR #190718)
Anshul Nigham via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 23:49:51 PDT 2026
================
@@ -1276,48 +1300,59 @@ class AArch64PostLegalizerLowering : public MachineFunctionPass {
};
} // end anonymous namespace
-void AArch64PostLegalizerLowering::getAnalysisUsage(AnalysisUsage &AU) const {
+void AArch64PostLegalizerLoweringLegacy::getAnalysisUsage(
+ AnalysisUsage &AU) const {
AU.setPreservesCFG();
getSelectionDAGFallbackAnalysisUsage(AU);
MachineFunctionPass::getAnalysisUsage(AU);
}
-AArch64PostLegalizerLowering::AArch64PostLegalizerLowering()
+AArch64PostLegalizerLoweringLegacy::AArch64PostLegalizerLoweringLegacy()
: MachineFunctionPass(ID) {
if (!RuleConfig.parseCommandLineOption())
report_fatal_error("Invalid rule identifier");
}
-bool AArch64PostLegalizerLowering::runOnMachineFunction(MachineFunction &MF) {
- if (MF.getProperties().hasFailedISel())
- return false;
- assert(MF.getProperties().hasLegalized() && "Expected a legalized function?");
- const Function &F = MF.getFunction();
-
- const AArch64Subtarget &ST = MF.getSubtarget<AArch64Subtarget>();
- CombinerInfo CInfo(/*AllowIllegalOps*/ true, /*ShouldLegalizeIllegal*/ false,
- /*LegalizerInfo*/ nullptr, /*OptEnabled=*/true,
- F.hasOptSize(), F.hasMinSize());
- // Disable fixed-point iteration to reduce compile-time
- CInfo.MaxIterations = 1;
- CInfo.ObserverLvl = CombinerInfo::ObserverLevel::SinglePass;
- // PostLegalizerCombiner performs DCE, so a full DCE pass is unnecessary.
- CInfo.EnableFullDCE = false;
- AArch64PostLegalizerLoweringImpl Impl(MF, CInfo, /*CSEInfo*/ nullptr,
- RuleConfig, ST);
- return Impl.combineMachineInstrs();
+bool AArch64PostLegalizerLoweringLegacy::runOnMachineFunction(
+ MachineFunction &MF) {
+ return runPostLegalizerLowering(MF, RuleConfig);
}
-char AArch64PostLegalizerLowering::ID = 0;
-INITIALIZE_PASS_BEGIN(AArch64PostLegalizerLowering, DEBUG_TYPE,
+char AArch64PostLegalizerLoweringLegacy::ID = 0;
+INITIALIZE_PASS_BEGIN(AArch64PostLegalizerLoweringLegacy, DEBUG_TYPE,
"Lower AArch64 MachineInstrs after legalization", false,
false)
-INITIALIZE_PASS_END(AArch64PostLegalizerLowering, DEBUG_TYPE,
+INITIALIZE_PASS_END(AArch64PostLegalizerLoweringLegacy, DEBUG_TYPE,
"Lower AArch64 MachineInstrs after legalization", false,
false)
+AArch64PostLegalizerLoweringPass::AArch64PostLegalizerLoweringPass()
+ : RuleConfig(
+ std::make_unique<AArch64PostLegalizerLoweringImplRuleConfig>()) {
+ if (!RuleConfig->parseCommandLineOption())
----------------
nigham wrote:
Sure, makes sense for future work.
https://github.com/llvm/llvm-project/pull/190718
More information about the llvm-commits
mailing list