LLVM 24.0.0git
RISCVExpandPseudoBase.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the base class used by the several RISC-V Pseudo
10// Instruction Expansion passes. This avoids having to re-implement some of the
11// boilerplate needed in these passes.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_RISCV_RISCVEXPANDPSEUDOBASE_H
16#define LLVM_LIB_TARGET_RISCV_RISCVEXPANDPSEUDOBASE_H
17
18#include "RISCV.h"
20
21namespace llvm {
22
23class RISCVSubtarget;
24class RISCVInstrInfo;
25
27public:
28 /// Expand a subset of pseudos in the current function. Returns whether the
29 /// function was modified.
30 ///
31 /// This will assert if expansion increased the estimated size of the
32 /// function.
33 bool run(MachineFunction &MF);
34
35 virtual ~RISCVExpandPseudoImplBase() = default;
36
37protected:
38 /// The Subtarget for the current function.
40
41 /// The derived TargetInstrInfo for the current function.
43
44 /// This method should be implemented to expand the instruction at `*MBBI`.
45 /// The iteration over the current basic block will continue at `NextMBBI`.
46 /// This method should return `true` if it replaced the instruction at
47 /// `*MBBI`.
50 MachineBasicBlock::iterator &NextMBBI) const {
51 reportFatalInternalError("Expand Pseudos not yet implemented.");
52 return false;
53 }
54
55private:
56 bool expandMBB(MachineBasicBlock &MBB) const;
57};
58
59} // namespace llvm
60
61#endif // LLVM_LIB_TARGET_RISCV_RISCVEXPANDPSEUDOBASE_H
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator MBBI
MachineInstrBundleIterator< MachineInstr > iterator
const RISCVInstrInfo * TII
The derived TargetInstrInfo for the current function.
virtual bool expandMI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, MachineBasicBlock::iterator &NextMBBI) const
This method should be implemented to expand the instruction at *MBBI.
virtual ~RISCVExpandPseudoImplBase()=default
bool run(MachineFunction &MF)
Expand a subset of pseudos in the current function.
const RISCVSubtarget * STI
The Subtarget for the current function.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
Definition Error.cpp:173