//===-- RISCVMoveMerger.cpp - RISC-V move merge pass ----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains a pass that performs move related peephole optimizations // as Zcmp has specified. This pass should be run after register allocation. // //===----------------------------------------------------------------------===// #include "RISCVInstrInfo.h" #include "RISCVMachineFunctionInfo.h" usingnamespacellvm; #define RISCV_MOVE_MERGE_NAME … namespace { struct RISCVMoveMerge : public MachineFunctionPass { … }; char RISCVMoveMerge::ID = …; } // end of anonymous namespace INITIALIZE_PASS(…) // Check if registers meet CM.MVA01S constraints. bool RISCVMoveMerge::isCandidateToMergeMVA01S(const DestSourcePair &RegPair) { … } // Check if registers meet CM.MVSA01 constraints. bool RISCVMoveMerge::isCandidateToMergeMVSA01(const DestSourcePair &RegPair) { … } MachineBasicBlock::iterator RISCVMoveMerge::mergePairedInsns(MachineBasicBlock::iterator I, MachineBasicBlock::iterator Paired, unsigned Opcode) { … } MachineBasicBlock::iterator RISCVMoveMerge::findMatchingInst(MachineBasicBlock::iterator &MBBI, unsigned InstOpcode, const DestSourcePair &RegPair) { … } // Finds instructions, which could be represented as C.MV instructions and // merged into CM.MVA01S or CM.MVSA01. bool RISCVMoveMerge::mergeMoveSARegPair(MachineBasicBlock &MBB) { … } bool RISCVMoveMerge::runOnMachineFunction(MachineFunction &Fn) { … } /// createRISCVMoveMergePass - returns an instance of the /// move merge pass. FunctionPass *llvm::createRISCVMoveMergePass() { … }