From 8721893d3ba605f5374d9c0c7987af6110355638 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 12 Aug 2026 20:39:04 +0800 Subject: [CodeGen] Add TargetInstrInfo ownership --- backend/include/rcc/CodeGen/TargetBranchInfo.h | 66 -------------------------- 1 file changed, 66 deletions(-) delete mode 100644 backend/include/rcc/CodeGen/TargetBranchInfo.h (limited to 'backend/include/rcc/CodeGen/TargetBranchInfo.h') diff --git a/backend/include/rcc/CodeGen/TargetBranchInfo.h b/backend/include/rcc/CodeGen/TargetBranchInfo.h deleted file mode 100644 index 39c5122..0000000 --- a/backend/include/rcc/CodeGen/TargetBranchInfo.h +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef RCC_CODEGEN_TARGETBRANCHINFO_H -#define RCC_CODEGEN_TARGETBRANCHINFO_H - -#include "rcc/Support/Error.h" - -#include -#include - -namespace rcc { - -class MachineBasicBlock; -class MachineFunction; -class MachineInstr; -class TargetDescription; - -struct MachineBranchAnalysis final { - MachineInstr *Conditional = nullptr; - MachineInstr *Unconditional = nullptr; - MachineBasicBlock *TrueTarget = nullptr; - MachineBasicBlock *FalseTarget = nullptr; - bool HasUnanalyzableTerminator = false; -}; - -class TargetBranchInfo { -public: - virtual ~TargetBranchInfo() = default; - - [[nodiscard]] virtual Expected - analyzeBranch(MachineBasicBlock &Block, MachineFunction &Function, - const TargetDescription &Target) const = 0; - [[nodiscard]] virtual Expected - reverseBranchCondition(MachineInstr &Branch, MachineBasicBlock &NewTarget, - MachineFunction &Function, const TargetDescription &Target) const = 0; - [[nodiscard]] virtual Expected removeBranch(MachineInstr &Branch, MachineFunction &Function, - const TargetDescription &Target) const = 0; - [[nodiscard]] virtual Expected - rewriteBranchTarget(MachineBasicBlock &Block, MachineBasicBlock &OldTarget, - MachineBasicBlock &NewTarget, MachineFunction &Function, - const TargetDescription &Target) const = 0; - [[nodiscard]] virtual Expected - insertUnconditionalBranch(MachineBasicBlock &Block, MachineBasicBlock &TargetBlock, - MachineFunction &Function, const TargetDescription &Target) const = 0; - - [[nodiscard]] virtual Expected - instructionSize(const MachineInstr &Instruction, const MachineFunction &Function, - const TargetDescription &Target) const = 0; - [[nodiscard]] virtual Expected - branchTarget(MachineInstr &Instruction, MachineFunction &Function, - const TargetDescription &Target) const = 0; - [[nodiscard]] virtual Expected> - evaluateBranchCondition(const MachineInstr &, const MachineFunction &, - const TargetDescription &) const { - return std::optional{}; - } - [[nodiscard]] virtual bool isBranchOffsetInRange(const MachineInstr &Instruction, - std::int64_t Offset) const noexcept = 0; - [[nodiscard]] virtual Expected relaxBranch(MachineInstr &Instruction, std::int64_t Offset, - MachineFunction &Function, - const TargetDescription &Target) const = 0; -}; - -} // namespace rcc - -#endif // RCC_CODEGEN_TARGETBRANCHINFO_H -- cgit v1.2.3