[PATCH] D125391: [Target] use getSubtarget<> instead of static_cast<>(getSubtarget())
lzw via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 12 02:59:33 PDT 2022
Ghost-LZW added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/SelectionDAG.h:455
const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
+ template <typename STC> const STC &getSubtarget() const {
+ return MF->getSubtarget<STC>();
----------------
zixuan-wu wrote:
> As we don't prefer to use static_cast, then why not delete original getSubtarget. Or it can't replace all places with template one?
Somewhere may just need the abstract sub-target, so we need to keep the original getSubtarget. The MF->getSubtarget<> did the static_cast in fact, so we don't want static_cast the abstract sub-target into himself.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125391/new/
https://reviews.llvm.org/D125391
More information about the llvm-commits
mailing list