aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/CodeGen/TargetInstrInfo.h
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 21:11:10 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 21:11:10 +0800
commitcd30fb546e389d1fb78ce8e579b3dba3a8fdb52a (patch)
tree891d7065c52e56d3f559b146f3a07055105d9d4e /backend/include/rcc/CodeGen/TargetInstrInfo.h
parent98cae0e8835a1eb8fcb0e43870c04ed934cc51ac (diff)
downloadrcc-project-cd30fb546e389d1fb78ce8e579b3dba3a8fdb52a.tar.gz
rcc-project-cd30fb546e389d1fb78ce8e579b3dba3a8fdb52a.tar.xz
[CodeGen] Match LLVM machine copy propagation
Diffstat (limited to 'backend/include/rcc/CodeGen/TargetInstrInfo.h')
-rw-r--r--backend/include/rcc/CodeGen/TargetInstrInfo.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/TargetInstrInfo.h b/backend/include/rcc/CodeGen/TargetInstrInfo.h
index 34752c5..8457ede 100644
--- a/backend/include/rcc/CodeGen/TargetInstrInfo.h
+++ b/backend/include/rcc/CodeGen/TargetInstrInfo.h
@@ -16,8 +16,14 @@ namespace rcc {
class MachineBasicBlock;
class MachineFunction;
class MachineInstr;
+class MachineOperand;
class TargetDescription;
+struct MachineCopyOperands final {
+ MachineOperand *Destination = nullptr;
+ MachineOperand *Source = nullptr;
+};
+
struct MachineBranchAnalysis final {
MachineInstr *Conditional = nullptr;
MachineInstr *Unconditional = nullptr;
@@ -57,6 +63,16 @@ public:
const MachineFunction &Function,
const TargetDescription &Target) const = 0;
+ [[nodiscard]] virtual std::optional<MachineCopyOperands>
+ getCopyOperands(MachineInstr &) const noexcept {
+ return std::nullopt;
+ }
+
+ [[nodiscard]] virtual Expected<bool> simplifyInstruction(MachineInstr &, MachineFunction &,
+ const TargetDescription &) const {
+ return false;
+ }
+
[[nodiscard]] virtual Expected<bool> tryConvertToThreeAddress(MachineInstr &, std::size_t,
std::size_t, MachineFunction &,
const TargetDescription &) const {