[llvm] [RISCV][NewPM] Port RISCVCodeGenPrepare to the new pass manager (PR #168381)
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 09:42:21 PST 2025
================
@@ -33,36 +33,42 @@ using namespace llvm;
#define PASS_NAME "RISC-V CodeGenPrepare"
namespace {
-
-class RISCVCodeGenPrepare : public FunctionPass,
- public InstVisitor<RISCVCodeGenPrepare, bool> {
+class RISCVCodeGenPrepare : public InstVisitor<RISCVCodeGenPrepare, bool> {
+ Function &F;
const DataLayout *DL;
const DominatorTree *DT;
const RISCVSubtarget *ST;
+public:
+ RISCVCodeGenPrepare(Function &F, const DominatorTree *DT,
+ const RISCVSubtarget *ST)
+ : F(F), DL(&F.getDataLayout()), DT(DT), ST(ST) {}
+ bool run();
+ bool visitInstruction(Instruction &I) { return false; }
+ bool visitAnd(BinaryOperator &BO);
+ bool visitIntrinsicInst(IntrinsicInst &I);
+ bool expandVPStrideLoad(IntrinsicInst &I);
+ bool widenVPMerge(IntrinsicInst &I);
+};
+} // namespace
+
+namespace {
+class RISCVCodeGenPrepareLegacyPass : public FunctionPass {
----------------
asb wrote:
Yes that's another option that's been used in-tree. To me it makes sense that the shared class containing the logic is just "RISCVCodeGenPrepare" and we have separate RISCVCodeGenPreparePass (newpm) and RISCVCodeGenPrepareLegacyPass (oldpm) classes providing the pass manager interfaces. But I don't feel overly strongly. And hopefully the `*Legacy*` classes can be removed one day too.
(Sidenote: I think the "new" pass manager will be a teenager next year!).
https://github.com/llvm/llvm-project/pull/168381
More information about the llvm-commits
mailing list