From 4c6d6fc176a115d196194c6d5091d3279d27fffa Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Sun, 8 Jan 2023 11:50:50 +0800 Subject: [PATCH] [AVR] Do not select unimplemented pseudo instructions Reviewed By: aykevl, Miss_Grape Differential Revision: https://reviews.llvm.org/D141210 --- llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp | 2 +- llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp b/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp index f471e72..2c97dea 100644 --- a/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp +++ b/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp @@ -888,7 +888,7 @@ bool AVRExpandPseudo::expand(Block &MBB, BlockIt MBBI) { template <> bool AVRExpandPseudo::expand(Block &MBB, BlockIt MBBI) { - llvm_unreachable("byte ELPMPi is unimplemented"); + llvm_unreachable("8-bit ELPMPi is unimplemented"); } template <> diff --git a/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp b/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp index 67b822a..36d2e8c 100644 --- a/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp +++ b/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp @@ -188,18 +188,13 @@ unsigned AVRDAGToDAGISel::selectIndexedProgMemLoad(const LoadSDNode *LD, MVT VT, unsigned Opcode = 0; int Offs = cast(LD->getOffset())->getSExtValue(); - switch (VT.SimpleTy) { - case MVT::i8: - if (Offs == 1) - Opcode = Bank > 0 ? AVR::ELPMBRdZPi : AVR::LPMRdZPi; - break; - case MVT::i16: - if (Offs == 2) - Opcode = Bank > 0 ? AVR::ELPMWRdZPi : AVR::LPMWRdZPi; - break; - default: - break; - } + if (VT.SimpleTy == MVT::i8 && Offs == 1 && Bank == 0) + Opcode = AVR::LPMRdZPi; + + // TODO: Implements the expansion of the following pseudo instructions. + // LPMWRdZPi: type == MVT::i16, offset == 2, Bank == 0. + // ELPMBRdZPi: type == MVT::i8, offset == 1, Bank > 0. + // ELPMWRdZPi: type == MVT::i16, offset == 2, Bank > 0. return Opcode; } -- 2.7.4