[llvm] [GlobalISel][ARM] Selection of G_CONSTANT using constant pool (PR #96225)
Serge Pavlov via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 23 23:17:05 PDT 2024
spavloff wrote:
This implementation used the same approach as in AArch64, where loading from constant pool replaces G_CONSTANT in selector: https://github.com/llvm/llvm-project/blob/fec1b6f9d3cf5347b67ffb2078c995eb496acf47/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp#L2580
I could not find a use of constant pool in ARM global selector. In the DAG selector the replacement is made by the specific selecton code: https://github.com/llvm/llvm-project/blob/a9ac31910db3975d5e92a6265ab29dafd6a4691d/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp#L3699)
The difficulty of using constant pool loading at legalization stage is the specific nature of the legality predicate. In this case it should be based on the value of operand, but `LegalizerInfo::getAction(const LegalityQuery &Query)` does not provide such info. A possible solution is extending `LegalityQuery` with the information about constant arguments. Another way is to modify `LegalizerHelper::legalizeInstrStep` so that it allow selection of other legalization actions if some legalization step is failed. Both ways however require substantial changes and it is not clear if they agree with GlobalISel design. If you have ideas how to the legalization could be implemented, could you please share?
https://github.com/llvm/llvm-project/pull/96225
More information about the llvm-commits
mailing list