Refactor lowerToScalableOp to combine switch case code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
In general I think this is a good idea, thanks. Whether or not something has a merge or mask is intrinsic to the op itself, not really a codegen choice. So I think this patch makes that more explicit, rather than relying on us specifying the right parameters. Plus it reduces copy/paste so that's a win.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4573 | This error message could probably be a little more explicit | |
4631 | I wonder if we want stronger checks here so people don't insert an op in the wrong place and have weird stuff happen. | |
llvm/lib/Target/RISCV/RISCVISelLowering.h | ||
908 | I think these can all be static? Or, is there any need for them to be member functions at all? | |
909 | does have -> has |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4631 | change to report_fatal_error? |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4631 | I was thinking more along the lines of static_asserts that check that nodes are defined roughly as we expect, or that there are as many nodes in between the ranges as we expect. That way someone can't insert any op in between RISCVISD::VWMUL_VL and RISCVISD::VFWSUB_W_VL (for example) without seeing a compile-time error and having to think about whether it has a merge op and whether the code needs updating. |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4631 | I get your idea, thanks. I add an assert to check the number of riscv target specific isd, make sure any change should update these 2 function. |
I think these can all be static? Or, is there any need for them to be member functions at all?